maint.exp revision 1.8
1# Copyright 1998-2019 Free Software Foundation, Inc.
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16# This file was written by Elena Zannoni (ezannoni@cygnus.com)
17
18# this file tests maintenance commands and help on those.
19
20# source file used is break.c
21
22
23#maintenance check-psymtabs -- Check consistency of psymtabs vs symtabs
24#maintenance check-symtabs -- Check consistency of symtabs
25#maintenance expand-symtabs -- Expand symtabs matching a file regexp
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 dump-me -- Get fatal error; make debugger dump its core
29#maintenance print -- Maintenance command for printing GDB internal state
30#maintenance info -- Commands for showing internal info about the program being debugged
31#maintenance internal-error -- Give GDB an internal error.
32#
33#maintenance print dummy-frames -- Print the dummy frame stack
34#maintenance print statistics -- Print statistics about internal gdb state
35#maintenance print objfiles -- Print dump of current object file definitions
36#maintenance print psymbols -- Print dump of current partial symbol definitions
37#maintenance print msymbols -- Print dump of current minimal symbol definitions
38#maintenance print symbols -- Print dump of current symbol definitions
39#maintenance print type -- Print a type chain for a given symbol
40#maintenance print unwind -- Print unwind table entry at given address
41#
42#
43#maintenance info sections -- List the BFD sections of the exec and core files
44#maintenance info breakpoints -- Status of all breakpoints
45#
46
47
48
49standard_testfile break.c break1.c
50
51if {[prepare_for_testing "failed to prepare" $testfile \
52	 [list $srcfile $srcfile2] {debug nowarnings}]} {
53    return -1
54}
55
56# The commands we test here produce many lines of output; disable "press
57# <return> to continue" prompts.
58gdb_test_no_output "set height 0"
59
60# Tests that require that no program is running
61
62gdb_file_cmd ${binfile}
63
64# Test for a regression where this command would internal-error if the
65# program wasn't running.  If there's a lot of registers then this
66# might overflow expect's buffers, so process the output line at a
67# time.
68set saw_registers 0
69set saw_headers 0
70set test "maint print registers"
71gdb_test_multiple $test $test {
72    -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\[\r\n\]+" {
73	set saw_headers 1
74	exp_continue
75    }
76    -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[\r\n\]+" {
77        set saw_registers 1
78        exp_continue
79    }
80    -re "^\\*\[0-9\]+\[^\r\n\]+\[\r\n\]+" {
81        exp_continue
82    }
83    -re "$gdb_prompt $" {
84        gdb_assert { $saw_registers && $saw_headers } $test
85    }
86}
87
88# Test "mt expand-symtabs" here as it's easier to verify before we
89# run the program.
90gdb_test_no_output "mt set per on" "mt set per on for expand-symtabs"
91gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
92    "mt expand-symtabs" {
93	-re "#compunits: (1|2) \\(\[+\](0|1|2)\\),.*$gdb_prompt $" {
94	    # This should expand at most two primary symtabs.
95	    # "Normally" it will not expand any, because the symtab
96	    # holding "main" will already have been expanded, but if the
97	    # file is compiled with -fdebug-types-section then a second primary
98	    # symtab for break.c will be created for any types.
99	    pass "mt expand-symtabs"
100	}
101    }
102gdb_test "mt set per off" ".*" "mt set per off for expand-symtabs"
103
104# Tests that can or should be done with a running program
105
106gdb_load ${binfile}
107
108if ![runto_main] then {
109        perror "tests suppressed"
110}
111
112# If we're using .gdb_index or .debug_names there will be no psymtabs.
113set have_gdb_index 0
114gdb_test_multiple "maint info sections .gdb_index .debug_names" "check for .gdb_index" {
115    -re ": \\.gdb_index .*\r\n$gdb_prompt $" {
116	set have_gdb_index 1
117    }
118    -re ": \\.debug_names .*\r\n$gdb_prompt $" {
119	set have_gdb_index 1
120    }
121    -re ".*$gdb_prompt $" {
122	;# Nothing to do, present to avoid a FAIL.
123    }
124}
125
126# There also won't be any psymtabs if we read the index from the index cache.
127# We can detect this by looking if the index-cache is enabled and if the number
128# of cache misses is 0.
129set index_cache_misses -1
130gdb_test_multiple "show index-cache stats" "check index cache stats" {
131    -re ".*Cache misses \\(this session\\): (\\d+)\r\n.*$gdb_prompt $" {
132	set index_cache_misses $expect_out(1,string)
133    }
134}
135
136set using_index_cache 0
137gdb_test_multiple "show index-cache" "check index cache status" {
138    -re ".*is currently disabled.\r\n$gdb_prompt $" {
139	set using_index_cache 0
140    }
141    -re ".*is currently enabled.\r\n$gdb_prompt $" {
142	set using_index_cache 1
143    }
144}
145
146if { $index_cache_misses == 0 && $using_index_cache } {
147    set have_gdb_index 1
148}
149
150#
151# this command does not produce any output
152# unless there is some problem with the symtabs and psymtabs
153# so that branch will really never be covered in this tests here!!
154#
155
156# guo: on linux this command output is huge.  for some reason splitting up
157# the regexp checks works.
158#
159send_gdb "maint check-psymtabs\n"
160gdb_expect  {
161    -re "^maint check-psymtabs" {
162	gdb_expect {
163	    -re "$gdb_prompt $" {
164		pass "maint check-psymtabs"
165	    }
166	    timeout { fail "(timeout) maint check-psymtabs" }
167	}
168    }
169    -re ".*$gdb_prompt $"     { fail "maint check-psymtabs" }
170    timeout         { fail "(timeout) maint check-psymtabs" }
171}
172
173# This command does not produce any output unless there is some problem
174# with the symtabs, so that branch will really never be covered in the
175# tests here!!
176gdb_test_no_output "maint check-symtabs"
177
178# Test per-command stats.
179gdb_test_no_output "maint set per-command on"
180gdb_test "pwd" \
181    "Command execution time: \[0-9.\]+ \\(cpu\\), \[0-9.\]+ \\(wall\\)\[\r\n\]+Space used: $decimal \\(\\+$decimal for this command\\)\[\r\n\]+#symtabs: $decimal \\(\\+$decimal\\), #compunits: $decimal \\(\\+$decimal\\), #blocks: $decimal \\(\\+$decimal\\)"
182gdb_test_no_output "maint set per-command off"
183
184# The timeout value is raised, because printing all the symbols and
185# statistical information about Cygwin and Windows libraries takes a lot
186# of time.
187if [istarget "*-*-cygwin*"] {
188	set oldtimeout $timeout
189	set timeout [expr $timeout + 500]
190}
191
192send_gdb "maint print statistics\n"
193gdb_expect  {
194    -re "Statistics for\[^\n\r\]*maint\[^\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 read CUs: $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" {
195	gdb_expect {
196	    -re "$gdb_prompt $" {
197		pass "maint print statistics"
198	    }
199	    timeout { fail "(timeout) maint print statistics" }
200	}
201    }
202    -re ".*$gdb_prompt $"     { fail "maint print statistics" }
203    timeout         { fail "(timeout) maint print statistics" }
204}
205
206# There aren't any ...
207gdb_test_no_output "maint print dummy-frames"
208
209send_gdb "maint print objfiles\n"
210
211# To avoid timeouts, we avoid expects with many .* patterns that match
212# many lines.  Instead, we keep track of which milestones we've seen
213# in the output, and stop when we've seen all of them.
214
215set header 0
216set psymtabs 0
217set symtabs 0
218set keep_looking 1
219
220while {$keep_looking} {
221    gdb_expect  {
222
223	-re "\r\n" {
224	    set output $expect_out(buffer)
225	    if {[regexp ".*Object file.*maint($EXEEXT)?:  Objfile at ${hex}" $output]} {
226		set header 1
227	    }
228	    if {[regexp ".*Psymtabs:\[\r\t \]+\n" $output]} {
229		set psymtabs 1
230	    }
231	    if {[regexp ".*Symtabs:\[\r\t \]+\n" $output]} {
232		set symtabs 1
233	    }
234	}
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    }
244}
245
246proc maint_pass_if {val name} {
247    if $val { pass $name } else { fail $name }
248}
249
250maint_pass_if $header   "maint print objfiles: header"
251if { ! $have_gdb_index } {
252    maint_pass_if $psymtabs "maint print objfiles: psymtabs"
253}
254maint_pass_if $symtabs  "maint print objfiles: symtabs"
255
256if { ! $have_gdb_index } {
257    set psymbols_output [standard_output_file psymbols_output]
258    set psymbols_output_re [string_to_regexp $psymbols_output]
259    set test_list [list \
260		       "maint print psymbols -source" \
261		       "maint print psymbols -source ${srcdir}/${subdir}/${srcfile} $psymbols_output" \
262		       "maint print psymbols -pc" \
263		       "maint print psymbols -pc main $psymbols_output"]
264    foreach { test_name command } $test_list {
265	send_gdb "$command\n"
266	    gdb_expect  {
267		-re "^maint print psymbols \[^\n\]*\r\n$gdb_prompt $" {
268		    send_gdb "shell ls $psymbols_output\n"
269		    gdb_expect {
270			-re "$psymbols_output_re\r\n$gdb_prompt $" {
271			    # We want this grep to be as specific as possible,
272			    # so it's less likely to match symbol file names in
273			    # psymbols_output.  Yes, this actually happened;
274			    # poor expect got tons of output, and timed out
275			    # trying to match it.   --- Jim Blandy <jimb@cygnus.com>
276			    send_gdb "shell grep 'main.*function' $psymbols_output\n"
277			    gdb_expect {
278				-re ".main., function, $hex.*$gdb_prompt $" {
279				    pass "$test_name 1"
280				}
281				-re ".*main.  .., function, $hex.*$gdb_prompt $" {
282				    pass "$test_name 2"
283				}
284				-re ".*$gdb_prompt $" { fail "$test_name" }
285				timeout { fail "$test_name (timeout)" }
286			    }
287			    gdb_test "shell rm -f $psymbols_output" ".*" \
288				"${test_name}: shell rm -f psymbols_output"
289			}
290			-re ".*$gdb_prompt $" { fail "$test_name" }
291			timeout { fail "$test_name (timeout)" }
292		    }
293		}
294		-re ".*$gdb_prompt $" { fail "$test_name" }
295		timeout { fail "$test_name (timeout)" }
296	    }
297    }
298}
299
300
301set msymbols_output [standard_output_file msymbols_output]
302set msymbols_output_re [string_to_regexp $msymbols_output]
303send_gdb "maint print msymbols -objfile ${binfile} $msymbols_output\n"
304gdb_expect  {
305    -re "^maint print msymbols \[^\n\]*\r\n$gdb_prompt $" {
306	send_gdb "shell ls $msymbols_output\n"
307	gdb_expect {
308	    -re "$msymbols_output_re\r\n$gdb_prompt $" {
309		gdb_test "shell grep factorial $msymbols_output" \
310		    "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*" \
311		    "maint print msymbols, absolute pathname"
312		gdb_test "shell rm -f $msymbols_output" ".*" \
313		    "shell rm -f msymbols_output"
314	    }
315	    -re ".*$gdb_prompt $" { fail "maint print msymbols" }
316	    timeout { fail "maint print msymbols (timeout)" }
317	}
318    }
319    -re ".*$gdb_prompt $" { fail "maint print msymbols" }
320    timeout { fail "maint print msymbols (timeout)" }
321}
322
323# Check that maint print msymbols allows relative pathnames
324set mydir [pwd]
325gdb_test "cd [standard_output_file {}]" \
326    "Working directory .*\..*" \
327    "cd to objdir"
328
329gdb_test_multiple "maint print msymbols -objfile ${testfile} msymbols_output2" "maint print msymbols" {
330    -re "^maint print msymbols \[^\n\]*\r\n$gdb_prompt $" {
331    	gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" {
332	    -re "msymbols_output2\r\n$gdb_prompt $" {
333		gdb_test "shell grep factorial msymbols_output2" \
334		    "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*" \
335		    "maint print msymbols, relative pathname"
336		gdb_test "shell rm -f msymbols_output2" ".*"
337	    }
338	}
339    }
340}
341gdb_test "cd ${mydir}" \
342    "Working directory [string_to_regexp ${mydir}]\..*" \
343    "cd to mydir"
344
345
346# Request symbols for one particular source file so that we don't try to
347# dump the symbol information for the entire C library - over 500MB nowadays
348# for GNU libc.
349
350set symbols_output [standard_output_file symbols_output]
351set symbols_output_re [string_to_regexp $symbols_output]
352set test_list [list \
353		   "maint print symbols -source" \
354		   "maint print symbols -source ${srcdir}/${subdir}/${srcfile} $symbols_output" \
355		   "maint print symbols -pc" \
356		   "maint print symbols -pc main $symbols_output"]
357foreach { test_name command } $test_list {
358    send_gdb "$command\n"
359    gdb_expect {
360	-re "^maint print symbols \[^\n\]*\r\n$gdb_prompt $" {
361	    send_gdb "shell ls $symbols_output\n"
362	    gdb_expect {
363		-re "$symbols_output_re\r\n$gdb_prompt $" {
364		    # See comments for `maint print psymbols'.
365		    send_gdb "shell grep 'main(.*block' $symbols_output\n"
366		    gdb_expect {
367			-re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $" {
368			    pass "$test_name"
369			}
370			-re ".*$gdb_prompt $" { fail "$test_name" }
371			timeout { fail "$test_name (timeout)" }
372		    }
373		    gdb_test "shell rm -f $symbols_output" ".*" \
374			"$test_name: shell rm -f symbols_output"
375		}
376		-re ".*$gdb_prompt $" { fail "$test_name" }
377		timeout { fail "$test_name (timeout)" }
378	    }
379	}
380	-re ".*$gdb_prompt $" { fail "$test_name" }
381	timeout { fail "$test_name (timeout)" }
382    }
383}
384
385set msg "maint print type"
386gdb_test_multiple "maint print type argc" $msg {
387    -re "type node $hex\r\nname .int. \\($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\n$gdb_prompt $" {
388        pass $msg
389    }
390}
391
392if [istarget "hppa*-*-11*"] {
393    setup_xfail hppa*-*-*11* CLLbs14860
394    gdb_test_multiple "maint print unwind &main" "maint print unwind" {
395        -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 $" {
396	    pass "maint print unwind"
397	}
398        -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 $" {
399	    xfail "maint print unwind"
400	}
401    }
402}
403
404set oldtimeout $timeout
405set timeout [expr $timeout + 300]
406
407# It'd be nice to check for every possible section.  However, that's
408# problematic, since the relative ordering wanders from release to
409# release of the compilers.  Instead, we'll just check for two
410# sections which appear to always come out in the same relative
411# order.  (If that changes, then we should just check for one
412# section.)
413#
414# And by the way: This testpoint will break for PA64, where a.out's
415# are ELF files.
416
417# Standard GNU names.
418set text_section ".text"
419set data_section ".data"
420
421gdb_test_multiple "maint info sections" "maint info sections" {
422    -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*ER_RO.*$gdb_prompt $" {
423	# Looks like RealView which uses different section names.
424	set text_section ER_RO
425	set data_section ER_RW
426	pass "maint info sections"
427    }
428    -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*neardata.*$gdb_prompt $" {
429	# c6x doesn't have .data section.  It has .neardata and .fardata section.
430	set data_section ".neardata"
431	pass "maint info sections"
432    }
433    -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*$gdb_prompt $" {
434	pass "maint info sections"
435    }
436}
437
438# Test for new option: maint info sections <section name>
439# If you don't have a .text section, this will require tweaking.
440
441gdb_test_multiple "maint info sections $text_section" \
442    "maint info sections .text" {
443	-re ".* \\.bss .*$gdb_prompt $" {
444	    fail "maint info sections .text"
445	}
446	-re ".* $data_section .*$gdb_prompt $" {
447	    fail "maint info sections .text"
448	}
449	-re ".* $text_section .*$gdb_prompt $" {
450	    pass "maint info sections .text"
451	}
452    }
453
454# Test for new option: CODE section flag
455# If your data section is tagged CODE, xfail this test.
456
457gdb_test_multiple "maint info sections CODE" "maint info sections CODE" {
458    -re ".* $data_section .*$gdb_prompt $" { fail "maint info sections CODE" }
459    -re ".* $text_section .*$gdb_prompt $" { pass "maint info sections CODE" }
460}
461
462# Test for new option: DATA section flag
463# If your text section is tagged DATA, xfail this test.
464#
465# The "maint info sections DATA" test is marked for XFAIL on Windows,
466# because Windows has text sections marked DATA.
467setup_xfail "*-*-*cygwin*"
468setup_xfail "*-*-*mingw*"
469
470gdb_test_multiple "maint info sections DATA" "maint info sections DATA" {
471    -re ".* $text_section .*$gdb_prompt $" { fail "maint info sections DATA" }
472    -re ".* $data_section .*$gdb_prompt $" { pass "maint info sections DATA" }
473    -re ".* .rodata .*$gdb_prompt $" { pass "maint info sections DATA" }
474}
475
476set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
477
478gdb_test_multiple "maint info breakpoints" "maint info breakpoints" {
479    -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 $" {
480	pass "maint info breakpoints"
481    }
482    -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 $" {
483	pass "maint info breakpoints (with shlib events)"
484    }
485}
486
487gdb_test "maint print" \
488    "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*" \
489    "maint print w/o args"
490
491gdb_test "maint info" \
492    "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*" \
493    "maint info w/o args"
494
495gdb_test "maint" \
496    "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*" \
497    "maint w/o args"
498
499# Test that "main info line-table" w/o a file name shows the symtab for
500# $srcfile.
501set saw_srcfile 0
502set test "maint info line-table w/o a file name"
503gdb_test_multiple "maint info line-table" $test {
504    -re "symtab: \[^\n\r\]+${srcfile} \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+ADDRESS" {
505	set saw_srcfile 1
506	exp_continue
507    }
508    -re "symtab: \[^\n\r\]+ \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+ADDRESS" {
509	# Match each symtab to avoid overflowing expect's buffer.
510	exp_continue
511    }
512    -re "$decimal\[ \t\]+$decimal\[ \t\]+$hex\r\n" {
513	# Line table entries can be long too:
514	#
515	#  INDEX    LINE ADDRESS
516	#  0          29 0x00000000004006f6
517	#  1          30 0x00000000004006fa
518	#  2          31 0x0000000000400704
519	#  3          42 0x0000000000400706
520	#  4          43 0x0000000000400719
521	#  5          44 0x0000000000400722
522	#  6          45 0x0000000000400740
523	#  (...)
524	#  454       129 0x00007ffff7df1d28
525	#  455         0 0x00007ffff7df1d3f
526	#
527	# Match each line to avoid overflowing expect's buffer.
528	exp_continue
529    }
530    -re "$gdb_prompt $" {
531	gdb_assert $saw_srcfile $test
532    }
533}
534
535gdb_test "maint info line-table ${srcfile}" \
536    "symtab: \[^\n\r\]+${srcfile}.*INDEX.*LINE.*ADDRESS.*" \
537    "maint info line-table with filename of current symtab"
538
539gdb_test_no_output "maint info line-table ${srcfile2}" \
540    "maint info line-table with filename of symtab that is not currently expanded"
541
542gdb_test_no_output "maint expand-symtabs"
543
544gdb_test "maint info line-table ${srcfile2}" \
545    "symtab: \[^\n\r\]+${srcfile2}.*INDEX.*LINE.*ADDRESS.*" \
546    "maint info line-table with filename of symtab that is not current"
547
548gdb_test_no_output "maint info line-table xxx.c" \
549    "maint info line-table with invalid filename"
550
551set timeout $oldtimeout
552
553# Just check that the DWARF unwinders control flag is visible.
554gdb_test "maint show dwarf unwinders" \
555    "The DWARF stack unwinders are currently (on|off)\\."
556
557#============test help on maint commands
558
559test_prefix_command_help {"maint info" "maintenance info"} {
560    "Commands for showing internal info about the program being debugged\\.\[\r\n\]+"
561}
562
563test_prefix_command_help {"maint print" "maintenance print"} {
564    "Maintenance command for printing GDB internal state\\.\[\r\n\]+"
565}
566
567test_prefix_command_help {"maint" "maintenance"} {
568    "Commands for use by GDB maintainers\\.\[\r\n\]+"
569    "Includes commands to dump specific internal GDB structures in\[\r\n\]+"
570    "a human readable form, to cause GDB to deliberately dump core, etc\\.\[\r\n\]+"
571}
572
573#set oldtimeout $timeout
574#set timeout [expr $timeout + 300]
575
576gdb_test_multiple "maint dump-me" "maint dump-me" {
577    -re "Should GDB dump core.*\\(y or n\\) $" {
578	gdb_test "n" ".*" "maint dump-me"
579    }
580    -re "Undefined maintenance command: .*$gdb_prompt $" {
581	# Command 'maint dump-me' is registered on non-win32 host.
582	unsupported "maint dump-me"
583    }
584}
585
586send_gdb "maint internal-error\n"
587gdb_expect {
588    -re "A problem internal to GDB has been detected" {
589	pass "maint internal-error"
590	if [gdb_internal_error_resync] {
591	    pass "internal-error resync"
592	} else {
593	    fail "internal-error resync"
594	}
595    }
596    -re ".*$gdb_prompt $" {
597	fail "maint internal-error"
598	untested "internal-error resync"
599    }
600    timeout {
601	fail "maint internal-error (timeout)"
602	untested "internal-error resync"
603    }
604}
605
606#set timeout $oldtimeout
607
608# Test that the commands work without an argument.  For this test, we
609# don't need an inferior loaded/running.  See PR gdb/21164.
610gdb_exit
611gdb_start
612gdb_test_no_output "maint print symbols"
613gdb_test_no_output "maint print msymbols"
614gdb_test_no_output "maint print psymbols"
615
616gdb_exit
617return 0
618