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.
15 # Do this first because the bug only exhibits itself before partial
16 # symbols have been expanded.
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"
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
110 gdb_test "p const69" " = 69" "'e' constant on non-enum type"
111 gdb_test "whatis const69" "type = (unsigned int|inttype)" "whatis const69"
113 # Haven't investigated
115 gdb_test "p sizeof (const70)" " = 2" "'e' constant with embedded type"
117 # field3 is printing out a bogus value; haven't investigated
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"
123 gdb_test "ptype inttype" "type = (unsigned int|inttype)" "ptype on inttype"
124 gdb_test "p sizeof (float72type)" " = 9" "unrecognized floating point type"
126 gdb_test "p/x int256var" " = 0x0*2a0000002b0000002c0000002d\
127 0000002d0000002c0000002b0000002a" "print very big integer"
129 gdb_test "whatis consth" "type = inttype" "whatis consth"
130 gdb_test "whatis consth2" "type = inttype" "whatis consth2"
132 # GDB does not yet understand S constants
134 gdb_test "p/x bad_neg0const" " = \{field0 = 0x11222211, field2 =.*\
135 field3 = 0x77888877\}" "print struct constant"
137 gdb_test "ptype bad_type0" "type = " "print bad_type0"
138 gdb_test "ptype bad_type1" "type = " "print bad_type1"
140 # GDB does not yet support arrays indexed by anything at all unusual
142 gdb_test "p array0" " = \{42, 43, 44, 45, 46, 47\}" "array0 with strange index"
144 gdb_test "p array1" " = \{42, 43, 44\}" "array1 with strange index"
146 # GDB does not yet support this feature
148 gdb_test "whatis one_var" "type = inttype_one" "whatis one_var"
149 # But do make sure that it prints as something reasonable
150 gdb_test "whatis one_var" "type = inttype(|_one)" "whatis one_var test 2"
153 gdb_test "whatis two_var" "type = inttype_two" "whatis two_var"
154 gdb_test "whatis two_var" "type = inttype(|_two)" "whatis two_var test 2"
157 gdb_test "whatis pointer_to_int_var" "type = int \*" "whatis p t i v"
159 gdb_test "whatis intp_var" "type = intp" "whatis intp_var"
161 # xcoffread.c doesn't understand common blocks at all
162 setup_xfail "rs6*-*-aix*"
163 gdb_test "p common0var0" "= 42"
164 # GDB seems to only understand common blocks local to a function.
165 # These variables never get relocated to be relative to the common
167 # I'm not sure whether it is valid to have a common block which
168 # is not local to a function.
170 gdb_test "p common0var1" "= 24"
172 gdb_test "p common0var2" "= 22"
174 gdb_test "p v_comb" "{<> = \
175 {<> = {x = 42}, \[_a-zA-Z$\]* = \[0-9xa-fA-F\]*, a = 43}, \
176 <> = {\[_a-zA-Z$\]* = \[0-9xa-fA-F\]*, b = 44}, comb = 45}"
179 proc print_wierd_var { var } {
182 # Make sure that the variable gets printed out correctly, without
183 # any sort of warning message.
186 -re "^print $var\r*\n.\[0-9\]* = 42.*$prompt $" {
187 pass "variable $var printed properly"
190 fail "variable $var not printed properly"
192 timeout { fail "variable $var not printed (timeout)" }
193 eof { fail "(eof) variable $var not printed" }
196 # Make sure that the stabs did get loaded in a sensible way.
197 # If somehow the stabs got skipped, then the above test can
198 # pass because GDB assumes int for variables without a stab.
200 gdb_test "whatis $var" "type = (unsigned int|inttype)" "whatis on $var"
203 # Start with a fresh gdb
207 gdb_reinitialize_dir $srcdir/$subdir
209 # Don't use gdb_load; it doesn't bitch if the loading produced some
210 # error messages during symbol reading.
211 set binfile $objdir/$subdir/wierd.o
213 if ![file exists $binfile] then {
214 warning "$binfile does not exist; tests suppressed"
216 # xcoffread.c wrongly bitches about the lack of a text section.
217 setup_xfail "rs*-*-aix*"
218 send "file $binfile\n"
220 -re "^file $binfile\r*\nReading symbols from $binfile\.\.\.done\.\r*\n$prompt $" {
221 pass "wierd.o read without error"
224 fail "Errors reading wierd.o"
227 error "couldn't load $binfile into $GDB (timed out)."
230 eof { fail "(eof) cannot read wierd.o" }