Updated copyright notices for most files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / maint.exp
CommitLineData
9b254dd1 1# Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008
6aba47ca 2# Free Software Foundation, Inc.
c906108c
SS
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
e22f8b7c 6# the Free Software Foundation; either version 3 of the License, or
c906108c 7# (at your option) any later version.
e22f8b7c 8#
c906108c
SS
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
e22f8b7c 13#
c906108c 14# You should have received a copy of the GNU General Public License
e22f8b7c 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
c906108c
SS
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
54if $tracelevel then {
55 strace $tracelevel
56 }
57
58global usestubs
59
60#
61# test running programs
62#
63set prms_id 0
64set bug_id 0
65
66set testfile "break"
67set srcfile ${testfile}.c
a1dea79a 68set srcfile1 ${testfile}1.c
c906108c 69set binfile ${objdir}/${subdir}/${testfile}
a1dea79a 70
fc91c6c2 71if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
b60f0898
JB
72 untested maint.exp
73 return -1
a1dea79a
FF
74}
75
fc91c6c2 76if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
b60f0898
JB
77 untested maint.exp
78 return -1
a1dea79a
FF
79}
80
fc91c6c2 81if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
b60f0898
JB
82 untested maint.exp
83 return -1
c906108c
SS
84}
85
86
87gdb_exit
88gdb_start
89gdb_reinitialize_dir $srcdir/$subdir
90gdb_load ${binfile}
91
92if ![runto_main] then {
93 perror "tests suppressed"
94}
95
96
97# The commands we test here produce many lines of output; disable "press
98# <return> to continue" prompts.
99send_gdb "set height 0\n"
100gdb_expect -re "$gdb_prompt $"
101
102# use a larger expect input buffer for long help outputs.
103match_max 6000
104
105#
106# this command does not produce any output
107# unless there is some problem with the symtabs and psymtabs
108# so that branch will really never be covered in this tests here!!
109#
110
a0b3c4fd
JM
111# guo: on linux this command output is huge. for some reason splitting up
112# the regexp checks works.
113#
c906108c
SS
114send_gdb "maint check-symtabs\n"
115gdb_expect {
a0b3c4fd
JM
116 -re "^maint check-symtabs" {
117 gdb_expect {
118 -re "$gdb_prompt $" \
c906108c 119 { pass "maint check-symtabs" }
a0b3c4fd
JM
120 timeout { fail "(timeout) maint check-symtabs" }
121 }
122 }
c906108c
SS
123 -re ".*$gdb_prompt $" { fail "maint check-symtabs" }
124 timeout { fail "(timeout) maint check-symtabs" }
125 }
126
127send_gdb "maint space\n"
128gdb_expect {
129 -re "\"maintenance space\" takes a numeric argument\\..*$gdb_prompt $"\
130 { pass "maint space" }
131 -re ".*$gdb_prompt $" { fail "maint space" }
132 timeout { fail "(timeout) maint space" }
133 }
134
135send_gdb "maint space 1\n"
136gdb_expect {
137 -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
138 { pass "maint space 1" }
139 -re ".*$gdb_prompt $" { fail "maint space 1" }
140 timeout { fail "(timeout) maint space 1" }
141 }
142
143
144send_gdb "maint time\n"
145gdb_expect {
146 -re "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
147 { pass "maint time" }
148 -re ".*$gdb_prompt $" { fail "maint time" }
149 timeout { fail "(timeout) maint time" }
150 }
151
152send_gdb "maint time 1\n"
153gdb_expect {
154 -re "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
155 { pass "maint time 1" }
156 -re ".*$gdb_prompt $" { fail "maint time 1" }
157 timeout { fail "(timeout) maint time 1" }
158 }
159
160send_gdb "maint time 0\n"
161gdb_expect {
162 -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
163 { pass "maint time 0" }
164 -re ".*$gdb_prompt $" { fail "maint time 0" }
165 timeout { fail "(timeout) maint time 0" }
166 }
167
168
169send_gdb "maint space 0\n"
170gdb_expect {
171 -re "maint space 0\r\n$gdb_prompt $"\
172 { pass "maint space 0" }
173 -re ".*$gdb_prompt $" { fail "maint space 0" }
174 timeout { fail "(timeout) maint space 0" }
175 }
176
177send_gdb "maint demangle\n"
178gdb_expect {
179 -re "\"maintenance demangle\" takes an argument to demangle\\..*$gdb_prompt $"\
180 { pass "maint demangle" }
181 -re ".*$gdb_prompt $" { fail "maint demangle" }
182 timeout { fail "(timeout) maint demangle" }
183 }
184
185send_gdb "maint demangle main\n"
186gdb_expect {
187 -re "Can't demangle \"main\".*$gdb_prompt $"\
188 { pass "maint demangle" }
189 -re ".*$gdb_prompt $" { fail "maint demangle" }
190 timeout { fail "(timeout) maint demangle" }
191 }
192
dbdfa66c
CV
193# The timeout value is raised, because printing all the symbols and
194# statistical information about Cygwin and Windows libraries takes a lot
195# of time.
196if [istarget "*-*-cygwin*"] {
197 set oldtimeout $timeout
198 set timeout [expr $timeout + 500]
199}
c906108c
SS
200
201send_gdb "maint print statistics\n"
202gdb_expect {
c4f90d87 203 -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 $"\
30fc0091
EZ
204 {
205 # Old output for gdb 6.0 and earlier
206 pass "maint print statistics"
207 }
208 -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 objfile obstack.*Total memory used for psymbol cache.*Total memory used for macro cache.*$gdb_prompt $"\
c906108c
SS
209 { pass "maint print statistics" }
210 -re ".*$gdb_prompt $" { fail "maint print statistics" }
211 timeout { fail "(timeout) maint print statistics" }
212 }
213
00905d52
AC
214# There aren't any ...
215gdb_test "maint print dummy-frames" ""
216
c906108c 217send_gdb "maint print objfiles\n"
adf40b2e 218
c906108c 219# To avoid timeouts, we avoid expects with many .* patterns that match
adf40b2e
JM
220# many lines. Instead, we keep track of which milestones we've seen
221# in the output, and stop when we've seen all of them.
222
223set header 0
224set psymtabs 0
225set symtabs 0
226set keep_looking 1
227
228while {$keep_looking} {
229 gdb_expect {
230
03dd63aa 231 -re ".*Object file.*break($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 }
adf40b2e
JM
232 -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 }
233 -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 }
234
235 -re ".*$gdb_prompt $" {
236 set keep_looking 0
237 }
238 timeout {
239 fail "(timeout) maint print objfiles"
240 set keep_looking 0
241 }
242 }
c906108c 243}
adf40b2e
JM
244
245proc maint_pass_if {val name} {
246 if $val { pass $name } else { fail $name }
c906108c
SS
247}
248
adf40b2e
JM
249maint_pass_if $header "maint print objfiles: header"
250maint_pass_if $psymtabs "maint print objfiles: psymtabs"
251maint_pass_if $symtabs "maint print objfiles: symtabs"
252
c906108c
SS
253send_gdb "maint print psymbols\n"
254gdb_expect {
255 -re "print-psymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\
256 { pass "maint print psymbols w/o args" }
257 -re ".*$gdb_prompt $" { fail "maint print psymbols w/o args" }
258 timeout { fail "(timeout) maint print psymbols w/o args" }
259 }
260
3bcbaac5 261send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n"
c906108c 262gdb_expect {
3bcbaac5 263 -re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $"\
c906108c
SS
264 {
265 send_gdb "shell ls psymbols_output\n"
266 gdb_expect {
267 -re "psymbols_output\r\n$gdb_prompt $"\
268 {
269 # We want this grep to be as specific as possible,
270 # so it's less likely to match symbol file names in
271 # psymbols_output. Yes, this actually happened;
272 # poor expect got tons of output, and timed out
273 # trying to match it. --- Jim Blandy <jimb@cygnus.com>
274 send_gdb "shell grep 'main.*function' psymbols_output\n"
275 gdb_expect {
276 -re ".main., function, $hex.*$gdb_prompt $"\
a0b3c4fd
JM
277 { pass "maint print psymbols 1" }
278 -re ".*main. .., function, $hex.*$gdb_prompt $"\
279 { pass "maint print psymbols 2" }
c906108c
SS
280 -re ".*$gdb_prompt $" { fail "maint print psymbols" }
281 timeout { fail "(timeout) maint print psymbols" }
282 }
283 gdb_test "shell rm -f psymbols_output" ""
284
285 }
286 -re ".*$gdb_prompt $" { fail "maint print psymbols" }
287 timeout { fail "(timeout) maint print psymbols" }
288 }
289 }
290 -re ".*$gdb_prompt $" { fail "maint print psymbols" }
291 timeout { fail "(timeout) maint print psymbols" }
292 }
293
294
295send_gdb "maint print msymbols\n"
296gdb_expect {
297 -re "print-msymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\
298 { pass "maint print msymbols w/o args" }
299 -re ".*$gdb_prompt $" { fail "maint print msymbols w/o args" }
300 timeout { fail "(timeout) maint print msymbols w/o args" }
301 }
302
3bcbaac5 303send_gdb "maint print msymbols msymbols_output ${binfile}\n"
c906108c 304gdb_expect {
3bcbaac5 305 -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $"\
c906108c
SS
306 {
307 send_gdb "shell ls msymbols_output\n"
308 gdb_expect {
309 -re "msymbols_output\r\n$gdb_prompt $"\
310 {
311 send_gdb "shell grep factorial msymbols_output\n"
312 gdb_expect {
313 -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $"\
314 { pass "maint print msymbols" }
315 -re ".*$gdb_prompt $" { fail "maint print msymbols" }
316 timeout { fail "(timeout) maint print msymbols" }
317 }
318 gdb_test "shell rm -f msymbols_output" ""
319
320 }
321 -re ".*$gdb_prompt $" { fail "maint print msymbols" }
322 timeout { fail "(timeout) maint print msymbols" }
323 }
324 }
325 -re ".*$gdb_prompt $" { fail "maint print msymbols" }
326 timeout { fail "(timeout) maint print msymbols" }
327 }
328
dbdfa66c
CV
329# Check that maint print msymbols allows relative pathnames
330set mydir [pwd]
c499ed39 331gdb_test "cd ${objdir}" "Working directory [string_to_regexp ${objdir}]\..*" "cd to objdir"
dbdfa66c
CV
332gdb_test_multiple "maint print msymbols msymbols_output2 ${subdir}/${testfile}" "maint print msymbols" {
333 -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" {
334 gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" {
335 -re "msymbols_output2\r\n$gdb_prompt $" {
336 gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" {
337 -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $" {
338 pass "maint print msymbols"
339 }
340 -re ".*$gdb_prompt $" {
341 fail "maint print msymbols"
342 }
343 timeout {
344 fail "(timeout) maint print msymbols"
345 }
346 }
347 gdb_test "shell rm -f msymbols_output2" ""
348 }
349 -re ".*$gdb_prompt $" {
350 fail "maint print msymbols"
351 }
352 timeout {
353 fail "(timeout) maint print msymbols"
354 }
355 }
356 }
357 -re ".*$gdb_prompt $" {
358 fail "maint print msymbols"
359 }
360 timeout {
361 fail "(timeout) maint print msymbols"
362 }
363}
c499ed39 364gdb_test "cd ${mydir}" "Working directory [string_to_regexp ${mydir}]\..*" "cd to mydir"
c906108c
SS
365
366send_gdb "maint print symbols\n"
367gdb_expect {
368 -re "Arguments missing: an output file name and an optional symbol file name.*$gdb_prompt $"\
369 { pass "maint print symbols w/o args" }
370 -re ".*$gdb_prompt $" { fail "maint print symbols w/o args" }
371 timeout { fail "(timeout) maint print symbols w/o args" }
372 }
373
3bcbaac5
DJ
374# Request symbols for one particular source file so that we don't try to
375# dump the symbol information for the entire C library - over 500MB nowadays
376# for GNU libc.
adf40b2e 377
3bcbaac5 378send_gdb "maint print symbols symbols_output ${srcdir}/${subdir}/${srcfile}\n"
c906108c 379gdb_expect {
3bcbaac5 380 -re "^maint print symbols symbols_output \[^\n\]*\r\n$gdb_prompt $"\
c906108c
SS
381 {
382 send_gdb "shell ls symbols_output\n"
383 gdb_expect {
384 -re "symbols_output\r\n$gdb_prompt $"\
385 {
386 # See comments for `maint print psymbols'.
adf40b2e 387 send_gdb "shell grep 'main(.*block' symbols_output\n"
c906108c
SS
388 gdb_expect {
389 -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $"\
390 { pass "maint print symbols" }
391 -re ".*$gdb_prompt $" { fail "maint print symbols" }
392 timeout { fail "(timeout) maint print symbols" }
393 }
394 gdb_test "shell rm -f symbols_output" ""
395
396 }
397 -re ".*$gdb_prompt $" { fail "maint print symbols" }
398 timeout { fail "(timeout) maint print symbols" }
399 }
400 }
401 -re ".*$gdb_prompt $" { fail "maint print symbols" }
402 timeout { fail "(timeout) maint print symbols" }
403 }
404
c906108c
SS
405send_gdb "maint print type argc\n"
406gdb_expect {
2fdde8f8 407 -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
408 { pass "maint print type" }
409 -re ".*$gdb_prompt $" { fail "maint print type" }
410 timeout { fail "(timeout) maint print type" }
411 }
412
a0b3c4fd
JM
413if [istarget "hppa*-*-11*"] {
414 setup_xfail hppa*-*-*11* CLLbs14860
415 send "maint print unwind &main\n"
416 expect {
417 -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 $"\
418 { pass "maint print unwind" }
419 -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 $"\
420 { xfail "maint print unwind" }
421 -re ".*$gdb_prompt $" { xfail "maint info unwind" }
422 timeout { fail "(timeout) maint print unwind" }
423 }
424}
c906108c
SS
425
426set oldtimeout $timeout
427set timeout [expr $timeout + 300]
428
429# It'd be nice to check for every possible section. However, that's
430# problematic, since the relative ordering wanders from release to
431# release of the compilers. Instead, we'll just check for two
432# sections which appear to always come out in the same relative
433# order. (If that changes, then we should just check for one
434# section.)
435#
436# And by the way: This testpoint will break for PA64, where a.out's
437# are ELF files.
438#
439send_gdb "maint info sections\n"
440gdb_expect {
03dd63aa 441 -re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $"\
c906108c
SS
442 { pass "maint info sections" }
443 -re ".*$gdb_prompt $" { fail "maint info sections" }
444 timeout { fail "(timeout) maint info sections" }
445 }
446
8ddad156
MS
447# Test for new option: maint info sections <section name>
448# If you don't have a .text section, this will require tweaking.
449send_gdb "maint info sections .text\n"
450gdb_expect {
451 -re ".*bss.*$gdb_prompt $" { fail "maint info sections .text" }
452 -re ".*data.*$gdb_prompt $" { fail "maint info sections .text" }
453 -re ".* .text .*$gdb_prompt $" { pass "maint info sections .text" }
0ab84fb7 454 -re ".*$gdb_prompt $" { fail "maint info sections .text" }
8ddad156
MS
455 timeout { fail "(timeout) maint info sections .text" }
456}
457
458# Test for new option: CODE section flag
459# If your data section is tagged CODE, xfail this test.
460send_gdb "maint info sections CODE\n"
461gdb_expect {
462 -re ".* .data .*$gdb_prompt $" { fail "maint info sections CODE" }
463 -re ".* .text .*$gdb_prompt $" { pass "maint info sections CODE" }
0ab84fb7 464 -re ".*$gdb_prompt $" { fail "maint info sections CODE" }
8ddad156
MS
465 timeout { fail "(timeout) maint info sections CODE" }
466}
467
468# Test for new option: DATA section flag
469# If your text section is tagged DATA, xfail this test.
dbdfa66c
CV
470#
471# The "maint info sections DATA" test is marked for XFAIL on Cygwin,
472# because Windows has text sections marked DATA.
473setup_xfail "*-*-*cygwin*"
8ddad156
MS
474send_gdb "maint info sections DATA\n"
475gdb_expect {
476 -re ".* .text .*$gdb_prompt $" { fail "maint info sections DATA" }
477 -re ".* .data .*$gdb_prompt $" { pass "maint info sections DATA" }
0ab84fb7 478 -re ".*$gdb_prompt $" { fail "maint info sections DATA" }
8ddad156
MS
479 timeout { fail "(timeout) maint info sections DATA" }
480}
481
a1dea79a
FF
482set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
483
c906108c
SS
484send_gdb "maint info breakpoints\n"
485gdb_expect {
a1dea79a 486 -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 487 { pass "maint info breakpoints" }
a1dea79a 488 -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
489 { pass "maint info breakpoints (with shlib events)" }
490 -re ".*$gdb_prompt $" { fail "maint info breakpoints" }
491 timeout { fail "(timeout) maint info breakpoints" }
c906108c
SS
492}
493
c906108c
SS
494send_gdb "maint print\n"
495gdb_expect {
496 -re "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\
497 { pass "maint print w/o args" }
498 -re ".*$gdb_prompt $" { fail "maint print w/o args" }
499 timeout { fail "(timeout) maint print w/o args" }
500 }
501
502send_gdb "maint info\n"
503gdb_expect {
504 -re "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\
505 { pass "maint info w/o args" }
506 -re ".*$gdb_prompt $" { fail "maint info w/o args" }
507 timeout { fail "(timeout) maint info w/o args" }
508 }
509
510send_gdb "maint\n"
511gdb_expect {
512 -re "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\
513 { pass "maint w/o args" }
514 -re ".*$gdb_prompt $" { fail "maint w/o args" }
515 timeout { fail "(timeout) maint w/o args" }
516 }
517
518
519set timeout $oldtimeout
520
521#============test help on maint commands
522
523send_gdb "help maint\n"
524gdb_expect {
c60b7188 525 -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
526 { pass "help maint" }
527 -re ".*$gdb_prompt $" { fail "help maint" }
528 timeout { fail "(timeout) help maint" }
529 }
530
531
532send_gdb "help maint check-symtabs\n"
533gdb_expect {
534 -re "Check consistency of psymtabs and symtabs\\..*$gdb_prompt $"\
535 { pass "help maint check-symtabs" }
536 -re ".*$gdb_prompt $" { fail "help maint check-symtabs" }
537 timeout { fail "(timeout) help maint check-symtabs" }
538 }
539
540send_gdb "help maint space\n"
541gdb_expect {
542 -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 $"\
543 { pass "help maint space" }
544 -re ".*$gdb_prompt $" { fail "help maint space" }
545 timeout { fail "(timeout) help maint space" }
546 }
547
548send_gdb "help maint time\n"
549gdb_expect {
550 -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 $"\
551 { pass "help maint time" }
552 -re ".*$gdb_prompt $" { fail "help maint time" }
553 timeout { fail "(timeout) help maint time" }
554 }
555
556send_gdb "help maint demangle\n"
557gdb_expect {
c60b7188 558 -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
559 { pass "help maint demangle" }
560 -re ".*$gdb_prompt $" { fail "help maint demangle" }
561 timeout { fail "(timeout) help maint demangle" }
562 }
563
564send_gdb "help maint dump-me\n"
565gdb_expect {
9e297a97 566 -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
567 { pass "help maint dump-me" }
568 -re ".*$gdb_prompt $" { fail "help maint dump-me" }
569 timeout { fail "(timeout) help maint dump-me" }
570 }
571
7be570e7
JM
572send_gdb "help maint internal-error\n"
573gdb_expect {
574 -re "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*$gdb_prompt $"\
575 { pass "help maint internal-error" }
576 -re ".*$gdb_prompt $" { fail "help maint internal-error" }
577 timeout { fail "(timeout) help maint internal-error" }
578 }
579
dec43320
AC
580send_gdb "help maint internal-warning\n"
581gdb_expect {
582 -re "Give GDB an internal warning\\.\r\nCause GDB to behave as if an internal warning was reported\\..*$gdb_prompt $"\
583 { pass "help maint internal-warning" }
584 -re ".*$gdb_prompt $" { fail "help maint internal-warning" }
585 timeout { fail "(timeout) help maint internal-warning" }
586 }
587
c906108c
SS
588send_gdb "help maint print statistics\n"
589gdb_expect {
590 -re "Print statistics about internal gdb state\\..*$gdb_prompt $"\
591 { pass "help maint print statistics" }
592 -re ".*$gdb_prompt $" { fail "help maint print statistics" }
593 timeout { fail "(timeout) help maint print statistics" }
594 }
595
00905d52
AC
596gdb_test "help maint print dummy-frames" \
597 "Print the contents of the internal dummy-frame stack."
598
c906108c
SS
599send_gdb "help maint print objfiles\n"
600gdb_expect {
601 -re "Print dump of current object file definitions\\..*$gdb_prompt $"\
602 { pass "help maint print objfiles" }
603 -re ".*$gdb_prompt $" { fail "help maint print objfiles" }
604 timeout { fail "(timeout) help maint print objfiles" }
605 }
606
607send_gdb "help maint print psymbols\n"
608gdb_expect {
609 -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 $"\
610 { pass "help maint print psymbols" }
611 -re ".*$gdb_prompt $" { fail "help maint print psymbols" }
612 timeout { fail "(timeout) help maint print psymbols" }
613 }
614
615send_gdb "help maint print msymbols\n"
616gdb_expect {
617 -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 $"\
618 { pass "help maint print msymbols" }
619 -re ".*$gdb_prompt $" { fail "help maint print msymbols" }
620 timeout { fail "(timeout) help maint print msymbols" }
621 }
622
623send_gdb "help maint print symbols\n"
624gdb_expect {
625 -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 $"\
626 { pass "help maint print symbols" }
627 -re ".*$gdb_prompt $" { fail "help maint print symbols" }
628 timeout { fail "(timeout) help maint print symbols" }
629 }
630
631
632send_gdb "help maint print type\n"
633gdb_expect {
634 -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 $"\
635 { pass "help maint print type" }
636 -re ".*$gdb_prompt $" { fail "help maint print type" }
637 timeout { fail "(timeout) help maint print type" }
638 }
639
a0b3c4fd
JM
640if [istarget "hppa*-*-*"] {
641 send_gdb "help maint print unwind\n"
642 gdb_expect {
643 -re "Print unwind table entry at given address\\..*$gdb_prompt $"\
644 { pass "help maint print unwind" }
645 -re ".*$gdb_prompt $" { fail "help maint print unwind" }
646 timeout { fail "(timeout) help maint print unwind" }
647 }
648}
c906108c
SS
649
650send_gdb "help maint info sections\n"
651gdb_expect {
652 -re "List the BFD sections of the exec and core files\\..*$gdb_prompt $"\
653 { pass "help maint info sections" }
654 -re ".*$gdb_prompt $" { fail "help maint info sections" }
655 timeout { fail "(timeout) help maint info sections" }
656 }
657
658
659send_gdb "help maint info breakpoints\n"
660gdb_expect {
661-re "Status of all breakpoints, or breakpoint number NUMBER.*$gdb_prompt $" { pass "help maint info breakpoints" }
662 -re ".*$gdb_prompt $" { fail "help maint info breakpoints" }
663 timeout { fail "(timeout) help maint info breakpoints" }
664 }
665
666#send_gdb "help maint info breakpoints\n"
667#expect {
668# -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 $"\
669# { pass "help maint info breakpoints" }
670# -re ".*$gdb_prompt $" { fail "help maint info breakpoints" }
671# timeout { fail "(timeout) help maint info breakpoints" }
672# }
673
674send_gdb "help maint info\n"
675gdb_expect {
676 -re "Commands for showing internal info about the program being debugged.*unambiguous\\..*$gdb_prompt $"\
677 { pass "help maint info" }
678 -re ".*$gdb_prompt $" { fail "help maint info" }
679 timeout { fail "(timeout) help maint info" }
680 }
681
d8295fe9
VP
682test_prefix_command_help {"maint print" "maintenance print"} {
683 "Maintenance command for printing GDB internal state\\.\[\r\n\]+"
684}
c906108c 685
d8295fe9
VP
686test_prefix_command_help {"maint" "maintenance"} {
687 "Commands for use by GDB maintainers\\.\[\r\n\]+"
688 "Includes commands to dump specific internal GDB structures in\[\r\n\]+"
689 "a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+"
690 "to test internal functions such as the C\\+\\+/ObjC demangler, etc\\.\[\r\n\]+"
691}
c906108c
SS
692
693#set oldtimeout $timeout
694#set timeout [expr $timeout + 300]
695
696send_gdb "maint dump-me\n"
697gdb_expect {
698 -re "Should GDB dump core.*\\(y or n\\) $"\
699 { send_gdb "n\n"
700 gdb_expect {
701 -re ".*$gdb_prompt $" { pass "maint dump-me" }
702 timeout { fail "(timeout) maint dump-me" }
703 }
704 }
705 -re ".*$gdb_prompt $" { fail "maint dump-me" }
706 timeout { fail "(timeout) maint dump-me" }
707 }
708
7be570e7 709send_gdb "maint internal-error\n"
039cf96d
AC
710gdb_expect {
711 -re "A problem internal to GDB has been detected" {
712 pass "maint internal-error"
713 if [gdb_internal_error_resync] {
714 pass "internal-error resync"
715 } else {
716 fail "internal-error resync"
7be570e7
JM
717 }
718 }
719 -re ".*$gdb_prompt $" {
720 fail "maint internal-error"
039cf96d 721 untested "internal-error resync"
7be570e7
JM
722 }
723 timeout {
039cf96d
AC
724 fail "maint internal-error (timeout)"
725 untested "internal-error resync"
7be570e7
JM
726 }
727}
728
c906108c
SS
729#set timeout $oldtimeout
730
731
732gdb_exit
733return 0
This page took 0.788525 seconds and 4 git commands to generate.