Commit | Line | Data |
---|---|---|
1458f956 JK |
1 | # Test that GDB properly ignores invalid stabs. |
2 | # Also test that GDB can debug a .o file, and that it doesn't mind | |
3 | # a file that's more minimal than what a compiler normally puts out. | |
4 | if $tracelevel then { | |
5 | strace $tracelevel | |
150ab440 FF |
6 | } |
7 | ||
1458f956 JK |
8 | set prms_id 0 |
9 | set bug_id 0 | |
10 | ||
150ab440 FF |
11 | proc do_tests {} { |
12 | global binfile | |
13 | global prompt | |
1458f956 | 14 | |
150ab440 FF |
15 | # Do this first because the bug only exhibits itself before partial |
16 | # symbols have been expanded. | |
17 | setup_xfail "*-*-*" | |
18 | # xcoffread.c doesn't (yet) use partial symbol tables. | |
19 | clear_xfail "rs*-*-aix*" | |
20 | gdb_test "ptype red" "type = enum \{red, green, blue\}" "ptype unnamed enum" | |
21 | ||
22 | print_wierd_var var0 | |
23 | print_wierd_var var1 | |
24 | print_wierd_var var2 | |
25 | print_wierd_var var3 | |
26 | ||
27 | print_wierd_var attr32 | |
28 | print_wierd_var attr33 | |
29 | print_wierd_var attr35 | |
30 | print_wierd_var attr36 | |
31 | print_wierd_var attr37 | |
32 | print_wierd_var attr38 | |
33 | print_wierd_var attr39 | |
34 | print_wierd_var attr41 | |
35 | print_wierd_var attr42 | |
36 | print_wierd_var attr43 | |
37 | print_wierd_var attr44 | |
38 | print_wierd_var attr46 | |
39 | print_wierd_var attr47 | |
40 | print_wierd_var attr58 | |
41 | print_wierd_var attr59 | |
42 | print_wierd_var attr60 | |
43 | print_wierd_var attr61 | |
44 | print_wierd_var attr62 | |
45 | print_wierd_var attr63 | |
46 | print_wierd_var attr64 | |
47 | print_wierd_var attr65 | |
48 | print_wierd_var attr66 | |
49 | print_wierd_var attr67 | |
50 | print_wierd_var attr68 | |
51 | print_wierd_var attr69 | |
52 | print_wierd_var attr70 | |
53 | print_wierd_var attr71 | |
54 | print_wierd_var attr72 | |
55 | print_wierd_var attr73 | |
56 | print_wierd_var attr74 | |
57 | print_wierd_var attr75 | |
58 | print_wierd_var attr76 | |
59 | print_wierd_var attr77 | |
60 | print_wierd_var attr78 | |
61 | print_wierd_var attr79 | |
62 | print_wierd_var attr80 | |
63 | print_wierd_var attr81 | |
64 | print_wierd_var attr82 | |
65 | print_wierd_var attr83 | |
66 | print_wierd_var attr84 | |
67 | print_wierd_var attr85 | |
68 | print_wierd_var attr86 | |
69 | print_wierd_var attr87 | |
70 | print_wierd_var attr88 | |
71 | print_wierd_var attr89 | |
72 | print_wierd_var attr90 | |
73 | print_wierd_var attr91 | |
74 | print_wierd_var attr92 | |
75 | print_wierd_var attr93 | |
76 | print_wierd_var attr94 | |
77 | print_wierd_var attr95 | |
78 | print_wierd_var attr96 | |
79 | print_wierd_var attr97 | |
80 | print_wierd_var attr98 | |
81 | print_wierd_var attr99 | |
82 | print_wierd_var attr100 | |
83 | print_wierd_var attr101 | |
84 | print_wierd_var attr102 | |
85 | print_wierd_var attr103 | |
86 | print_wierd_var attr104 | |
87 | print_wierd_var attr105 | |
88 | print_wierd_var attr106 | |
89 | print_wierd_var attr107 | |
90 | print_wierd_var attr108 | |
91 | print_wierd_var attr109 | |
92 | print_wierd_var attr110 | |
93 | print_wierd_var attr111 | |
94 | print_wierd_var attr112 | |
95 | print_wierd_var attr113 | |
96 | print_wierd_var attr114 | |
97 | print_wierd_var attr115 | |
98 | print_wierd_var attr116 | |
99 | print_wierd_var attr117 | |
100 | print_wierd_var attr118 | |
101 | print_wierd_var attr119 | |
102 | print_wierd_var attr120 | |
103 | print_wierd_var attr121 | |
104 | print_wierd_var attr122 | |
105 | print_wierd_var attr123 | |
106 | print_wierd_var attr124 | |
107 | print_wierd_var attr125 | |
108 | print_wierd_var attr126 | |
109 | ||
110 | gdb_test "p const69" " = 69" "'e' constant on non-enum type" | |
111 | gdb_test "whatis const69" "type = (unsigned int|inttype)" "whatis const69" | |
112 | ||
113 | # Haven't investigated | |
114 | setup_xfail "*-*-*" | |
115 | gdb_test "p sizeof (const70)" " = 2" "'e' constant with embedded type" | |
1458f956 | 116 | |
150ab440 FF |
117 | # field3 is printing out a bogus value; haven't investigated |
118 | setup_xfail "*-*-*" | |
119 | gdb_test "p bad_neg0" " = \{field0 = 42, field2 =.*field3 = 45\}" "p bad_neg0" | |
120 | # test that it at least gets field0 right | |
121 | gdb_test "p bad_neg0" " = \{field0 = 42, field2 =" "p bad_neg0, test 2" | |
1458f956 | 122 | |
150ab440 FF |
123 | gdb_test "ptype inttype" "type = (unsigned int|inttype)" "ptype on inttype" |
124 | gdb_test "p sizeof (float72type)" " = 9" "unrecognized floating point type" | |
125 | ||
126 | # Haven't investigated | |
127 | setup_xfail "*-*-*" | |
128 | gdb_test "p/x int256var" " = 0x0000002a0000002b0000002c0000002d\ | |
129 | 0000002d0000002c0000002b0000002a" "print very big integer" | |
1458f956 | 130 | |
150ab440 FF |
131 | gdb_test "whatis consth" "type = inttype" "whatis consth" |
132 | gdb_test "whatis consth2" "type = inttype" "whatis consth2" | |
133 | ||
134 | # GDB does not yet understand S constants | |
135 | setup_xfail "*-*-*" | |
136 | gdb_test "p/x bad_neg0const" " = \{field0 = 0x11222211, field2 =.*\ | |
137 | field3 = 0x77888877\}" "print struct constant" | |
138 | ||
139 | gdb_test "ptype bad_type0" "type = " "print bad_type0" | |
140 | gdb_test "ptype bad_type1" "type = " "print bad_type1" | |
141 | ||
142 | # GDB does not yet support arrays indexed by anything at all unusual | |
143 | setup_xfail "*-*-*" | |
144 | gdb_test "p array0" " = \{42, 43, 44, 45, 46, 47\}" "array0 with strange index" | |
145 | setup_xfail "*-*-*" | |
146 | gdb_test "p array1" " = \{42, 43, 44\}" "array1 with strange index" | |
147 | ||
148 | # GDB does not yet support this feature | |
149 | setup_xfail "*-*-*" | |
150 | gdb_test "whatis one_var" "type = inttype_one" "whatis one_var" | |
151 | # But do make sure that it prints as something reasonable | |
152 | gdb_test "whatis one_var" "type = inttype(|_one)" "whatis one_var test 2" | |
153 | ||
154 | setup_xfail "*-*-*" | |
155 | gdb_test "whatis two_var" "type = inttype_two" "whatis two_var" | |
156 | gdb_test "whatis two_var" "type = inttype(|_two)" "whatis two_var test 2" | |
157 | ||
158 | setup_xfail "*-*-*" | |
159 | gdb_test "whatis pointer_to_int_var" "type = int \*" "whatis p t i v" | |
160 | setup_xfail "*-*-*" | |
161 | gdb_test "whatis intp_var" "type = intp" "whatis intp_var" | |
162 | } | |
12a09603 | 163 | |
1458f956 JK |
164 | proc print_wierd_var { var } { |
165 | global prompt | |
166 | ||
1458f956 JK |
167 | # Make sure that the variable gets printed out correctly, without |
168 | # any sort of warning message. | |
169 | send "print $var\n" | |
170 | expect { | |
171 | -re "^print $var\r*\n.\[0-9\]* = 42.*$prompt $" { | |
172 | pass "variable $var printed properly" | |
1458f956 JK |
173 | } |
174 | -re ".*$prompt $" { | |
175 | fail "variable $var not printed properly" | |
1458f956 JK |
176 | } |
177 | timeout { fail "variable $var not printed (timeout)" } | |
16b00357 | 178 | eof { fail "(eof) variable $var not printed" } |
1458f956 | 179 | } |
b1285bd9 | 180 | |
b1285bd9 JK |
181 | # Make sure that the stabs did get loaded in a sensible way. |
182 | # If somehow the stabs got skipped, then the above test can | |
183 | # pass because GDB assumes int for variables without a stab. | |
184 | ||
05b4279b | 185 | gdb_test "whatis $var" "type = (unsigned int|inttype)" "whatis on $var" |
1458f956 JK |
186 | } |
187 | ||
150ab440 FF |
188 | # Start with a fresh gdb |
189 | ||
1458f956 JK |
190 | gdb_exit |
191 | gdb_start | |
150ab440 FF |
192 | gdb_reinitialize_dir $srcdir/$subdir |
193 | ||
194 | # Don't use gdb_load; it doesn't bitch if the loading produced some | |
195 | # error messages during symbol reading. | |
196 | set binfile $objdir/$subdir/wierd.o | |
197 | ||
198 | if ![file exists $binfile] then { | |
199 | warning "$binfile does not exist; tests suppressed" | |
200 | } else { | |
201 | # xcoffread.c wrongly bitches about the lack of a text section. | |
202 | setup_xfail "rs*-*-aix*" | |
203 | send "file $binfile\n" | |
204 | expect { | |
205 | -re "^file $binfile\r*\nReading symbols from $binfile\.\.\.done\.\r*\n$prompt $" { | |
206 | pass "wierd.o read without error" | |
207 | } | |
208 | -re ".*$prompt $" { | |
209 | fail "Errors reading wierd.o" | |
210 | } | |
211 | timeout { | |
212 | error "couldn't load $binfile into $GDB (timed out)." | |
213 | return -1 | |
214 | } | |
215 | eof { fail "(eof) cannot read wierd.o" } | |
216 | } | |
217 | do_tests | |
218 | } | |
219 | ||
220 | return 0 |