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