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