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