fix recursively_compute_inclusions and add dwz test case
[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
7d0c9981
DE
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
4f337972
AC
26#maintenance set -- Set GDB internal variables used by the GDB maintainer
27#maintenance show -- Show GDB internal variables used by the GDB maintainer
c906108c
SS
28#maintenance demangle -- Demangle a C++ mangled name
29#maintenance dump-me -- Get fatal error; make debugger dump its core
30#maintenance print -- Maintenance command for printing GDB internal state
31#maintenance info -- Commands for showing internal info about the program being debugged
7be570e7 32#maintenance internal-error -- Give GDB an internal error.
c906108c 33#
00905d52 34#maintenance print dummy-frames -- Print the dummy frame stack
c906108c
SS
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
f8b41b00 50standard_testfile break.c break1.c
a1dea79a 51
f8b41b00
TT
52if {[prepare_for_testing $testfile.exp $testfile \
53 [list $srcfile $srcfile2] {debug nowarnings}]} {
54 untested $testfile.exp
55 return -1
c906108c
SS
56}
57
b78974c3
PA
58# The commands we test here produce many lines of output; disable "press
59# <return> to continue" prompts.
60gdb_test_no_output "set height 0"
61
62# Tests that require that no program is running
63
64gdb_file_cmd ${binfile}
65
66# Test for a regression where this command would internal-error if the
67# program wasn't running.
68gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*"
69
7d0c9981
DE
70# Test "mt expand-symtabs" here as it's easier to verify before we
71# run the program.
72gdb_test_no_output "mt set per on" "mt set per on for expand-symtabs"
73gdb_test_multiple "mt expand-symtabs $subdir/break\[.\]c$" \
74 "mt expand-symtabs" {
e19d3afb
DE
75 -re "#primary symtabs: (1|2) \\(\[+\](1|2)\\),.*$gdb_prompt $" {
76 # This should expand one or at most two primary symtabs.
77 # "Normally" it will expand just the one for break.c, but if the
78 # file is compiled with -fdebug-types-section then a second primary
79 # symtab for break.c will be created for any types.
7d0c9981
DE
80 pass "mt expand-symtabs"
81 }
82 }
83gdb_test "mt set per off" ".*" "mt set per off for expand-symtabs"
84
b78974c3
PA
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#
7d0c9981 113send_gdb "maint check-psymtabs\n"
c906108c 114gdb_expect {
7d0c9981 115 -re "^maint check-psymtabs" {
65731a6b
MS
116 gdb_expect {
117 -re "$gdb_prompt $" {
7d0c9981 118 pass "maint check-psymtabs"
a0b3c4fd 119 }
7d0c9981 120 timeout { fail "(timeout) maint check-psymtabs" }
a0b3c4fd 121 }
65731a6b 122 }
7d0c9981
DE
123 -re ".*$gdb_prompt $" { fail "maint check-psymtabs" }
124 timeout { fail "(timeout) maint check-psymtabs" }
65731a6b 125}
c906108c 126
7d0c9981
DE
127# This command does not produce any output unless there is some problem
128# with the symtabs, so that branch will really never be covered in the
129# tests here!!
130gdb_test_no_output "maint check-symtabs"
131
bd712aed 132gdb_test_no_output "maint set per-command on"
c906108c 133
bd712aed
DE
134gdb_test "maint set per-command off" \
135 "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 136
65731a6b
MS
137gdb_test "maint demangle" \
138 "\"maintenance demangle\" takes an argument to demangle\\."
c906108c 139
65731a6b 140gdb_test "maint demangle main" "Can't demangle \"main\""
c906108c 141
c906108c 142
c906108c 143
dbdfa66c
CV
144# The timeout value is raised, because printing all the symbols and
145# statistical information about Cygwin and Windows libraries takes a lot
cb80163c
DE
146# of time.
147if [istarget "*-*-cygwin*"] {
148 set oldtimeout $timeout
149 set timeout [expr $timeout + 500]
150}
c906108c 151
55b7ce7f
UW
152send_gdb "maint print statistics\n"
153gdb_expect {
f8b41b00 154 -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" {
55b7ce7f
UW
155 gdb_expect {
156 -re "$gdb_prompt $" {
157 pass "maint print statistics"
158 }
159 timeout { fail "(timeout) maint print statistics" }
160 }
65731a6b 161 }
55b7ce7f
UW
162 -re ".*$gdb_prompt $" { fail "maint print statistics" }
163 timeout { fail "(timeout) maint print statistics" }
65731a6b 164}
c906108c 165
00905d52 166# There aren't any ...
27d3a1a2 167gdb_test_no_output "maint print dummy-frames"
00905d52 168
c906108c 169send_gdb "maint print objfiles\n"
adf40b2e 170
c906108c 171# To avoid timeouts, we avoid expects with many .* patterns that match
adf40b2e
JM
172# many lines. Instead, we keep track of which milestones we've seen
173# in the output, and stop when we've seen all of them.
174
175set header 0
176set psymtabs 0
177set symtabs 0
178set keep_looking 1
179
180while {$keep_looking} {
181 gdb_expect {
182
f8b41b00 183 -re ".*Object file.*maint($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 }
adf40b2e
JM
184 -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 }
185 -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 }
186
187 -re ".*$gdb_prompt $" {
188 set keep_looking 0
189 }
190 timeout {
191 fail "(timeout) maint print objfiles"
192 set keep_looking 0
193 }
194 }
c906108c 195}
adf40b2e
JM
196
197proc maint_pass_if {val name} {
198 if $val { pass $name } else { fail $name }
c906108c
SS
199}
200
adf40b2e 201maint_pass_if $header "maint print objfiles: header"
27210e12
DE
202if { ! $have_gdb_index } {
203 maint_pass_if $psymtabs "maint print objfiles: psymtabs"
204}
adf40b2e
JM
205maint_pass_if $symtabs "maint print objfiles: symtabs"
206
65731a6b
MS
207gdb_test "maint print psymbols" \
208 "print-psymbols takes an output file name and optional symbol file name" \
209 "maint print psymbols w/o args"
210
27210e12 211if { ! $have_gdb_index } {
f8b41b00
TT
212 set psymbols_output [standard_output_file psymbols_output]
213 send_gdb "maint print psymbols $psymbols_output ${srcdir}/${subdir}/${srcfile}\n"
27210e12 214 gdb_expect {
f8b41b00
TT
215 -re "^maint print psymbols $psymbols_output \[^\n\]*\r\n$gdb_prompt $" {
216 send_gdb "shell ls $psymbols_output\n"
27210e12 217 gdb_expect {
f8b41b00 218 -re "$psymbols_output\r\n$gdb_prompt $" {
27210e12
DE
219 # We want this grep to be as specific as possible,
220 # so it's less likely to match symbol file names in
221 # psymbols_output. Yes, this actually happened;
222 # poor expect got tons of output, and timed out
223 # trying to match it. --- Jim Blandy <jimb@cygnus.com>
f8b41b00 224 send_gdb "shell grep 'main.*function' $psymbols_output\n"
27210e12
DE
225 gdb_expect {
226 -re ".main., function, $hex.*$gdb_prompt $" {
227 pass "maint print psymbols 1"
228 }
229 -re ".*main. .., function, $hex.*$gdb_prompt $" {
230 pass "maint print psymbols 2"
231 }
232 -re ".*$gdb_prompt $" { fail "maint print psymbols" }
233 timeout { fail "(timeout) maint print psymbols" }
65731a6b 234 }
f8b41b00
TT
235 gdb_test "shell rm -f $psymbols_output" ".*" \
236 "shell rm -f psymbols_output"
65731a6b 237 }
27210e12
DE
238 -re ".*$gdb_prompt $" { fail "maint print psymbols" }
239 timeout { fail "(timeout) maint print psymbols" }
65731a6b 240 }
65731a6b 241 }
27210e12
DE
242 -re ".*$gdb_prompt $" { fail "maint print psymbols" }
243 timeout { fail "(timeout) maint print psymbols" }
65731a6b 244 }
65731a6b 245}
c906108c 246
65731a6b
MS
247gdb_test "maint print msymbols" \
248 "print-msymbols takes an output file name and optional symbol file name" \
249 "maint print msymbols w/o args"
c906108c 250
c906108c 251
f8b41b00
TT
252set msymbols_output [standard_output_file msymbols_output]
253send_gdb "maint print msymbols $msymbols_output ${binfile}\n"
c906108c 254gdb_expect {
f8b41b00
TT
255 -re "^maint print msymbols $msymbols_output \[^\n\]*\r\n$gdb_prompt $" {
256 send_gdb "shell ls $msymbols_output\n"
65731a6b 257 gdb_expect {
f8b41b00
TT
258 -re "$msymbols_output\r\n$gdb_prompt $" {
259 send_gdb "shell grep factorial $msymbols_output\n"
65731a6b 260 gdb_expect {
efd11a33 261 -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" {
65731a6b
MS
262 pass "maint print msymbols"
263 }
264 -re ".*$gdb_prompt $" { fail "maint print msymbols" }
265 timeout { fail "(timeout) maint print msymbols" }
266 }
f8b41b00
TT
267 gdb_test "shell rm -f $msymbols_output" ".*" \
268 "shell rm -f msymbols_output"
65731a6b
MS
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}
c906108c 277
dbdfa66c
CV
278# Check that maint print msymbols allows relative pathnames
279set mydir [pwd]
65731a6b
MS
280gdb_test "cd ${objdir}" \
281 "Working directory [string_to_regexp ${objdir}]\..*" \
282 "cd to objdir"
283
dbdfa66c
CV
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" {
efd11a33 289 -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" {
dbdfa66c
CV
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 }
f8b41b00
TT
299 gdb_test "shell rm -f msymbols_output2" ".*" \
300 "shell rm -f msymbols_output2"
dbdfa66c
CV
301 }
302 -re ".*$gdb_prompt $" {
303 fail "maint print msymbols"
304 }
305 timeout {
306 fail "(timeout) maint print msymbols"
307 }
308 }
309 }
310 -re ".*$gdb_prompt $" {
311 fail "maint print msymbols"
312 }
313 timeout {
314 fail "(timeout) maint print msymbols"
315 }
316}
65731a6b
MS
317gdb_test "cd ${mydir}" \
318 "Working directory [string_to_regexp ${mydir}]\..*" \
319 "cd to mydir"
320
321gdb_test "maint print symbols" \
322 "Arguments missing: an output file name and an optional symbol file name" \
323 "maint print symbols w/o args"
c906108c 324
c906108c 325
3bcbaac5
DJ
326# Request symbols for one particular source file so that we don't try to
327# dump the symbol information for the entire C library - over 500MB nowadays
328# for GNU libc.
adf40b2e 329
f8b41b00
TT
330set symbols_output [standard_output_file symbols_output]
331send_gdb "maint print symbols $symbols_output ${srcdir}/${subdir}/${srcfile}\n"
c906108c 332gdb_expect {
f8b41b00
TT
333 -re "^maint print symbols $symbols_output \[^\n\]*\r\n$gdb_prompt $" {
334 send_gdb "shell ls $symbols_output\n"
65731a6b 335 gdb_expect {
f8b41b00 336 -re "$symbols_output\r\n$gdb_prompt $" {
65731a6b 337 # See comments for `maint print psymbols'.
f8b41b00 338 send_gdb "shell grep 'main(.*block' $symbols_output\n"
65731a6b
MS
339 gdb_expect {
340 -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $" {
341 pass "maint print symbols"
342 }
343 -re ".*$gdb_prompt $" { fail "maint print symbols" }
344 timeout { fail "(timeout) maint print symbols" }
345 }
f8b41b00
TT
346 gdb_test "shell rm -f $symbols_output" ".*" \
347 "shell rm -f symbols_output"
65731a6b
MS
348 }
349 -re ".*$gdb_prompt $" { fail "maint print symbols" }
350 timeout { fail "(timeout) maint print symbols" }
351 }
352 }
353 -re ".*$gdb_prompt $" { fail "maint print symbols" }
354 timeout { fail "(timeout) maint print symbols" }
355}
c906108c 356
b4ba55a1
JB
357set msg "maint print type"
358gdb_test_multiple "maint print type argc" $msg {
359 -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 $" {
360 pass $msg
361 }
362}
c906108c 363
a0b3c4fd
JM
364if [istarget "hppa*-*-11*"] {
365 setup_xfail hppa*-*-*11* CLLbs14860
65731a6b
MS
366 gdb_test_multiple "maint print unwind &main" "maint print unwind" {
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\tRegion_description = $hex\r\n\tEntry_FR = $hex\r\n\tEntry_GR = $hex\r\n\tTotal_frame_size = $hex\r\n$gdb_prompt $" {
368 pass "maint print unwind"
369 }
370 -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 $" {
371 xfail "maint print unwind"
372 }
a0b3c4fd
JM
373 }
374}
c906108c
SS
375
376set oldtimeout $timeout
377set timeout [expr $timeout + 300]
378
379# It'd be nice to check for every possible section. However, that's
380# problematic, since the relative ordering wanders from release to
381# release of the compilers. Instead, we'll just check for two
382# sections which appear to always come out in the same relative
383# order. (If that changes, then we should just check for one
384# section.)
385#
386# And by the way: This testpoint will break for PA64, where a.out's
387# are ELF files.
293e2f9e
DJ
388
389# Standard GNU names.
390set text_section ".text"
391set data_section ".data"
392
65731a6b 393gdb_test_multiple "maint info sections" "maint info sections" {
f8b41b00 394 -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*ER_RO.*$gdb_prompt $" {
65731a6b
MS
395 # Looks like RealView which uses different section names.
396 set text_section ER_RO
397 set data_section ER_RW
398 pass "maint info sections"
399 }
f8b41b00 400 -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*neardata.*$gdb_prompt $" {
d93f7b5c
YQ
401 # c6x doesn't have .data section. It has .neardata and .fardata section.
402 set data_section ".neardata"
403 pass "maint info sections"
404 }
f8b41b00 405 -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*$gdb_prompt $" {
65731a6b
MS
406 pass "maint info sections"
407 }
408}
c906108c 409
8ddad156
MS
410# Test for new option: maint info sections <section name>
411# If you don't have a .text section, this will require tweaking.
65731a6b
MS
412
413gdb_test_multiple "maint info sections $text_section" \
414 "maint info sections .text" {
415 -re ".* \\.bss .*$gdb_prompt $" {
416 fail "maint info sections .text"
417 }
418 -re ".* $data_section .*$gdb_prompt $" {
419 fail "maint info sections .text"
420 }
421 -re ".* $text_section .*$gdb_prompt $" {
422 pass "maint info sections .text"
423 }
424 }
8ddad156
MS
425
426# Test for new option: CODE section flag
427# If your data section is tagged CODE, xfail this test.
65731a6b
MS
428
429gdb_test_multiple "maint info sections CODE" "maint info sections CODE" {
293e2f9e
DJ
430 -re ".* $data_section .*$gdb_prompt $" { fail "maint info sections CODE" }
431 -re ".* $text_section .*$gdb_prompt $" { pass "maint info sections CODE" }
8ddad156
MS
432}
433
434# Test for new option: DATA section flag
435# If your text section is tagged DATA, xfail this test.
dbdfa66c 436#
58e8570a 437# The "maint info sections DATA" test is marked for XFAIL on Windows,
dbdfa66c
CV
438# because Windows has text sections marked DATA.
439setup_xfail "*-*-*cygwin*"
58e8570a 440setup_xfail "*-*-*mingw*"
65731a6b
MS
441
442gdb_test_multiple "maint info sections DATA" "maint info sections DATA" {
293e2f9e
DJ
443 -re ".* $text_section .*$gdb_prompt $" { fail "maint info sections DATA" }
444 -re ".* $data_section .*$gdb_prompt $" { pass "maint info sections DATA" }
759f0f0b 445 -re ".* .rodata .*$gdb_prompt $" { pass "maint info sections DATA" }
8ddad156
MS
446}
447
a1dea79a
FF
448set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
449
65731a6b
MS
450gdb_test_multiple "maint info breakpoints" "maint info breakpoints" {
451 -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 $" {
452 pass "maint info breakpoints"
453 }
454 -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 $" {
455 pass "maint info breakpoints (with shlib events)"
456 }
c906108c
SS
457}
458
65731a6b
MS
459gdb_test "maint print" \
460 "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*" \
461 "maint print w/o args"
c906108c 462
65731a6b
MS
463gdb_test "maint info" \
464 "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*" \
465 "maint info w/o args"
c906108c 466
65731a6b
MS
467gdb_test "maint" \
468 "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*" \
469 "maint w/o args"
c906108c
SS
470
471set timeout $oldtimeout
472
473#============test help on maint commands
474
65731a6b 475gdb_test "help maint" \
8d324e83 476 "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 info.*maintenance internal-error.*maintenance print.*maintenance set.*maintenance show.*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\..*Command name abbreviations are allowed if unambiguous\\..*"
c906108c 477
65731a6b
MS
478gdb_test "help maint info" \
479 "Commands for showing internal info about the program being debugged.*unambiguous\\..*"
c906108c 480
d8295fe9
VP
481test_prefix_command_help {"maint print" "maintenance print"} {
482 "Maintenance command for printing GDB internal state\\.\[\r\n\]+"
483}
c906108c 484
d8295fe9
VP
485test_prefix_command_help {"maint" "maintenance"} {
486 "Commands for use by GDB maintainers\\.\[\r\n\]+"
487 "Includes commands to dump specific internal GDB structures in\[\r\n\]+"
488 "a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+"
489 "to test internal functions such as the C\\+\\+/ObjC demangler, etc\\.\[\r\n\]+"
490}
c906108c
SS
491
492#set oldtimeout $timeout
493#set timeout [expr $timeout + 300]
494
65731a6b
MS
495gdb_test_multiple "maint dump-me" "maint dump-me" {
496 -re "Should GDB dump core.*\\(y or n\\) $" {
497 gdb_test "n" ".*" "maint dump-me"
498 }
9bdd0636
YQ
499 -re "Undefined maintenance command: .*$gdb_prompt $" {
500 # Command 'maint dump-me' is registered on non-win32 host.
501 unsupported "maint dump-me"
502 }
65731a6b 503}
c906108c 504
7be570e7 505send_gdb "maint internal-error\n"
039cf96d
AC
506gdb_expect {
507 -re "A problem internal to GDB has been detected" {
508 pass "maint internal-error"
509 if [gdb_internal_error_resync] {
510 pass "internal-error resync"
511 } else {
512 fail "internal-error resync"
7be570e7
JM
513 }
514 }
515 -re ".*$gdb_prompt $" {
516 fail "maint internal-error"
039cf96d 517 untested "internal-error resync"
7be570e7
JM
518 }
519 timeout {
039cf96d
AC
520 fail "maint internal-error (timeout)"
521 untested "internal-error resync"
7be570e7
JM
522 }
523}
524
c906108c
SS
525#set timeout $oldtimeout
526
527
528gdb_exit
529return 0
This page took 1.516085 seconds and 4 git commands to generate.