OSDN Git Service

Update/correct copyright notices.
[pf3gnuchains/pf3gnuchains4x.git] / gdb / testsuite / gdb.base / maint.exp
1 # Copyright 1998, 1999, 2000 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
34 #maintenance internal-error -- Give GDB an internal error.
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
51 if $tracelevel then {
52         strace $tracelevel
53         }
54
55 global usestubs
56
57 #
58 # test running programs
59 #
60 set prms_id 0
61 set bug_id 0
62
63 set testfile "break"
64 set srcfile ${testfile}.c
65 set binfile ${objdir}/${subdir}/${testfile}
66 if  { [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
72 gdb_exit
73 gdb_start
74 gdb_reinitialize_dir $srcdir/$subdir
75 gdb_load ${binfile}
76
77 if ![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.
84 send_gdb "set height 0\n"
85 gdb_expect -re "$gdb_prompt $"
86
87 # use a larger expect input buffer for long help outputs.
88 match_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
96 # guo: on linux this command output is huge.  for some reason splitting up
97 # the regexp checks works.
98 #
99 send_gdb "maint check-symtabs\n"
100 gdb_expect  {
101         -re "^maint check-symtabs" {
102             gdb_expect {
103                 -re "$gdb_prompt $" \
104                           { pass "maint check-symtabs" }
105                 timeout { fail "(timeout) maint check-symtabs" }
106             }
107         }
108         -re ".*$gdb_prompt $"       { fail "maint check-symtabs" }
109         timeout         { fail "(timeout) maint check-symtabs" }
110         }
111
112 send_gdb "maint space\n"
113 gdb_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
120 send_gdb "maint space 1\n"
121 gdb_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
129 send_gdb "maint time\n"
130 gdb_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
137 send_gdb "maint time 1\n"
138 gdb_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
145 send_gdb "maint time 0\n"
146 gdb_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
154 send_gdb "maint space 0\n"
155 gdb_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
162 send_gdb "maint demangle\n"
163 gdb_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
170 send_gdb "maint demangle main\n"
171 gdb_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
179 send_gdb "maint print statistics\n"
180 gdb_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
187 send_gdb "maint print objfiles\n"
188
189 # To avoid timeouts, we avoid expects with many .* patterns that match
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
193 set header 0
194 set psymtabs 0
195 set symtabs 0
196 set keep_looking 1
197
198 while {$keep_looking} {
199     gdb_expect  {
200
201         -re ".*Object file.*break$EXEEXT:  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     }
213 }
214
215 proc maint_pass_if {val name} {
216     if $val { pass $name } else { fail $name }
217 }
218
219 maint_pass_if $header   "maint print objfiles: header"
220 maint_pass_if $psymtabs "maint print objfiles: psymtabs"
221 maint_pass_if $symtabs  "maint print objfiles: symtabs"
222
223 send_gdb "maint print psymbols\n"
224 gdb_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
231 send_gdb "maint print psymbols psymbols_output\n"
232 gdb_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 $"\
247                                                { pass "maint print psymbols 1" }
248                         -re ".*main.  .., function, $hex.*$gdb_prompt $"\
249                                                { pass "maint print psymbols 2" }
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
265 send_gdb  "maint print msymbols\n"
266 gdb_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
273 send_gdb "maint print msymbols msymbols_output\n"
274 gdb_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
300 send_gdb "maint print symbols\n"
301 gdb_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
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
312 set old_timeout $timeout
313 set timeout 600
314
315 send_gdb "maint print symbols symbols_output\n"
316 gdb_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'.
324                   send_gdb "shell grep 'main(.*block' symbols_output\n"
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
342 set timeout $old_timeout
343
344 send_gdb "maint print type argc\n"
345 gdb_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
352 if [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 }
364
365 set oldtimeout $timeout
366 set 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 #
378 send_gdb "maint info sections\n"
379 gdb_expect  {
380         -re "Exec file:\r\n.*break$EXEEXT., 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
386 send_gdb "maint info breakpoints\n"
387 gdb_expect {
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 $"\
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.
395 if {! ([istarget "hppa*-*-hpux*"] 
396        || [istarget "*-*-linux*"]
397        || [istarget "*-*-solaris*"])} then {
398     setup_xfail "*-*-*"
399 }
400 send_gdb "maint info breakpoints\n"
401 gdb_expect  {
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 $"\
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
415 send_gdb "maint print\n"
416 gdb_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
423 send_gdb "maint info\n"
424 gdb_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
431 send_gdb "maint\n"
432 gdb_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
440 set timeout $oldtimeout
441
442 #============test help on maint commands
443
444 send_gdb "help maint\n"
445 gdb_expect  {
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 $"\
447  { pass "help maint" }
448         -re ".*$gdb_prompt $"       { fail "help maint" }
449         timeout         { fail "(timeout) help maint" }
450         }
451
452
453 send_gdb "help maint check-symtabs\n"
454 gdb_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
461 send_gdb "help maint space\n"
462 gdb_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
469 send_gdb "help maint time\n"
470 gdb_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
477 send_gdb "help maint demangle\n"
478 gdb_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
485 # dump-me is disabled ifdef _WIN32.
486 if [ishost *cygwin*] {
487     setup_xfail "*-*-*"
488 }
489 send_gdb "help maint dump-me\n"
490 gdb_expect  {
491         -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 $"\
492                         { pass "help maint dump-me" }
493         -re ".*$gdb_prompt $"       { fail "help maint dump-me" }
494         timeout         { fail "(timeout) help maint dump-me" }
495         }
496
497 send_gdb "help maint internal-error\n"
498 gdb_expect  {
499         -re "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*$gdb_prompt $"\
500                         { pass "help maint internal-error" }
501         -re ".*$gdb_prompt $"       { fail "help maint internal-error" }
502         timeout         { fail "(timeout) help maint internal-error" }
503         }
504
505 send_gdb "help maint print statistics\n"
506 gdb_expect  {
507         -re "Print statistics about internal gdb state\\..*$gdb_prompt $"\
508                         { pass "help maint print statistics" }
509         -re ".*$gdb_prompt $"       { fail "help maint print statistics" }
510         timeout         { fail "(timeout) help maint print statistics" }
511         }
512
513 send_gdb "help maint print objfiles\n"
514 gdb_expect  {
515         -re "Print dump of current object file definitions\\..*$gdb_prompt $"\
516                         { pass "help maint print objfiles" }
517         -re ".*$gdb_prompt $"       { fail "help maint print objfiles" }
518         timeout         { fail "(timeout) help maint print objfiles" }
519         }
520
521 send_gdb "help maint print psymbols\n"
522 gdb_expect  {
523         -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 $"\
524                         { pass "help maint print psymbols" }
525         -re ".*$gdb_prompt $"       { fail "help maint print psymbols" }
526         timeout         { fail "(timeout) help maint print psymbols" }
527         }
528
529 send_gdb "help maint print msymbols\n"
530 gdb_expect  {
531         -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 $"\
532                         { pass "help maint print msymbols" }
533         -re ".*$gdb_prompt $"       { fail "help maint print msymbols" }
534         timeout         { fail "(timeout) help maint print msymbols" }
535         }
536
537 send_gdb "help maint print symbols\n"
538 gdb_expect  {
539         -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 $"\
540                         { pass "help maint print symbols" }
541         -re ".*$gdb_prompt $"       { fail "help maint print symbols" }
542         timeout         { fail "(timeout) help maint print symbols" }
543         }
544
545
546 send_gdb "help maint print type\n"
547 gdb_expect  {
548         -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 $"\
549                         { pass "help maint print type" }
550         -re ".*$gdb_prompt $"       { fail "help maint print type" }
551         timeout         { fail "(timeout) help maint print type" }
552         }
553
554 if [istarget "hppa*-*-*"] {
555     send_gdb "help maint print unwind\n"
556     gdb_expect  {
557         -re "Print unwind table entry at given address\\..*$gdb_prompt $"\
558             { pass "help maint print unwind" }
559         -re ".*$gdb_prompt $"       { fail "help maint print unwind" }
560         timeout         { fail "(timeout) help maint print unwind" }
561     }
562 }
563
564 send_gdb "help maint info sections\n"
565 gdb_expect  {
566         -re "List the BFD sections of the exec and core files\\..*$gdb_prompt $"\
567                         { pass "help maint info sections" }
568         -re ".*$gdb_prompt $"       { fail "help maint info sections" }
569         timeout         { fail "(timeout) help maint info sections" }
570         }
571
572
573 send_gdb "help maint info breakpoints\n"
574 gdb_expect  {
575 -re "Status of all breakpoints, or breakpoint number NUMBER.*$gdb_prompt $" { pass "help maint info breakpoints" }
576         -re ".*$gdb_prompt $"       { fail "help maint info breakpoints" }
577         timeout         { fail "(timeout) help maint info breakpoints" }
578         }
579
580 #send_gdb "help maint info breakpoints\n"
581 #expect  {
582 #        -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 $"\
583 #                        { pass "help maint info breakpoints" }
584 #        -re ".*$gdb_prompt $"       { fail "help maint info breakpoints" }
585 #        timeout         { fail "(timeout) help maint info breakpoints" }
586 #        }
587
588 send_gdb "help maint info\n"
589 gdb_expect  {
590         -re "Commands for showing internal info about the program being debugged.*unambiguous\\..*$gdb_prompt $"\
591                         { pass "help maint info" }
592         -re ".*$gdb_prompt $"       { fail "help maint info" }
593         timeout         { fail "(timeout) help maint info" }
594         }
595
596 send_gdb "help maint print\n"
597 gdb_expect  {
598         -re "Maintenance command for printing GDB internal state\\.\[\r\n\]+List of maintenance print subcommands:\[\r\n\]+maintenance print architecture -- Print the internal architecture configuration.*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 $"\
599                         { pass "help maint print" }
600         -re ".*$gdb_prompt $"       { fail "help maint print" }
601         timeout         { fail "(timeout) help maint print" }
602         }
603
604 send_gdb "help maint\n"
605 gdb_expect  {
606         -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 $"\
607                         { pass "help maint" }
608         -re ".*$gdb_prompt $"       { fail "help maint" }
609         timeout         { fail "(timeout) help maint" }
610         }
611
612 #set oldtimeout $timeout
613 #set timeout [expr $timeout + 300]
614
615 if [ishost *cygwin*] {
616     setup_xfail "*-*-*"
617 }
618 send_gdb "maint dump-me\n"
619 gdb_expect  {
620         -re "Should GDB dump core.*\\(y or n\\) $"\
621           { send_gdb "n\n"
622             gdb_expect {
623                     -re ".*$gdb_prompt $"       { pass "maint dump-me" }
624                     timeout         { fail "(timeout)  maint dump-me" }
625                    }
626           }
627         -re ".*$gdb_prompt $"       { fail "maint dump-me" }
628         timeout         { fail "(timeout) maint dump-me" }
629         }
630
631 send_gdb "maint internal-error\n"
632 gdb_expect  {
633     -re "Continue this debugging session.*\\(y or n\\) $" {
634         send_gdb "y\n"
635         gdb_expect {
636             -re "Create a core file.*\\(y or n\\) $" {
637                 send_gdb "n\n"
638                 gdb_expect {
639                     -re ".*$gdb_prompt $" {
640                         pass "maint internal-error"
641                     }
642                     timeout {
643                         fail "(timeout)  maint internal-error"
644                     }
645                 }
646             }
647             -re ".*$gdb_prompt $" {
648                 fail "maint internal-error"
649             }
650             timeout {
651                 fail "(timeout)  maint internal-error"
652             }
653         }
654     }
655     -re ".*$gdb_prompt $" {
656         fail "maint internal-error"
657     }
658     timeout {
659         fail "(timeout) maint internal-error"
660     }
661 }
662
663 #set timeout $oldtimeout
664
665
666 gdb_exit
667 return 0