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