Commit | Line | Data |
---|---|---|
a1dea79a | 1 | # Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. |
c906108c SS |
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 2 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, write to the Free Software | |
15 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
16 | ||
17 | # Please email any bugs, comments, and/or additions to this file to: | |
18 | # bug-gdb@prep.ai.mit.edu | |
19 | ||
20 | # This file was written by Elena Zannoni (ezannoni@cygnus.com) | |
21 | ||
22 | # this file tests maintenance commands and help on those. | |
23 | ||
24 | # source file used is break.c | |
25 | ||
26 | ||
27 | #maintenance check-symtabs -- Check consistency of psymtabs and symtabs | |
28 | #maintenance space -- Set the display of space usage | |
4f337972 AC |
29 | #maintenance set -- Set GDB internal variables used by the GDB maintainer |
30 | #maintenance show -- Show GDB internal variables used by the GDB maintainer | |
c906108c SS |
31 | #maintenance time -- Set the display of time usage |
32 | #maintenance demangle -- Demangle a C++ mangled name | |
33 | #maintenance dump-me -- Get fatal error; make debugger dump its core | |
34 | #maintenance print -- Maintenance command for printing GDB internal state | |
35 | #maintenance info -- Commands for showing internal info about the program being debugged | |
7be570e7 | 36 | #maintenance internal-error -- Give GDB an internal error. |
c906108c | 37 | # |
00905d52 | 38 | #maintenance print dummy-frames -- Print the dummy frame stack |
c906108c SS |
39 | #maintenance print statistics -- Print statistics about internal gdb state |
40 | #maintenance print objfiles -- Print dump of current object file definitions | |
41 | #maintenance print psymbols -- Print dump of current partial symbol definitions | |
42 | #maintenance print msymbols -- Print dump of current minimal symbol definitions | |
43 | #maintenance print symbols -- Print dump of current symbol definitions | |
44 | #maintenance print type -- Print a type chain for a given symbol | |
45 | #maintenance print unwind -- Print unwind table entry at given address | |
46 | # | |
47 | # | |
48 | #maintenance info sections -- List the BFD sections of the exec and core files | |
49 | #maintenance info breakpoints -- Status of all breakpoints | |
50 | # | |
51 | ||
52 | ||
53 | ||
54 | if $tracelevel then { | |
55 | strace $tracelevel | |
56 | } | |
57 | ||
58 | global usestubs | |
59 | ||
60 | # | |
61 | # test running programs | |
62 | # | |
63 | set prms_id 0 | |
64 | set bug_id 0 | |
65 | ||
66 | set testfile "break" | |
67 | set srcfile ${testfile}.c | |
a1dea79a | 68 | set srcfile1 ${testfile}1.c |
c906108c | 69 | set binfile ${objdir}/${subdir}/${testfile} |
a1dea79a FF |
70 | |
71 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } { | |
72 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
73 | } | |
74 | ||
75 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } { | |
76 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
77 | } | |
78 | ||
79 | if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } { | |
80 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
c906108c SS |
81 | } |
82 | ||
83 | ||
84 | gdb_exit | |
85 | gdb_start | |
86 | gdb_reinitialize_dir $srcdir/$subdir | |
87 | gdb_load ${binfile} | |
88 | ||
89 | if ![runto_main] then { | |
90 | perror "tests suppressed" | |
91 | } | |
92 | ||
93 | ||
94 | # The commands we test here produce many lines of output; disable "press | |
95 | # <return> to continue" prompts. | |
96 | send_gdb "set height 0\n" | |
97 | gdb_expect -re "$gdb_prompt $" | |
98 | ||
99 | # use a larger expect input buffer for long help outputs. | |
100 | match_max 6000 | |
101 | ||
102 | # | |
103 | # this command does not produce any output | |
104 | # unless there is some problem with the symtabs and psymtabs | |
105 | # so that branch will really never be covered in this tests here!! | |
106 | # | |
107 | ||
a0b3c4fd JM |
108 | # guo: on linux this command output is huge. for some reason splitting up |
109 | # the regexp checks works. | |
110 | # | |
c906108c SS |
111 | send_gdb "maint check-symtabs\n" |
112 | gdb_expect { | |
a0b3c4fd JM |
113 | -re "^maint check-symtabs" { |
114 | gdb_expect { | |
115 | -re "$gdb_prompt $" \ | |
c906108c | 116 | { pass "maint check-symtabs" } |
a0b3c4fd JM |
117 | timeout { fail "(timeout) maint check-symtabs" } |
118 | } | |
119 | } | |
c906108c SS |
120 | -re ".*$gdb_prompt $" { fail "maint check-symtabs" } |
121 | timeout { fail "(timeout) maint check-symtabs" } | |
122 | } | |
123 | ||
124 | send_gdb "maint space\n" | |
125 | gdb_expect { | |
126 | -re "\"maintenance space\" takes a numeric argument\\..*$gdb_prompt $"\ | |
127 | { pass "maint space" } | |
128 | -re ".*$gdb_prompt $" { fail "maint space" } | |
129 | timeout { fail "(timeout) maint space" } | |
130 | } | |
131 | ||
132 | send_gdb "maint space 1\n" | |
133 | gdb_expect { | |
134 | -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
135 | { pass "maint space 1" } | |
136 | -re ".*$gdb_prompt $" { fail "maint space 1" } | |
137 | timeout { fail "(timeout) maint space 1" } | |
138 | } | |
139 | ||
140 | ||
141 | send_gdb "maint time\n" | |
142 | gdb_expect { | |
143 | -re "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
144 | { pass "maint time" } | |
145 | -re ".*$gdb_prompt $" { fail "maint time" } | |
146 | timeout { fail "(timeout) maint time" } | |
147 | } | |
148 | ||
149 | send_gdb "maint time 1\n" | |
150 | gdb_expect { | |
151 | -re "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
152 | { pass "maint time 1" } | |
153 | -re ".*$gdb_prompt $" { fail "maint time 1" } | |
154 | timeout { fail "(timeout) maint time 1" } | |
155 | } | |
156 | ||
157 | send_gdb "maint time 0\n" | |
158 | gdb_expect { | |
159 | -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
160 | { pass "maint time 0" } | |
161 | -re ".*$gdb_prompt $" { fail "maint time 0" } | |
162 | timeout { fail "(timeout) maint time 0" } | |
163 | } | |
164 | ||
165 | ||
166 | send_gdb "maint space 0\n" | |
167 | gdb_expect { | |
168 | -re "maint space 0\r\n$gdb_prompt $"\ | |
169 | { pass "maint space 0" } | |
170 | -re ".*$gdb_prompt $" { fail "maint space 0" } | |
171 | timeout { fail "(timeout) maint space 0" } | |
172 | } | |
173 | ||
174 | send_gdb "maint demangle\n" | |
175 | gdb_expect { | |
176 | -re "\"maintenance demangle\" takes an argument to demangle\\..*$gdb_prompt $"\ | |
177 | { pass "maint demangle" } | |
178 | -re ".*$gdb_prompt $" { fail "maint demangle" } | |
179 | timeout { fail "(timeout) maint demangle" } | |
180 | } | |
181 | ||
182 | send_gdb "maint demangle main\n" | |
183 | gdb_expect { | |
184 | -re "Can't demangle \"main\".*$gdb_prompt $"\ | |
185 | { pass "maint demangle" } | |
186 | -re ".*$gdb_prompt $" { fail "maint demangle" } | |
187 | timeout { fail "(timeout) maint demangle" } | |
188 | } | |
189 | ||
190 | ||
191 | send_gdb "maint print statistics\n" | |
192 | gdb_expect { | |
c4f90d87 | 193 | -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for psymbol obstack.*Total memory used for psymbol cache.*Total memory used for symbol obstack.*Total memory used for type obstack.*$gdb_prompt $"\ |
c906108c SS |
194 | { pass "maint print statistics" } |
195 | -re ".*$gdb_prompt $" { fail "maint print statistics" } | |
196 | timeout { fail "(timeout) maint print statistics" } | |
197 | } | |
198 | ||
00905d52 AC |
199 | # There aren't any ... |
200 | gdb_test "maint print dummy-frames" "" | |
201 | ||
c906108c | 202 | send_gdb "maint print objfiles\n" |
adf40b2e | 203 | |
c906108c | 204 | # To avoid timeouts, we avoid expects with many .* patterns that match |
adf40b2e JM |
205 | # many lines. Instead, we keep track of which milestones we've seen |
206 | # in the output, and stop when we've seen all of them. | |
207 | ||
208 | set header 0 | |
209 | set psymtabs 0 | |
210 | set symtabs 0 | |
211 | set keep_looking 1 | |
212 | ||
213 | while {$keep_looking} { | |
214 | gdb_expect { | |
215 | ||
03dd63aa | 216 | -re ".*Object file.*break($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 } |
adf40b2e JM |
217 | -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 } |
218 | -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 } | |
219 | ||
220 | -re ".*$gdb_prompt $" { | |
221 | set keep_looking 0 | |
222 | } | |
223 | timeout { | |
224 | fail "(timeout) maint print objfiles" | |
225 | set keep_looking 0 | |
226 | } | |
227 | } | |
c906108c | 228 | } |
adf40b2e JM |
229 | |
230 | proc maint_pass_if {val name} { | |
231 | if $val { pass $name } else { fail $name } | |
c906108c SS |
232 | } |
233 | ||
adf40b2e JM |
234 | maint_pass_if $header "maint print objfiles: header" |
235 | maint_pass_if $psymtabs "maint print objfiles: psymtabs" | |
236 | maint_pass_if $symtabs "maint print objfiles: symtabs" | |
237 | ||
c906108c SS |
238 | send_gdb "maint print psymbols\n" |
239 | gdb_expect { | |
240 | -re "print-psymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ | |
241 | { pass "maint print psymbols w/o args" } | |
242 | -re ".*$gdb_prompt $" { fail "maint print psymbols w/o args" } | |
243 | timeout { fail "(timeout) maint print psymbols w/o args" } | |
244 | } | |
245 | ||
3bcbaac5 | 246 | send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n" |
c906108c | 247 | gdb_expect { |
3bcbaac5 | 248 | -re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $"\ |
c906108c SS |
249 | { |
250 | send_gdb "shell ls psymbols_output\n" | |
251 | gdb_expect { | |
252 | -re "psymbols_output\r\n$gdb_prompt $"\ | |
253 | { | |
254 | # We want this grep to be as specific as possible, | |
255 | # so it's less likely to match symbol file names in | |
256 | # psymbols_output. Yes, this actually happened; | |
257 | # poor expect got tons of output, and timed out | |
258 | # trying to match it. --- Jim Blandy <jimb@cygnus.com> | |
259 | send_gdb "shell grep 'main.*function' psymbols_output\n" | |
260 | gdb_expect { | |
261 | -re ".main., function, $hex.*$gdb_prompt $"\ | |
a0b3c4fd JM |
262 | { pass "maint print psymbols 1" } |
263 | -re ".*main. .., function, $hex.*$gdb_prompt $"\ | |
264 | { pass "maint print psymbols 2" } | |
c906108c SS |
265 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } |
266 | timeout { fail "(timeout) maint print psymbols" } | |
267 | } | |
268 | gdb_test "shell rm -f psymbols_output" "" | |
269 | ||
270 | } | |
271 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
272 | timeout { fail "(timeout) maint print psymbols" } | |
273 | } | |
274 | } | |
275 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
276 | timeout { fail "(timeout) maint print psymbols" } | |
277 | } | |
278 | ||
279 | ||
280 | send_gdb "maint print msymbols\n" | |
281 | gdb_expect { | |
282 | -re "print-msymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ | |
283 | { pass "maint print msymbols w/o args" } | |
284 | -re ".*$gdb_prompt $" { fail "maint print msymbols w/o args" } | |
285 | timeout { fail "(timeout) maint print msymbols w/o args" } | |
286 | } | |
287 | ||
3bcbaac5 | 288 | send_gdb "maint print msymbols msymbols_output ${binfile}\n" |
c906108c | 289 | gdb_expect { |
3bcbaac5 | 290 | -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $"\ |
c906108c SS |
291 | { |
292 | send_gdb "shell ls msymbols_output\n" | |
293 | gdb_expect { | |
294 | -re "msymbols_output\r\n$gdb_prompt $"\ | |
295 | { | |
296 | send_gdb "shell grep factorial msymbols_output\n" | |
297 | gdb_expect { | |
298 | -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $"\ | |
299 | { pass "maint print msymbols" } | |
300 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
301 | timeout { fail "(timeout) maint print msymbols" } | |
302 | } | |
303 | gdb_test "shell rm -f msymbols_output" "" | |
304 | ||
305 | } | |
306 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
307 | timeout { fail "(timeout) maint print msymbols" } | |
308 | } | |
309 | } | |
310 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
311 | timeout { fail "(timeout) maint print msymbols" } | |
312 | } | |
313 | ||
314 | ||
315 | send_gdb "maint print symbols\n" | |
316 | gdb_expect { | |
317 | -re "Arguments missing: an output file name and an optional symbol file name.*$gdb_prompt $"\ | |
318 | { pass "maint print symbols w/o args" } | |
319 | -re ".*$gdb_prompt $" { fail "maint print symbols w/o args" } | |
320 | timeout { fail "(timeout) maint print symbols w/o args" } | |
321 | } | |
322 | ||
3bcbaac5 DJ |
323 | # Request symbols for one particular source file so that we don't try to |
324 | # dump the symbol information for the entire C library - over 500MB nowadays | |
325 | # for GNU libc. | |
adf40b2e | 326 | |
3bcbaac5 | 327 | send_gdb "maint print symbols symbols_output ${srcdir}/${subdir}/${srcfile}\n" |
c906108c | 328 | gdb_expect { |
3bcbaac5 | 329 | -re "^maint print symbols symbols_output \[^\n\]*\r\n$gdb_prompt $"\ |
c906108c SS |
330 | { |
331 | send_gdb "shell ls symbols_output\n" | |
332 | gdb_expect { | |
333 | -re "symbols_output\r\n$gdb_prompt $"\ | |
334 | { | |
335 | # See comments for `maint print psymbols'. | |
adf40b2e | 336 | send_gdb "shell grep 'main(.*block' symbols_output\n" |
c906108c SS |
337 | gdb_expect { |
338 | -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $"\ | |
339 | { pass "maint print symbols" } | |
340 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
341 | timeout { fail "(timeout) maint print symbols" } | |
342 | } | |
343 | gdb_test "shell rm -f symbols_output" "" | |
344 | ||
345 | } | |
346 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
347 | timeout { fail "(timeout) maint print symbols" } | |
348 | } | |
349 | } | |
350 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
351 | timeout { fail "(timeout) maint print symbols" } | |
352 | } | |
353 | ||
c906108c SS |
354 | send_gdb "maint print type argc\n" |
355 | gdb_expect { | |
2fdde8f8 | 356 | -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\ |
c906108c SS |
357 | { pass "maint print type" } |
358 | -re ".*$gdb_prompt $" { fail "maint print type" } | |
359 | timeout { fail "(timeout) maint print type" } | |
360 | } | |
361 | ||
a0b3c4fd JM |
362 | if [istarget "hppa*-*-11*"] { |
363 | setup_xfail hppa*-*-*11* CLLbs14860 | |
364 | send "maint print unwind &main\n" | |
365 | expect { | |
366 | -re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+\[0-9\]*>\r\n\tflags = Args_stored Save_RP\r\n\tRegion_description = $hex\r\n\tEntry_FR = $hex\r\n\tEntry_GR = $hex\r\n\tTotal_frame_size = $hex\r\n$gdb_prompt $"\ | |
367 | { pass "maint print unwind" } | |
368 | -re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+\[0-9\]*>\r\n\tflags = Args_stored Save_RP\r\n\tFLD = $hex\r\n\tFLD = $hex\r\n\tFLD = $hex\r\n\tFLD = $hex\r\n$gdb_prompt $"\ | |
369 | { xfail "maint print unwind" } | |
370 | -re ".*$gdb_prompt $" { xfail "maint info unwind" } | |
371 | timeout { fail "(timeout) maint print unwind" } | |
372 | } | |
373 | } | |
c906108c SS |
374 | |
375 | set oldtimeout $timeout | |
376 | set timeout [expr $timeout + 300] | |
377 | ||
378 | # It'd be nice to check for every possible section. However, that's | |
379 | # problematic, since the relative ordering wanders from release to | |
380 | # release of the compilers. Instead, we'll just check for two | |
381 | # sections which appear to always come out in the same relative | |
382 | # order. (If that changes, then we should just check for one | |
383 | # section.) | |
384 | # | |
385 | # And by the way: This testpoint will break for PA64, where a.out's | |
386 | # are ELF files. | |
387 | # | |
388 | send_gdb "maint info sections\n" | |
389 | gdb_expect { | |
03dd63aa | 390 | -re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $"\ |
c906108c SS |
391 | { pass "maint info sections" } |
392 | -re ".*$gdb_prompt $" { fail "maint info sections" } | |
393 | timeout { fail "(timeout) maint info sections" } | |
394 | } | |
395 | ||
8ddad156 MS |
396 | # Test for new option: maint info sections <section name> |
397 | # If you don't have a .text section, this will require tweaking. | |
398 | send_gdb "maint info sections .text\n" | |
399 | gdb_expect { | |
400 | -re ".*bss.*$gdb_prompt $" { fail "maint info sections .text" } | |
401 | -re ".*data.*$gdb_prompt $" { fail "maint info sections .text" } | |
402 | -re ".* .text .*$gdb_prompt $" { pass "maint info sections .text" } | |
0ab84fb7 | 403 | -re ".*$gdb_prompt $" { fail "maint info sections .text" } |
8ddad156 MS |
404 | timeout { fail "(timeout) maint info sections .text" } |
405 | } | |
406 | ||
407 | # Test for new option: CODE section flag | |
408 | # If your data section is tagged CODE, xfail this test. | |
409 | send_gdb "maint info sections CODE\n" | |
410 | gdb_expect { | |
411 | -re ".* .data .*$gdb_prompt $" { fail "maint info sections CODE" } | |
412 | -re ".* .text .*$gdb_prompt $" { pass "maint info sections CODE" } | |
0ab84fb7 | 413 | -re ".*$gdb_prompt $" { fail "maint info sections CODE" } |
8ddad156 MS |
414 | timeout { fail "(timeout) maint info sections CODE" } |
415 | } | |
416 | ||
417 | # Test for new option: DATA section flag | |
418 | # If your text section is tagged DATA, xfail this test. | |
419 | send_gdb "maint info sections DATA\n" | |
420 | gdb_expect { | |
421 | -re ".* .text .*$gdb_prompt $" { fail "maint info sections DATA" } | |
422 | -re ".* .data .*$gdb_prompt $" { pass "maint info sections DATA" } | |
0ab84fb7 | 423 | -re ".*$gdb_prompt $" { fail "maint info sections DATA" } |
8ddad156 MS |
424 | timeout { fail "(timeout) maint info sections DATA" } |
425 | } | |
426 | ||
a1dea79a FF |
427 | set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] |
428 | ||
c906108c SS |
429 | send_gdb "maint info breakpoints\n" |
430 | gdb_expect { | |
a1dea79a | 431 | -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ |
aaf320fa | 432 | { pass "maint info breakpoints" } |
a1dea79a | 433 | -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex in main at.*break.c:$bp_location6\r\n\[ \t\]+breakpoint already hit 1 time\r\n-1\[ \t\]+shlib events\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex.*breakpoint already hit.*$gdb_prompt $"\ |
aaf320fa FF |
434 | { pass "maint info breakpoints (with shlib events)" } |
435 | -re ".*$gdb_prompt $" { fail "maint info breakpoints" } | |
436 | timeout { fail "(timeout) maint info breakpoints" } | |
c906108c SS |
437 | } |
438 | ||
c906108c SS |
439 | send_gdb "maint print\n" |
440 | gdb_expect { | |
441 | -re "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ | |
442 | { pass "maint print w/o args" } | |
443 | -re ".*$gdb_prompt $" { fail "maint print w/o args" } | |
444 | timeout { fail "(timeout) maint print w/o args" } | |
445 | } | |
446 | ||
447 | send_gdb "maint info\n" | |
448 | gdb_expect { | |
449 | -re "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ | |
450 | { pass "maint info w/o args" } | |
451 | -re ".*$gdb_prompt $" { fail "maint info w/o args" } | |
452 | timeout { fail "(timeout) maint info w/o args" } | |
453 | } | |
454 | ||
455 | send_gdb "maint\n" | |
456 | gdb_expect { | |
457 | -re "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ | |
458 | { pass "maint w/o args" } | |
459 | -re ".*$gdb_prompt $" { fail "maint w/o args" } | |
460 | timeout { fail "(timeout) maint w/o args" } | |
461 | } | |
462 | ||
463 | ||
464 | set timeout $oldtimeout | |
465 | ||
466 | #============test help on maint commands | |
467 | ||
468 | send_gdb "help maint\n" | |
469 | gdb_expect { | |
c60b7188 | 470 | -re "Commands for use by GDB maintainers\\..*Includes commands to dump specific internal GDB structures in.*a human readable form, to cause GDB to deliberately dump core,.*to test internal functions such as the C../ObjC demangler, etc\\..*List of maintenance subcommands:.*maintenance check-symtabs.*maintenance demangle.*(maintenance dump-me.*)?maintenance info.*maintenance internal-error.*maintenance print.*maintenance set.*maintenance show.*maintenance space.*maintenance time.*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\..*Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ |
c906108c SS |
471 | { pass "help maint" } |
472 | -re ".*$gdb_prompt $" { fail "help maint" } | |
473 | timeout { fail "(timeout) help maint" } | |
474 | } | |
475 | ||
476 | ||
477 | send_gdb "help maint check-symtabs\n" | |
478 | gdb_expect { | |
479 | -re "Check consistency of psymtabs and symtabs\\..*$gdb_prompt $"\ | |
480 | { pass "help maint check-symtabs" } | |
481 | -re ".*$gdb_prompt $" { fail "help maint check-symtabs" } | |
482 | timeout { fail "(timeout) help maint check-symtabs" } | |
483 | } | |
484 | ||
485 | send_gdb "help maint space\n" | |
486 | gdb_expect { | |
487 | -re "Set the display of space usage\\.\r\nIf nonzero, will cause the execution space for each command to be\r\ndisplayed, following the command's output\\..*$gdb_prompt $"\ | |
488 | { pass "help maint space" } | |
489 | -re ".*$gdb_prompt $" { fail "help maint space" } | |
490 | timeout { fail "(timeout) help maint space" } | |
491 | } | |
492 | ||
493 | send_gdb "help maint time\n" | |
494 | gdb_expect { | |
495 | -re "Set the display of time usage\\.\r\nIf nonzero, will cause the execution time for each command to be\r\ndisplayed, following the command's output\\..*$gdb_prompt $"\ | |
496 | { pass "help maint time" } | |
497 | -re ".*$gdb_prompt $" { fail "help maint time" } | |
498 | timeout { fail "(timeout) help maint time" } | |
499 | } | |
500 | ||
501 | send_gdb "help maint demangle\n" | |
502 | gdb_expect { | |
c60b7188 | 503 | -re "Demangle a C\\+\\+/ObjC mangled name\\.\r\nCall internal GDB demangler routine to demangle a C\\+\\+ link name\r\nand prints the result\\..*$gdb_prompt $"\ |
c906108c SS |
504 | { pass "help maint demangle" } |
505 | -re ".*$gdb_prompt $" { fail "help maint demangle" } | |
506 | timeout { fail "(timeout) help maint demangle" } | |
507 | } | |
508 | ||
93076499 ND |
509 | # dump-me is disabled ifdef _WIN32. |
510 | if [ishost *cygwin*] { | |
511 | setup_xfail "*-*-*" | |
512 | } | |
c906108c SS |
513 | send_gdb "help maint dump-me\n" |
514 | gdb_expect { | |
9e297a97 | 515 | -re "Get fatal error; make debugger dump its core\\.\r\nGDB sets its handling of SIGQUIT back to SIG_DFL and then sends\r\nitself a SIGQUIT signal\\..*$gdb_prompt $"\ |
c906108c SS |
516 | { pass "help maint dump-me" } |
517 | -re ".*$gdb_prompt $" { fail "help maint dump-me" } | |
518 | timeout { fail "(timeout) help maint dump-me" } | |
519 | } | |
520 | ||
7be570e7 JM |
521 | send_gdb "help maint internal-error\n" |
522 | gdb_expect { | |
523 | -re "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*$gdb_prompt $"\ | |
524 | { pass "help maint internal-error" } | |
525 | -re ".*$gdb_prompt $" { fail "help maint internal-error" } | |
526 | timeout { fail "(timeout) help maint internal-error" } | |
527 | } | |
528 | ||
dec43320 AC |
529 | send_gdb "help maint internal-warning\n" |
530 | gdb_expect { | |
531 | -re "Give GDB an internal warning\\.\r\nCause GDB to behave as if an internal warning was reported\\..*$gdb_prompt $"\ | |
532 | { pass "help maint internal-warning" } | |
533 | -re ".*$gdb_prompt $" { fail "help maint internal-warning" } | |
534 | timeout { fail "(timeout) help maint internal-warning" } | |
535 | } | |
536 | ||
c906108c SS |
537 | send_gdb "help maint print statistics\n" |
538 | gdb_expect { | |
539 | -re "Print statistics about internal gdb state\\..*$gdb_prompt $"\ | |
540 | { pass "help maint print statistics" } | |
541 | -re ".*$gdb_prompt $" { fail "help maint print statistics" } | |
542 | timeout { fail "(timeout) help maint print statistics" } | |
543 | } | |
544 | ||
00905d52 AC |
545 | gdb_test "help maint print dummy-frames" \ |
546 | "Print the contents of the internal dummy-frame stack." | |
547 | ||
c906108c SS |
548 | send_gdb "help maint print objfiles\n" |
549 | gdb_expect { | |
550 | -re "Print dump of current object file definitions\\..*$gdb_prompt $"\ | |
551 | { pass "help maint print objfiles" } | |
552 | -re ".*$gdb_prompt $" { fail "help maint print objfiles" } | |
553 | timeout { fail "(timeout) help maint print objfiles" } | |
554 | } | |
555 | ||
556 | send_gdb "help maint print psymbols\n" | |
557 | gdb_expect { | |
558 | -re "Print dump of current partial symbol definitions\\.\r\nEntries in the partial symbol table are dumped to file OUTFILE\\.\r\nIf a SOURCE file is specified, dump only that file's partial symbols\\..*$gdb_prompt $"\ | |
559 | { pass "help maint print psymbols" } | |
560 | -re ".*$gdb_prompt $" { fail "help maint print psymbols" } | |
561 | timeout { fail "(timeout) help maint print psymbols" } | |
562 | } | |
563 | ||
564 | send_gdb "help maint print msymbols\n" | |
565 | gdb_expect { | |
566 | -re "Print dump of current minimal symbol definitions\\.\r\nEntries in the minimal symbol table are dumped to file OUTFILE\\.\r\nIf a SOURCE file is specified, dump only that file's minimal symbols\\..*$gdb_prompt $"\ | |
567 | { pass "help maint print msymbols" } | |
568 | -re ".*$gdb_prompt $" { fail "help maint print msymbols" } | |
569 | timeout { fail "(timeout) help maint print msymbols" } | |
570 | } | |
571 | ||
572 | send_gdb "help maint print symbols\n" | |
573 | gdb_expect { | |
574 | -re "Print dump of current symbol definitions\\.\r\nEntries in the full symbol table are dumped to file OUTFILE\\.\r\nIf a SOURCE file is specified, dump only that file's symbols\\..*$gdb_prompt $"\ | |
575 | { pass "help maint print symbols" } | |
576 | -re ".*$gdb_prompt $" { fail "help maint print symbols" } | |
577 | timeout { fail "(timeout) help maint print symbols" } | |
578 | } | |
579 | ||
580 | ||
581 | send_gdb "help maint print type\n" | |
582 | gdb_expect { | |
583 | -re "Print a type chain for a given symbol\\.\r\nFor each node in a type chain, print the raw data for each member of\r\nthe type structure, and the interpretation of the data\\..*$gdb_prompt $"\ | |
584 | { pass "help maint print type" } | |
585 | -re ".*$gdb_prompt $" { fail "help maint print type" } | |
586 | timeout { fail "(timeout) help maint print type" } | |
587 | } | |
588 | ||
a0b3c4fd JM |
589 | if [istarget "hppa*-*-*"] { |
590 | send_gdb "help maint print unwind\n" | |
591 | gdb_expect { | |
592 | -re "Print unwind table entry at given address\\..*$gdb_prompt $"\ | |
593 | { pass "help maint print unwind" } | |
594 | -re ".*$gdb_prompt $" { fail "help maint print unwind" } | |
595 | timeout { fail "(timeout) help maint print unwind" } | |
596 | } | |
597 | } | |
c906108c SS |
598 | |
599 | send_gdb "help maint info sections\n" | |
600 | gdb_expect { | |
601 | -re "List the BFD sections of the exec and core files\\..*$gdb_prompt $"\ | |
602 | { pass "help maint info sections" } | |
603 | -re ".*$gdb_prompt $" { fail "help maint info sections" } | |
604 | timeout { fail "(timeout) help maint info sections" } | |
605 | } | |
606 | ||
607 | ||
608 | send_gdb "help maint info breakpoints\n" | |
609 | gdb_expect { | |
610 | -re "Status of all breakpoints, or breakpoint number NUMBER.*$gdb_prompt $" { pass "help maint info breakpoints" } | |
611 | -re ".*$gdb_prompt $" { fail "help maint info breakpoints" } | |
612 | timeout { fail "(timeout) help maint info breakpoints" } | |
613 | } | |
614 | ||
615 | #send_gdb "help maint info breakpoints\n" | |
616 | #expect { | |
617 | # -re "Status of all breakpoints, or breakpoint number NUMBER\\.\[ \r\n\t\]+The \"Type\" column indicates one of:\[ \r\n\t\]+breakpoint\[ \t\]+- normal breakpoint\[ \r\n\t\]+watchpoint\[ \t\]+- watchpoint\[ \r\n\t\]+longjmp\[ \t\]+- internal breakpoint used to step through longjmp\\(\\)\[ \r\n\t\]+longjmp resume - internal breakpoint at the target of longjmp\\(\\)\[ \r\n\t\]+until\[ \t\]+- internal breakpoint used by the \"until\" command\[ \r\n\t\]+finish\[ \t\]+- internal breakpoint used by the \"finish\" command\[ \r\n\t\]+The \"Disp\" column contains one of \"keep\", \"del\", or \"dis\" to indicate\[ \r\n\t\]+the disposition of the breakpoint after it gets hit\\. \"dis\" means that the\[ \r\n\t\]+breakpoint will be disabled\\. The \"Address\" and \"What\" columns indicate the\[ \r\n\t\]+address and file.line number respectively\\.\[ \r\n\t\]+Convenience variable \".*\" and default examine address for \"x\"\[ \r\n\t\]+are set to the address of the last breakpoint listed\\.\[ \r\n\t\]+Convenience variable \".bpnum\" contains the number of the last\[ \r\n\t\]+breakpoint set\\..*$gdb_prompt $"\ | |
618 | # { pass "help maint info breakpoints" } | |
619 | # -re ".*$gdb_prompt $" { fail "help maint info breakpoints" } | |
620 | # timeout { fail "(timeout) help maint info breakpoints" } | |
621 | # } | |
622 | ||
623 | send_gdb "help maint info\n" | |
624 | gdb_expect { | |
625 | -re "Commands for showing internal info about the program being debugged.*unambiguous\\..*$gdb_prompt $"\ | |
626 | { pass "help maint info" } | |
627 | -re ".*$gdb_prompt $" { fail "help maint info" } | |
628 | timeout { fail "(timeout) help maint info" } | |
629 | } | |
630 | ||
631 | send_gdb "help maint print\n" | |
632 | gdb_expect { | |
3e6c8688 | 633 | -re "Maintenance command for printing GDB internal state\\.\[\r\n\]+List of maintenance print subcommands:\[\r\n\]+maintenance print architecture -- Print the internal architecture configuration.*maintenance print msymbols -- Print dump of current minimal symbol definitions.*maintenance print objfiles -- Print dump of current object file definitions.*maintenance print psymbols -- Print dump of current partial symbol definitions.*maintenance print statistics -- Print statistics about internal gdb state.*maintenance print symbols -- Print dump of current symbol definitions.*maintenance print type -- Print a type chain for a given symbol.*Type .help maintenance print. followed by maintenance print subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ |
c906108c SS |
634 | { pass "help maint print" } |
635 | -re ".*$gdb_prompt $" { fail "help maint print" } | |
636 | timeout { fail "(timeout) help maint print" } | |
637 | } | |
638 | ||
639 | send_gdb "help maint\n" | |
640 | gdb_expect { | |
c60b7188 | 641 | -re "Commands for use by GDB maintainers\\.\[\r\n\]+Includes commands to dump specific internal GDB structures in\[\r\n\]+a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+to test internal functions such as the C\\+\\+/ObjC demangler, etc\\..*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ |
c906108c SS |
642 | { pass "help maint" } |
643 | -re ".*$gdb_prompt $" { fail "help maint" } | |
644 | timeout { fail "(timeout) help maint" } | |
645 | } | |
646 | ||
647 | #set oldtimeout $timeout | |
648 | #set timeout [expr $timeout + 300] | |
649 | ||
93076499 ND |
650 | if [ishost *cygwin*] { |
651 | setup_xfail "*-*-*" | |
652 | } | |
c906108c SS |
653 | send_gdb "maint dump-me\n" |
654 | gdb_expect { | |
655 | -re "Should GDB dump core.*\\(y or n\\) $"\ | |
656 | { send_gdb "n\n" | |
657 | gdb_expect { | |
658 | -re ".*$gdb_prompt $" { pass "maint dump-me" } | |
659 | timeout { fail "(timeout) maint dump-me" } | |
660 | } | |
661 | } | |
662 | -re ".*$gdb_prompt $" { fail "maint dump-me" } | |
663 | timeout { fail "(timeout) maint dump-me" } | |
664 | } | |
665 | ||
7be570e7 | 666 | send_gdb "maint internal-error\n" |
039cf96d AC |
667 | gdb_expect { |
668 | -re "A problem internal to GDB has been detected" { | |
669 | pass "maint internal-error" | |
670 | if [gdb_internal_error_resync] { | |
671 | pass "internal-error resync" | |
672 | } else { | |
673 | fail "internal-error resync" | |
7be570e7 JM |
674 | } |
675 | } | |
676 | -re ".*$gdb_prompt $" { | |
677 | fail "maint internal-error" | |
039cf96d | 678 | untested "internal-error resync" |
7be570e7 JM |
679 | } |
680 | timeout { | |
039cf96d AC |
681 | fail "maint internal-error (timeout)" |
682 | untested "internal-error resync" | |
7be570e7 JM |
683 | } |
684 | } | |
685 | ||
c906108c SS |
686 | #set timeout $oldtimeout |
687 | ||
688 | ||
689 | gdb_exit | |
690 | return 0 |