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