1# Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008, 2009, 2010, 2011
2# Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.
16
17# This file was written by Elena Zannoni (ezannoni@cygnus.com)
18
19# this file tests maintenance commands and help on those.
20
21# source file used is break.c
22
23
24#maintenance check-symtabs -- Check consistency of psymtabs and symtabs
25#maintenance space -- Set the display of space usage
26#maintenance set -- Set GDB internal variables used by the GDB maintainer
27#maintenance show -- Show GDB internal variables used by the GDB maintainer
28#maintenance time -- Set the display of time usage
29#maintenance demangle -- Demangle a C++ mangled name
30#maintenance dump-me -- Get fatal error; make debugger dump its core
31#maintenance print -- Maintenance command for printing GDB internal state
32#maintenance info -- Commands for showing internal info about the program being debugged
33#maintenance internal-error -- Give GDB an internal error.
34#
35#maintenance print dummy-frames -- Print the dummy frame stack
36#maintenance print statistics -- Print statistics about internal gdb state
37#maintenance print objfiles -- Print dump of current object file definitions
38#maintenance print psymbols -- Print dump of current partial symbol definitions
39#maintenance print msymbols -- Print dump of current minimal symbol definitions
40#maintenance print symbols -- Print dump of current symbol definitions
41#maintenance print type -- Print a type chain for a given symbol
42#maintenance print unwind -- Print unwind table entry at given address
43#
44#
45#maintenance info sections -- List the BFD sections of the exec and core files
46#maintenance info breakpoints -- Status of all breakpoints
47#
48
49
50
51if $tracelevel then {
52        strace $tracelevel
53        }
54
55global usestubs
56
57set testfile "break"
58set srcfile ${testfile}.c
59set srcfile1 ${testfile}1.c
60set binfile ${objdir}/${subdir}/${testfile}
61
62if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
63     untested maint.exp
64     return -1
65}
66
67if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
68     untested maint.exp
69     return -1
70}
71
72if  { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
73     untested maint.exp
74     return -1
75}
76
77
78gdb_exit
79gdb_start
80gdb_reinitialize_dir $srcdir/$subdir
81
82# The commands we test here produce many lines of output; disable "press
83# <return> to continue" prompts.
84gdb_test_no_output "set height 0"
85
86# Tests that require that no program is running
87
88gdb_file_cmd ${binfile}
89
90# Test for a regression where this command would internal-error if the
91# program wasn't running.
92gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*"
93
94# Tests that can or should be done with a running program
95
96gdb_load ${binfile}
97
98if ![runto_main] then {
99        perror "tests suppressed"
100}
101
102
103#
104# this command does not produce any output
105# unless there is some problem with the symtabs and psymtabs
106# so that branch will really never be covered in this tests here!!
107#
108
109# guo: on linux this command output is huge.  for some reason splitting up
110# the regexp checks works.
111#
112send_gdb "maint check-symtabs\n"
113gdb_expect  {
114    -re "^maint check-symtabs" {
115	gdb_expect {
116	    -re "$gdb_prompt $" {
117		pass "maint check-symtabs"
118	    }
119	    timeout { fail "(timeout) maint check-symtabs" }
120	}
121    }
122    -re ".*$gdb_prompt $"     { fail "maint check-symtabs" }
123    timeout         { fail "(timeout) maint check-symtabs" }
124}
125
126gdb_test "maint space" \
127    "\"maintenance space\" takes a numeric argument\\."
128
129gdb_test "maint space 1" \
130    "Space used: $decimal \\(\\+$decimal for this command\\)"
131
132gdb_test "maint time" \
133    "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\)"
134
135gdb_test "maint time 1" \
136    "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\)"
137
138gdb_test "maint time 0" \
139    "Space used: $decimal \\(\\+$decimal for this command\\)"
140
141gdb_test_no_output "maint space 0"
142
143gdb_test "maint demangle" \
144    "\"maintenance demangle\" takes an argument to demangle\\."
145
146gdb_test "maint demangle main" "Can't demangle \"main\""
147
148
149
150# The timeout value is raised, because printing all the symbols and
151# statistical information about Cygwin and Windows libraries takes a lot
152# of time.
153if [istarget "*-*-cygwin*"] {
154	set oldtimeout $timeout
155	set timeout [expr $timeout + 500]
156}
157
158send_gdb "maint print statistics\n"
159gdb_expect  {
160    -re "Statistics for\[^\n\r\]*break\[^\n\r\]*:\r\n  Number of \"minimal\" symbols read: $decimal\r\n  Number of \"partial\" symbols read: $decimal\r\n  Number of \"full\" symbols read: $decimal\r\n  Number of \"types\" defined: $decimal\r\n  Number of psym tables \\(not yet expanded\\): $decimal\r\n  Number of symbol tables: $decimal\r\n  Number of symbol tables with line tables: $decimal\r\n  Number of symbol tables with blockvectors: $decimal\r\n  Total memory used for objfile obstack: $decimal\r\n  Total memory used for psymbol cache: $decimal\r\n  Total memory used for macro cache: $decimal\r\n  Total memory used for file name cache: $decimal\r\n" {
161	gdb_expect {
162	    -re "$gdb_prompt $" {
163		pass "maint print statistics"
164	    }
165	    timeout { fail "(timeout) maint print statistics" }
166	}
167    }
168    -re ".*$gdb_prompt $"     { fail "maint print statistics" }
169    timeout         { fail "(timeout) maint print statistics" }
170}
171
172# There aren't any ...
173gdb_test_no_output "maint print dummy-frames"
174
175send_gdb "maint print objfiles\n"
176
177# To avoid timeouts, we avoid expects with many .* patterns that match
178# many lines.  Instead, we keep track of which milestones we've seen
179# in the output, and stop when we've seen all of them.
180
181set header 0
182set psymtabs 0
183set symtabs 0
184set keep_looking 1
185
186while {$keep_looking} {
187    gdb_expect  {
188
189	-re ".*Object file.*break($EXEEXT)?:  Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 }
190	-re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 }
191	-re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 }
192
193	-re ".*$gdb_prompt $" {
194	    set keep_looking 0
195	}
196	timeout {
197	    fail "(timeout) maint print objfiles"
198	    set keep_looking 0
199	}
200    }
201}
202
203proc maint_pass_if {val name} {
204    if $val { pass $name } else { fail $name }
205}
206
207maint_pass_if $header   "maint print objfiles: header"
208maint_pass_if $psymtabs "maint print objfiles: psymtabs"
209maint_pass_if $symtabs  "maint print objfiles: symtabs"
210
211gdb_test "maint print psymbols" \
212    "print-psymbols takes an output file name and optional symbol file name" \
213    "maint print psymbols w/o args"
214
215
216
217send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n"
218gdb_expect  {
219    -re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $" {
220	send_gdb "shell ls psymbols_output\n"
221	gdb_expect {
222	    -re "psymbols_output\r\n$gdb_prompt $" {
223		# We want this grep to be as specific as possible,
224		# so it's less likely to match symbol file names in
225		# psymbols_output.  Yes, this actually happened;
226		# poor expect got tons of output, and timed out
227		# trying to match it.   --- Jim Blandy <jimb@cygnus.com>
228		send_gdb "shell grep 'main.*function' psymbols_output\n"
229		gdb_expect {
230		    -re ".main., function, $hex.*$gdb_prompt $" {
231			pass "maint print psymbols 1"
232		    }
233		    -re ".*main.  .., function, $hex.*$gdb_prompt $" {
234			pass "maint print psymbols 2"
235		    }
236		    -re ".*$gdb_prompt $" { fail "maint print psymbols" }
237		    timeout     { fail "(timeout) maint print psymbols" }
238		}
239		gdb_test "shell rm -f psymbols_output" ".*"
240	    }
241	    -re ".*$gdb_prompt $"       { fail "maint print psymbols" }
242	    timeout           { fail "(timeout) maint print psymbols" }
243	}
244    }
245    -re ".*$gdb_prompt $"       { fail "maint print psymbols" }
246    timeout           { fail "(timeout) maint print psymbols" }
247}
248
249gdb_test "maint print msymbols" \
250    "print-msymbols takes an output file name and optional symbol file name" \
251    "maint print msymbols w/o args"
252
253
254send_gdb "maint print msymbols msymbols_output ${binfile}\n"
255gdb_expect  {
256    -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $" {
257	send_gdb "shell ls msymbols_output\n"
258	gdb_expect {
259	    -re "msymbols_output\r\n$gdb_prompt $" {
260		send_gdb "shell grep factorial msymbols_output\n"
261		gdb_expect {
262		    -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" {
263			pass "maint print msymbols"
264		    }
265		    -re ".*$gdb_prompt $"     { fail "maint print msymbols" }
266		    timeout         { fail "(timeout) maint print msymbols" }
267		}
268		gdb_test "shell rm -f msymbols_output" ".*"
269	    }
270	    -re ".*$gdb_prompt $"     { fail "maint print msymbols" }
271	    timeout         { fail "(timeout) maint print msymbols" }
272	}
273    }
274    -re ".*$gdb_prompt $"     { fail "maint print msymbols" }
275    timeout         { fail "(timeout) maint print msymbols" }
276}
277
278# Check that maint print msymbols allows relative pathnames
279set mydir [pwd]
280gdb_test "cd ${objdir}" \
281    "Working directory [string_to_regexp ${objdir}]\..*" \
282    "cd to objdir"
283
284gdb_test_multiple "maint print msymbols msymbols_output2 ${subdir}/${testfile}" "maint print msymbols" {
285    -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" {
286    	gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" {
287	    -re "msymbols_output2\r\n$gdb_prompt $" {
288	    	gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" {
289		    -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" {
290		    	pass "maint print msymbols"
291		    }
292		    -re ".*$gdb_prompt $" {
293		        fail "maint print msymbols"
294		    }
295		    timeout {
296		        fail "(timeout) maint print msymbols"
297		    }
298		}
299		gdb_test "shell rm -f msymbols_output2" ".*"
300	    }
301	    -re ".*$gdb_prompt $" {
302		fail "maint print msymbols"
303	    }
304	    timeout {
305	    	fail "(timeout) maint print msymbols"
306	    }
307	}
308    }
309    -re ".*$gdb_prompt $" {
310	fail "maint print msymbols"
311    }
312    timeout {
313	fail "(timeout) maint print msymbols"
314    }
315}
316gdb_test "cd ${mydir}" \
317    "Working directory [string_to_regexp ${mydir}]\..*" \
318    "cd to mydir"
319
320gdb_test "maint print symbols" \
321    "Arguments missing: an output file name and an optional symbol file name" \
322    "maint print symbols w/o args"
323
324
325# Request symbols for one particular source file so that we don't try to
326# dump the symbol information for the entire C library - over 500MB nowadays
327# for GNU libc.
328
329send_gdb "maint print symbols symbols_output ${srcdir}/${subdir}/${srcfile}\n"
330gdb_expect  {
331    -re "^maint print symbols symbols_output \[^\n\]*\r\n$gdb_prompt $" {
332	send_gdb "shell ls symbols_output\n"
333	gdb_expect {
334	    -re "symbols_output\r\n$gdb_prompt $" {
335		# See comments for `maint print psymbols'.
336		send_gdb "shell grep 'main(.*block' symbols_output\n"
337		gdb_expect {
338		    -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $" {
339			pass "maint print symbols"
340		    }
341		    -re ".*$gdb_prompt $"     { fail "maint print symbols" }
342		    timeout         { fail "(timeout) maint print symbols" }
343		}
344		gdb_test "shell rm -f symbols_output" ".*"
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
354set msg "maint print type"
355gdb_test_multiple "maint print type argc" $msg {
356    -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\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\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\n$gdb_prompt $" {
357        pass $msg
358    }
359}
360
361if [istarget "hppa*-*-11*"] {
362    setup_xfail hppa*-*-*11* CLLbs14860
363    gdb_test_multiple "maint print unwind &main" "maint print unwind" {
364        -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 $" {
365	    pass "maint print unwind"
366	}
367        -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 $" {
368	    xfail "maint print unwind"
369	}
370    }
371}
372
373set oldtimeout $timeout
374set timeout [expr $timeout + 300]
375
376# It'd be nice to check for every possible section.  However, that's
377# problematic, since the relative ordering wanders from release to
378# release of the compilers.  Instead, we'll just check for two
379# sections which appear to always come out in the same relative
380# order.  (If that changes, then we should just check for one
381# section.)
382#
383# And by the way: This testpoint will break for PA64, where a.out's
384# are ELF files.
385
386# Standard GNU names.
387set text_section ".text"
388set data_section ".data"
389
390gdb_test_multiple "maint info sections" "maint info sections" {
391    -re "Exec file:\r\n.*break($EXEEXT)?., file type.*ER_RO.*$gdb_prompt $" {
392	# Looks like RealView which uses different section names.
393	set text_section ER_RO
394	set data_section ER_RW
395	pass "maint info sections"
396    }
397    -re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $" {
398	pass "maint info sections"
399    }
400}
401
402# Test for new option: maint info sections <section name>
403# If you don't have a .text section, this will require tweaking.
404
405gdb_test_multiple "maint info sections $text_section" \
406    "maint info sections .text" {
407	-re ".* \\.bss .*$gdb_prompt $" {
408	    fail "maint info sections .text"
409	}
410	-re ".* $data_section .*$gdb_prompt $" {
411	    fail "maint info sections .text"
412	}
413	-re ".* $text_section .*$gdb_prompt $" {
414	    pass "maint info sections .text"
415	}
416    }
417
418# Test for new option: CODE section flag
419# If your data section is tagged CODE, xfail this test.
420
421gdb_test_multiple "maint info sections CODE" "maint info sections CODE" {
422    -re ".* $data_section .*$gdb_prompt $" { fail "maint info sections CODE" }
423    -re ".* $text_section .*$gdb_prompt $" { pass "maint info sections CODE" }
424}
425
426# Test for new option: DATA section flag
427# If your text section is tagged DATA, xfail this test.
428#
429# The "maint info sections DATA" test is marked for XFAIL on Cygwin,
430# because Windows has text sections marked DATA.
431setup_xfail "*-*-*cygwin*"
432
433gdb_test_multiple "maint info sections DATA" "maint info sections DATA" {
434    -re ".* $text_section .*$gdb_prompt $" { fail "maint info sections DATA" }
435    -re ".* $data_section .*$gdb_prompt $" { pass "maint info sections DATA" }
436    -re ".* .rodata .*$gdb_prompt $" { pass "maint info sections DATA" }
437}
438
439set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
440
441gdb_test_multiple "maint info breakpoints" "maint info breakpoints" {
442    -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 inf 1\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $" {
443	pass "maint info breakpoints"
444    }
445    -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 sspace 1\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 $" {
446	pass "maint info breakpoints (with shlib events)"
447    }
448}
449
450gdb_test "maint print" \
451    "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*" \
452    "maint print w/o args"
453
454gdb_test "maint info" \
455    "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*" \
456    "maint info w/o args"
457
458gdb_test "maint" \
459    "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*" \
460    "maint w/o args"
461
462set timeout $oldtimeout
463
464#============test help on maint commands
465
466gdb_test "help maint" \
467    "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\\..*"
468
469gdb_test "help maint check-symtabs" \
470    "Check consistency of psymtabs and symtabs\\..*"
471
472gdb_test "help maint space" \
473    "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\\..*"
474
475gdb_test "help maint time" \
476    "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\\..*"
477
478gdb_test "help maint demangle" \
479    "Demangle a C\\+\\+/ObjC mangled name\\.\r\nCall internal GDB demangler routine to demangle a C\\+\\+ link name\r\nand prints the result\\..*"
480
481gdb_test "help maint dump-me" \
482    "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\\..*"
483
484gdb_test "help maint internal-error" \
485    "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*"
486
487gdb_test "help maint internal-warning" \
488    "Give GDB an internal warning\\.\r\nCause GDB to behave as if an internal warning was reported\\..*"
489
490gdb_test "help maint print statistics" \
491    "Print statistics about internal gdb state\\..*"
492
493gdb_test "help maint print dummy-frames" \
494	"Print the contents of the internal dummy-frame stack."
495
496gdb_test "help maint print objfiles" \
497    "Print dump of current object file definitions\\..*"
498
499gdb_test "help maint print psymbols" \
500    "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\\..*"
501
502gdb_test "help maint print msymbols" \
503    "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\\..*"
504
505gdb_test "help maint print symbols" \
506    "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\\..*"
507
508gdb_test "help maint print type" \
509    "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\\..*"
510
511if [istarget "hppa*-*-*"] {
512    gdb_test "help maint print unwind" \
513	"Print unwind table entry at given address\\..*"
514}
515
516gdb_test "help maint info sections" \
517    "List the BFD sections of the exec and core files\\..*"
518
519gdb_test "help maint info breakpoints" \
520    "Status of all breakpoints, or breakpoint number NUMBER.*"
521
522
523#send_gdb "help maint info breakpoints\n"
524#expect  {
525#        -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 $"\
526#                        { pass "help maint info breakpoints" }
527#        -re ".*$gdb_prompt $"       { fail "help maint info breakpoints" }
528#        timeout         { fail "(timeout) help maint info breakpoints" }
529#        }
530
531gdb_test "help maint info" \
532    "Commands for showing internal info about the program being debugged.*unambiguous\\..*"
533
534test_prefix_command_help {"maint print" "maintenance print"} {
535    "Maintenance command for printing GDB internal state\\.\[\r\n\]+"
536}
537
538test_prefix_command_help {"maint" "maintenance"} {
539    "Commands for use by GDB maintainers\\.\[\r\n\]+"
540    "Includes commands to dump specific internal GDB structures in\[\r\n\]+"
541    "a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+"
542    "to test internal functions such as the C\\+\\+/ObjC demangler, etc\\.\[\r\n\]+"
543}
544
545#set oldtimeout $timeout
546#set timeout [expr $timeout + 300]
547
548gdb_test_multiple "maint dump-me" "maint dump-me" {
549    -re "Should GDB dump core.*\\(y or n\\) $" {
550	gdb_test "n" ".*" "maint dump-me"
551    }
552}
553
554send_gdb "maint internal-error\n"
555gdb_expect {
556    -re "A problem internal to GDB has been detected" {
557	pass "maint internal-error"
558	if [gdb_internal_error_resync] {
559	    pass "internal-error resync"
560	} else {
561	    fail "internal-error resync"
562	}
563    }
564    -re ".*$gdb_prompt $" {
565	fail "maint internal-error"
566	untested "internal-error resync"
567    }
568    timeout {
569	fail "maint internal-error (timeout)"
570	untested "internal-error resync"
571    }
572}
573
574#set timeout $oldtimeout
575
576
577gdb_exit
578return 0
579