OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [type-opaque.exp] - Blame information for rev 25

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 jlechner
# Copyright 2004, 2007, 2008 Free Software Foundation, Inc.
2
 
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 3 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program.  If not, see .  */
15
 
16
# Please email any bugs, comments, and/or additions to this file to:
17
# bug-gdb@prep.ai.mit.edu
18
 
19
# Test resolving of an opaque type from the loaded shared library.
20
 
21
if $tracelevel then {
22
    strace $tracelevel
23
}
24
 
25
set testfile type-opaque-main
26
set libfile type-opaque-lib
27
set srcfile ${testfile}.c
28
set binfile ${objdir}/${subdir}/${testfile}
29
 
30
set libsrc "${srcdir}/${subdir}/${libfile}.c"
31
set libobj "${objdir}/${subdir}/${libfile}.so"
32
set execsrc "${srcdir}/${subdir}/${srcfile}"
33
 
34
remote_exec build "rm -f ${binfile}"
35
 
36
# Are we on a target board?  No support for downloading shared libraries
37
# to a target yet.
38
if ![isnative] then {
39
    return 0
40
}
41
 
42
# get the value of gcc_compiled
43
if [get_compiler_info ${binfile}] {
44
    return -1
45
}
46
 
47
if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
48
     || [gdb_compile $execsrc ${binfile} executable \
49
             [list debug shlib=${libobj}]] != "" } {
50
    return -1
51
}
52
 
53
gdb_exit
54
gdb_start
55
gdb_reinitialize_dir $srcdir/$subdir
56
gdb_load ${binfile}
57
 
58
if ![runto_main] then {
59
    fail "Can't run to main"
60
    return 0
61
}
62
 
63
 
64
# DWARF3: An incomplete structure, union or class type is represented by
65
# a structure, union or class entry that does not have a byte size attribute
66
# and that has a DW_AT_declaration attribute.
67
 
68
 
69
proc body { struct } {
70
    global gdb_prompt
71
 
72
 
73
    # <1><15f>: Abbrev Number: 8 (DW_TAG_structure_type)
74
    #     DW_AT_name        : libtype_opaque
75
    #     DW_AT_declaration : 1
76
 
77
    set name "opaque $struct type resolving"
78
    gdb_test_multiple "ptype pointer_${struct}_opaque" $name \
79
    {
80
        -re "libfield_opaque.*$gdb_prompt $"  {
81
            pass $name
82
        }
83
    }
84
 
85
 
86
    # <1><9e>: Abbrev Number: 2 (DW_TAG_structure_type)
87
    #     DW_AT_name        : libtype_empty
88
    #     DW_AT_byte_size   : 0
89
    #     DW_AT_decl_file   : 1
90
    #     DW_AT_decl_line   : 25
91
 
92
    set name "empty $struct type resolving"
93
    gdb_test_multiple "ptype pointer_${struct}_empty" $name \
94
    {
95
        -re "\\{\[ \t\r\n\]*\[ \t\r\n\]*\\}.*$gdb_prompt $"  {
96
            pass $name
97
        }
98
        -re "libfield_empty.*$gdb_prompt $"  {
99
            fail $name
100
        }
101
    }
102
 
103
 
104
    # <1>: Abbrev Number: 3 (DW_TAG_structure_type)
105
    #     DW_AT_sibling     : 
106
    #     DW_AT_name        : libtype_filled
107
    #     DW_AT_byte_size   : 4
108
    #     DW_AT_decl_file   : 1
109
    #     DW_AT_decl_line   : 29
110
    # <2>: Abbrev Number: 4 (DW_TAG_member)
111
    #     DW_AT_name        : mainfield_filled
112
    #     DW_AT_decl_file   : 1
113
    #     DW_AT_decl_line   : 30
114
    #     DW_AT_type        : 
115
    #     DW_AT_data_member_location: 2 byte block: 23 0     (DW_OP_plus_uconst: 0)
116
 
117
    set name "filled $struct type resolving"
118
    gdb_test_multiple "ptype pointer_${struct}_filled" $name \
119
    {
120
        -re "mainfield_filled.*$gdb_prompt $"  {
121
            pass $name
122
        }
123
        -re "libfield_filled.*$gdb_prompt $"  {
124
            fail $name
125
        }
126
    }
127
 
128
 
129
}
130
 
131
 
132
body struct
133
body union

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.