import gdb-1999-08-16 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / maint.exp
CommitLineData
c906108c
SS
1# Copyright (C) 1998 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 2 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, write to the Free Software
15# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@prep.ai.mit.edu
19
20# This file was written by Elena Zannoni (ezannoni@cygnus.com)
21
22# this file tests maintenance commands and help on those.
23
24# source file used is break.c
25
26
27#maintenance check-symtabs -- Check consistency of psymtabs and symtabs
28#maintenance space -- Set the display of space usage
29#maintenance time -- Set the display of time usage
30#maintenance demangle -- Demangle a C++ mangled name
31#maintenance dump-me -- Get fatal error; make debugger dump its core
32#maintenance print -- Maintenance command for printing GDB internal state
33#maintenance info -- Commands for showing internal info about the program being debugged
7be570e7 34#maintenance internal-error -- Give GDB an internal error.
c906108c
SS
35#
36#maintenance print statistics -- Print statistics about internal gdb state
37#maintenance print objfiles -- Print dump of current object file definitions
38#maintenance print psymbols -- Print dump of current partial symbol definitions
39#maintenance print msymbols -- Print dump of current minimal symbol definitions
40#maintenance print symbols -- Print dump of current symbol definitions
41#maintenance print type -- Print a type chain for a given symbol
42#maintenance print unwind -- Print unwind table entry at given address
43#
44#
45#maintenance info sections -- List the BFD sections of the exec and core files
46#maintenance info breakpoints -- Status of all breakpoints
47#
48
49
50
51if $tracelevel then {
52 strace $tracelevel
53 }
54
55global usestubs
56
57#
58# test running programs
59#
60set prms_id 0
61set bug_id 0
62
63set testfile "break"
64set srcfile ${testfile}.c
65set binfile ${objdir}/${subdir}/${testfile}
66if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != ""
67 } {
68 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
69}
70
71
72gdb_exit
73gdb_start
74gdb_reinitialize_dir $srcdir/$subdir
75gdb_load ${binfile}
76
77if ![runto_main] then {
78 perror "tests suppressed"
79}
80
81
82# The commands we test here produce many lines of output; disable "press
83# <return> to continue" prompts.
84send_gdb "set height 0\n"
85gdb_expect -re "$gdb_prompt $"
86
87# use a larger expect input buffer for long help outputs.
88match_max 6000
89
90#
91# this command does not produce any output
92# unless there is some problem with the symtabs and psymtabs
93# so that branch will really never be covered in this tests here!!
94#
95
a0b3c4fd
JM
96# guo: on linux this command output is huge. for some reason splitting up
97# the regexp checks works.
98#
c906108c
SS
99send_gdb "maint check-symtabs\n"
100gdb_expect {
a0b3c4fd
JM
101 -re "^maint check-symtabs" {
102 gdb_expect {
103 -re "$gdb_prompt $" \
c906108c 104 { pass "maint check-symtabs" }
a0b3c4fd
JM
105 timeout { fail "(timeout) maint check-symtabs" }
106 }
107 }
c906108c
SS
108 -re ".*$gdb_prompt $" { fail "maint check-symtabs" }
109 timeout { fail "(timeout) maint check-symtabs" }
110 }
111
112send_gdb "maint space\n"
113gdb_expect {
114 -re "\"maintenance space\" takes a numeric argument\\..*$gdb_prompt $"\
115 { pass "maint space" }
116 -re ".*$gdb_prompt $" { fail "maint space" }
117 timeout { fail "(timeout) maint space" }
118 }
119
120send_gdb "maint space 1\n"
121gdb_expect {
122 -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
123 { pass "maint space 1" }
124 -re ".*$gdb_prompt $" { fail "maint space 1" }
125 timeout { fail "(timeout) maint space 1" }
126 }
127
128
129send_gdb "maint time\n"
130gdb_expect {
131 -re "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
132 { pass "maint time" }
133 -re ".*$gdb_prompt $" { fail "maint time" }
134 timeout { fail "(timeout) maint time" }
135 }
136
137send_gdb "maint time 1\n"
138gdb_expect {
139 -re "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
140 { pass "maint time 1" }
141 -re ".*$gdb_prompt $" { fail "maint time 1" }
142 timeout { fail "(timeout) maint time 1" }
143 }
144
145send_gdb "maint time 0\n"
146gdb_expect {
147 -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\
148 { pass "maint time 0" }
149 -re ".*$gdb_prompt $" { fail "maint time 0" }
150 timeout { fail "(timeout) maint time 0" }
151 }
152
153
154send_gdb "maint space 0\n"
155gdb_expect {
156 -re "maint space 0\r\n$gdb_prompt $"\
157 { pass "maint space 0" }
158 -re ".*$gdb_prompt $" { fail "maint space 0" }
159 timeout { fail "(timeout) maint space 0" }
160 }
161
162send_gdb "maint demangle\n"
163gdb_expect {
164 -re "\"maintenance demangle\" takes an argument to demangle\\..*$gdb_prompt $"\
165 { pass "maint demangle" }
166 -re ".*$gdb_prompt $" { fail "maint demangle" }
167 timeout { fail "(timeout) maint demangle" }
168 }
169
170send_gdb "maint demangle main\n"
171gdb_expect {
172 -re "Can't demangle \"main\".*$gdb_prompt $"\
173 { pass "maint demangle" }
174 -re ".*$gdb_prompt $" { fail "maint demangle" }
175 timeout { fail "(timeout) maint demangle" }
176 }
177
178
179send_gdb "maint print statistics\n"
180gdb_expect {
181 -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Total memory used for psymbol obstack.*Total memory used for psymbol cache.*Total memory used for symbol obstack.*Total memory used for type obstack.*$gdb_prompt $"\
182 { pass "maint print statistics" }
183 -re ".*$gdb_prompt $" { fail "maint print statistics" }
184 timeout { fail "(timeout) maint print statistics" }
185 }
186
187send_gdb "maint print objfiles\n"
adf40b2e 188
c906108c 189# To avoid timeouts, we avoid expects with many .* patterns that match
adf40b2e
JM
190# many lines. Instead, we keep track of which milestones we've seen
191# in the output, and stop when we've seen all of them.
192
193set header 0
194set psymtabs 0
195set symtabs 0
196set keep_looking 1
197
198while {$keep_looking} {
199 gdb_expect {
200
201 -re ".*Object file.*break: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 }
202 -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 }
203 -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 }
204
205 -re ".*$gdb_prompt $" {
206 set keep_looking 0
207 }
208 timeout {
209 fail "(timeout) maint print objfiles"
210 set keep_looking 0
211 }
212 }
c906108c 213}
adf40b2e
JM
214
215proc maint_pass_if {val name} {
216 if $val { pass $name } else { fail $name }
c906108c
SS
217}
218
adf40b2e
JM
219maint_pass_if $header "maint print objfiles: header"
220maint_pass_if $psymtabs "maint print objfiles: psymtabs"
221maint_pass_if $symtabs "maint print objfiles: symtabs"
222
c906108c
SS
223send_gdb "maint print psymbols\n"
224gdb_expect {
225 -re "print-psymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\
226 { pass "maint print psymbols w/o args" }
227 -re ".*$gdb_prompt $" { fail "maint print psymbols w/o args" }
228 timeout { fail "(timeout) maint print psymbols w/o args" }
229 }
230
231send_gdb "maint print psymbols psymbols_output\n"
232gdb_expect {
233 -re "^maint print psymbols psymbols_output\r\n$gdb_prompt $"\
234 {
235 send_gdb "shell ls psymbols_output\n"
236 gdb_expect {
237 -re "psymbols_output\r\n$gdb_prompt $"\
238 {
239 # We want this grep to be as specific as possible,
240 # so it's less likely to match symbol file names in
241 # psymbols_output. Yes, this actually happened;
242 # poor expect got tons of output, and timed out
243 # trying to match it. --- Jim Blandy <jimb@cygnus.com>
244 send_gdb "shell grep 'main.*function' psymbols_output\n"
245 gdb_expect {
246 -re ".main., function, $hex.*$gdb_prompt $"\
a0b3c4fd
JM
247 { pass "maint print psymbols 1" }
248 -re ".*main. .., function, $hex.*$gdb_prompt $"\
249 { pass "maint print psymbols 2" }
c906108c
SS
250 -re ".*$gdb_prompt $" { fail "maint print psymbols" }
251 timeout { fail "(timeout) maint print psymbols" }
252 }
253 gdb_test "shell rm -f psymbols_output" ""
254
255 }
256 -re ".*$gdb_prompt $" { fail "maint print psymbols" }
257 timeout { fail "(timeout) maint print psymbols" }
258 }
259 }
260 -re ".*$gdb_prompt $" { fail "maint print psymbols" }
261 timeout { fail "(timeout) maint print psymbols" }
262 }
263
264
265send_gdb "maint print msymbols\n"
266gdb_expect {
267 -re "print-msymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\
268 { pass "maint print msymbols w/o args" }
269 -re ".*$gdb_prompt $" { fail "maint print msymbols w/o args" }
270 timeout { fail "(timeout) maint print msymbols w/o args" }
271 }
272
273send_gdb "maint print msymbols msymbols_output\n"
274gdb_expect {
275 -re "^maint print msymbols msymbols_output\r\n$gdb_prompt $"\
276 {
277 send_gdb "shell ls msymbols_output\n"
278 gdb_expect {
279 -re "msymbols_output\r\n$gdb_prompt $"\
280 {
281 send_gdb "shell grep factorial msymbols_output\n"
282 gdb_expect {
283 -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $"\
284 { pass "maint print msymbols" }
285 -re ".*$gdb_prompt $" { fail "maint print msymbols" }
286 timeout { fail "(timeout) maint print msymbols" }
287 }
288 gdb_test "shell rm -f msymbols_output" ""
289
290 }
291 -re ".*$gdb_prompt $" { fail "maint print msymbols" }
292 timeout { fail "(timeout) maint print msymbols" }
293 }
294 }
295 -re ".*$gdb_prompt $" { fail "maint print msymbols" }
296 timeout { fail "(timeout) maint print msymbols" }
297 }
298
299
300send_gdb "maint print symbols\n"
301gdb_expect {
302 -re "Arguments missing: an output file name and an optional symbol file name.*$gdb_prompt $"\
303 { pass "maint print symbols w/o args" }
304 -re ".*$gdb_prompt $" { fail "maint print symbols w/o args" }
305 timeout { fail "(timeout) maint print symbols w/o args" }
306 }
307
adf40b2e
JM
308# This command can legitimately take many minutes to execute. If the
309# executable is dynamically linked, then you get all the debugging
310# info for the entire library --- 89Mb on my system. -jimb
311
312set old_timeout $timeout
313set timeout 600
314
c906108c
SS
315send_gdb "maint print symbols symbols_output\n"
316gdb_expect {
317 -re "^maint print symbols symbols_output\r\n$gdb_prompt $"\
318 {
319 send_gdb "shell ls symbols_output\n"
320 gdb_expect {
321 -re "symbols_output\r\n$gdb_prompt $"\
322 {
323 # See comments for `maint print psymbols'.
adf40b2e 324 send_gdb "shell grep 'main(.*block' symbols_output\n"
c906108c
SS
325 gdb_expect {
326 -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $"\
327 { pass "maint print symbols" }
328 -re ".*$gdb_prompt $" { fail "maint print symbols" }
329 timeout { fail "(timeout) maint print symbols" }
330 }
331 gdb_test "shell rm -f symbols_output" ""
332
333 }
334 -re ".*$gdb_prompt $" { fail "maint print symbols" }
335 timeout { fail "(timeout) maint print symbols" }
336 }
337 }
338 -re ".*$gdb_prompt $" { fail "maint print symbols" }
339 timeout { fail "(timeout) maint print symbols" }
340 }
341
adf40b2e 342set timeout $old_timeout
c906108c
SS
343
344send_gdb "maint print type argc\n"
345gdb_expect {
346 -re "type node $hex\r\nname .int. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength 4\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\
347 { pass "maint print type" }
348 -re ".*$gdb_prompt $" { fail "maint print type" }
349 timeout { fail "(timeout) maint print type" }
350 }
351
a0b3c4fd
JM
352if [istarget "hppa*-*-11*"] {
353 setup_xfail hppa*-*-*11* CLLbs14860
354 send "maint print unwind &main\n"
355 expect {
356 -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 $"\
357 { pass "maint print unwind" }
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 -re ".*$gdb_prompt $" { xfail "maint info unwind" }
361 timeout { fail "(timeout) maint print unwind" }
362 }
363}
c906108c
SS
364
365set oldtimeout $timeout
366set timeout [expr $timeout + 300]
367
368# It'd be nice to check for every possible section. However, that's
369# problematic, since the relative ordering wanders from release to
370# release of the compilers. Instead, we'll just check for two
371# sections which appear to always come out in the same relative
372# order. (If that changes, then we should just check for one
373# section.)
374#
375# And by the way: This testpoint will break for PA64, where a.out's
376# are ELF files.
377#
378send_gdb "maint info sections\n"
379gdb_expect {
380 -re "Exec file:\r\n.*break., file type.*$gdb_prompt $"\
381 { pass "maint info sections" }
382 -re ".*$gdb_prompt $" { fail "maint info sections" }
383 timeout { fail "(timeout) maint info sections" }
384 }
385
386send_gdb "maint info breakpoints\n"
387gdb_expect {
a0b3c4fd 388 -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:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\
c906108c
SS
389 { pass "maint info breakpoints" }
390 -re ".*$gdb_prompt $" { fail "maint info breakpoints" }
391 timeout { fail "(timeout) maint info breakpoints" }
392}
393
394# Try it again, and check for shlib event info. Not supported everywhere.
adf40b2e
JM
395if {! ([istarget "hppa*-*-hpux*"]
396 || [istarget "*-*-linux*"]
397 || [istarget "*-*-solaris*"])} then {
c906108c
SS
398 setup_xfail "*-*-*"
399}
400send_gdb "maint info breakpoints\n"
401gdb_expect {
a0b3c4fd
JM
402 -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:75\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\
403 { pass "maint info breakpoints" }
404 -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:75\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 $"\
c906108c
SS
405 { pass "maint info breakpoints: shlib events" }
406 -re ".*$gdb_prompt $" {
407 fail "maint info breakpoints: shlib events"
408 }
409 timeout {
410 fail "(timeout) maint info breakpoints: shlib events"
411 }
412}
413
414
415send_gdb "maint print\n"
416gdb_expect {
417 -re "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\
418 { pass "maint print w/o args" }
419 -re ".*$gdb_prompt $" { fail "maint print w/o args" }
420 timeout { fail "(timeout) maint print w/o args" }
421 }
422
423send_gdb "maint info\n"
424gdb_expect {
425 -re "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\
426 { pass "maint info w/o args" }
427 -re ".*$gdb_prompt $" { fail "maint info w/o args" }
428 timeout { fail "(timeout) maint info w/o args" }
429 }
430
431send_gdb "maint\n"
432gdb_expect {
433 -re "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\
434 { pass "maint w/o args" }
435 -re ".*$gdb_prompt $" { fail "maint w/o args" }
436 timeout { fail "(timeout) maint w/o args" }
437 }
438
439
440set timeout $oldtimeout
441
442#============test help on maint commands
443
444send_gdb "help maint\n"
445gdb_expect {
7be570e7 446 -re "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.. demangler, etc\\..*List of maintenance subcommands:.*maintenance check-symtabs.*maintenance demangle.*maintenance dump-me.*maintenance info.*maintenance internal-error.*maintenance print.*maintenance space.*maintenance time.*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\..*Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
c906108c
SS
447 { pass "help maint" }
448 -re ".*$gdb_prompt $" { fail "help maint" }
449 timeout { fail "(timeout) help maint" }
450 }
451
452
453send_gdb "help maint check-symtabs\n"
454gdb_expect {
455 -re "Check consistency of psymtabs and symtabs\\..*$gdb_prompt $"\
456 { pass "help maint check-symtabs" }
457 -re ".*$gdb_prompt $" { fail "help maint check-symtabs" }
458 timeout { fail "(timeout) help maint check-symtabs" }
459 }
460
461send_gdb "help maint space\n"
462gdb_expect {
463 -re "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\\..*$gdb_prompt $"\
464 { pass "help maint space" }
465 -re ".*$gdb_prompt $" { fail "help maint space" }
466 timeout { fail "(timeout) help maint space" }
467 }
468
469send_gdb "help maint time\n"
470gdb_expect {
471 -re "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\\..*$gdb_prompt $"\
472 { pass "help maint time" }
473 -re ".*$gdb_prompt $" { fail "help maint time" }
474 timeout { fail "(timeout) help maint time" }
475 }
476
477send_gdb "help maint demangle\n"
478gdb_expect {
479 -re "Demangle a C\\+\\+ mangled name\\.\r\nCall internal GDB demangler routine to demangle a C\\+\\+ link name\r\nand prints the result\\..*$gdb_prompt $"\
480 { pass "help maint demangle" }
481 -re ".*$gdb_prompt $" { fail "help maint demangle" }
482 timeout { fail "(timeout) help maint demangle" }
483 }
484
485send_gdb "help maint dump-me\n"
486gdb_expect {
487 -re "Get fatal error; make debugger dump its core\\.\r\nGDB sets it's handling of SIGQUIT back to SIG_DFL and then sends\r\nitself a SIGQUIT signal\\..*$gdb_prompt $"\
488 { pass "help maint dump-me" }
489 -re ".*$gdb_prompt $" { fail "help maint dump-me" }
490 timeout { fail "(timeout) help maint dump-me" }
491 }
492
7be570e7
JM
493send_gdb "help maint internal-error\n"
494gdb_expect {
495 -re "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*$gdb_prompt $"\
496 { pass "help maint internal-error" }
497 -re ".*$gdb_prompt $" { fail "help maint internal-error" }
498 timeout { fail "(timeout) help maint internal-error" }
499 }
500
c906108c
SS
501send_gdb "help maint print statistics\n"
502gdb_expect {
503 -re "Print statistics about internal gdb state\\..*$gdb_prompt $"\
504 { pass "help maint print statistics" }
505 -re ".*$gdb_prompt $" { fail "help maint print statistics" }
506 timeout { fail "(timeout) help maint print statistics" }
507 }
508
509send_gdb "help maint print objfiles\n"
510gdb_expect {
511 -re "Print dump of current object file definitions\\..*$gdb_prompt $"\
512 { pass "help maint print objfiles" }
513 -re ".*$gdb_prompt $" { fail "help maint print objfiles" }
514 timeout { fail "(timeout) help maint print objfiles" }
515 }
516
517send_gdb "help maint print psymbols\n"
518gdb_expect {
519 -re "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\\..*$gdb_prompt $"\
520 { pass "help maint print psymbols" }
521 -re ".*$gdb_prompt $" { fail "help maint print psymbols" }
522 timeout { fail "(timeout) help maint print psymbols" }
523 }
524
525send_gdb "help maint print msymbols\n"
526gdb_expect {
527 -re "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\\..*$gdb_prompt $"\
528 { pass "help maint print msymbols" }
529 -re ".*$gdb_prompt $" { fail "help maint print msymbols" }
530 timeout { fail "(timeout) help maint print msymbols" }
531 }
532
533send_gdb "help maint print symbols\n"
534gdb_expect {
535 -re "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\\..*$gdb_prompt $"\
536 { pass "help maint print symbols" }
537 -re ".*$gdb_prompt $" { fail "help maint print symbols" }
538 timeout { fail "(timeout) help maint print symbols" }
539 }
540
541
542send_gdb "help maint print type\n"
543gdb_expect {
544 -re "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\\..*$gdb_prompt $"\
545 { pass "help maint print type" }
546 -re ".*$gdb_prompt $" { fail "help maint print type" }
547 timeout { fail "(timeout) help maint print type" }
548 }
549
a0b3c4fd
JM
550if [istarget "hppa*-*-*"] {
551 send_gdb "help maint print unwind\n"
552 gdb_expect {
553 -re "Print unwind table entry at given address\\..*$gdb_prompt $"\
554 { pass "help maint print unwind" }
555 -re ".*$gdb_prompt $" { fail "help maint print unwind" }
556 timeout { fail "(timeout) help maint print unwind" }
557 }
558}
c906108c
SS
559
560send_gdb "help maint info sections\n"
561gdb_expect {
562 -re "List the BFD sections of the exec and core files\\..*$gdb_prompt $"\
563 { pass "help maint info sections" }
564 -re ".*$gdb_prompt $" { fail "help maint info sections" }
565 timeout { fail "(timeout) help maint info sections" }
566 }
567
568
569send_gdb "help maint info breakpoints\n"
570gdb_expect {
571-re "Status of all breakpoints, or breakpoint number NUMBER.*$gdb_prompt $" { pass "help maint info breakpoints" }
572 -re ".*$gdb_prompt $" { fail "help maint info breakpoints" }
573 timeout { fail "(timeout) help maint info breakpoints" }
574 }
575
576#send_gdb "help maint info breakpoints\n"
577#expect {
578# -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 $"\
579# { pass "help maint info breakpoints" }
580# -re ".*$gdb_prompt $" { fail "help maint info breakpoints" }
581# timeout { fail "(timeout) help maint info breakpoints" }
582# }
583
584send_gdb "help maint info\n"
585gdb_expect {
586 -re "Commands for showing internal info about the program being debugged.*unambiguous\\..*$gdb_prompt $"\
587 { pass "help maint info" }
588 -re ".*$gdb_prompt $" { fail "help maint info" }
589 timeout { fail "(timeout) help maint info" }
590 }
591
592send_gdb "help maint print\n"
593gdb_expect {
594 -re "Maintenance command for printing GDB internal state\\.\[\r\n\]+List of maintenance print subcommands:\[\r\n\]+maintenance print msymbols -- Print dump of current minimal symbol definitions.*maintenance print objfiles -- Print dump of current object file definitions.*maintenance print psymbols -- Print dump of current partial symbol definitions.*maintenance print statistics -- Print statistics about internal gdb state.*maintenance print symbols -- Print dump of current symbol definitions.*maintenance print type -- Print a type chain for a given symbol.*Type .help maintenance print. followed by maintenance print subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
595 { pass "help maint print" }
596 -re ".*$gdb_prompt $" { fail "help maint print" }
597 timeout { fail "(timeout) help maint print" }
598 }
599
600send_gdb "help maint\n"
601gdb_expect {
602 -re "Commands for use by GDB maintainers\\.\[\r\n\]+Includes commands to dump specific internal GDB structures in\[\r\n\]+a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+to test internal functions such as the C\\+\\+ demangler, etc\\..*Type.*help maintenance.*followed by maintenance subcommand name for full documentation\\.\[\r\n\]+Command name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\
603 { pass "help maint" }
604 -re ".*$gdb_prompt $" { fail "help maint" }
605 timeout { fail "(timeout) help maint" }
606 }
607
608#set oldtimeout $timeout
609#set timeout [expr $timeout + 300]
610
611send_gdb "maint dump-me\n"
612gdb_expect {
613 -re "Should GDB dump core.*\\(y or n\\) $"\
614 { send_gdb "n\n"
615 gdb_expect {
616 -re ".*$gdb_prompt $" { pass "maint dump-me" }
617 timeout { fail "(timeout) maint dump-me" }
618 }
619 }
620 -re ".*$gdb_prompt $" { fail "maint dump-me" }
621 timeout { fail "(timeout) maint dump-me" }
622 }
623
7be570e7
JM
624send_gdb "maint internal-error\n"
625gdb_expect {
626 -re "Continue this debugging session.*\\(y or n\\) $" {
627 send_gdb "y\n"
628 gdb_expect {
629 -re "Create a core file.*\\(y or n\\) $" {
630 send_gdb "n\n"
631 gdb_expect {
632 -re ".*$gdb_prompt $" {
633 pass "maint internal-error"
634 }
635 timeout {
636 fail "(timeout) maint internal-error"
637 }
638 }
639 }
640 -re ".*$gdb_prompt $" {
641 fail "maint internal-error"
642 }
643 timeout {
644 fail "(timeout) maint internal-error"
645 }
646 }
647 }
648 -re ".*$gdb_prompt $" {
649 fail "maint internal-error"
650 }
651 timeout {
652 fail "(timeout) maint internal-error"
653 }
654}
655
c906108c
SS
656#set timeout $oldtimeout
657
658
659gdb_exit
660return 0
This page took 0.067766 seconds and 4 git commands to generate.