Commit | Line | Data |
---|---|---|
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 | |
34 | # | |
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 | ||
50 | if $tracelevel then { | |
51 | strace $tracelevel | |
52 | } | |
53 | ||
54 | global usestubs | |
55 | ||
56 | # | |
57 | # test running programs | |
58 | # | |
59 | set prms_id 0 | |
60 | set bug_id 0 | |
61 | ||
62 | set testfile "break" | |
63 | set srcfile ${testfile}.c | |
64 | set binfile ${objdir}/${subdir}/${testfile} | |
65 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" | |
66 | } { | |
67 | gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." | |
68 | } | |
69 | ||
70 | ||
71 | gdb_exit | |
72 | gdb_start | |
73 | gdb_reinitialize_dir $srcdir/$subdir | |
74 | gdb_load ${binfile} | |
75 | ||
76 | if ![runto_main] then { | |
77 | perror "tests suppressed" | |
78 | } | |
79 | ||
80 | ||
81 | # The commands we test here produce many lines of output; disable "press | |
82 | # <return> to continue" prompts. | |
83 | send_gdb "set height 0\n" | |
84 | gdb_expect -re "$gdb_prompt $" | |
85 | ||
86 | # use a larger expect input buffer for long help outputs. | |
87 | match_max 6000 | |
88 | ||
89 | # | |
90 | # this command does not produce any output | |
91 | # unless there is some problem with the symtabs and psymtabs | |
92 | # so that branch will really never be covered in this tests here!! | |
93 | # | |
94 | ||
95 | send_gdb "maint check-symtabs\n" | |
96 | gdb_expect { | |
97 | -re "^maint check-symtabs.*$gdb_prompt $"\ | |
98 | { pass "maint check-symtabs" } | |
99 | -re ".*$gdb_prompt $" { fail "maint check-symtabs" } | |
100 | timeout { fail "(timeout) maint check-symtabs" } | |
101 | } | |
102 | ||
103 | send_gdb "maint space\n" | |
104 | gdb_expect { | |
105 | -re "\"maintenance space\" takes a numeric argument\\..*$gdb_prompt $"\ | |
106 | { pass "maint space" } | |
107 | -re ".*$gdb_prompt $" { fail "maint space" } | |
108 | timeout { fail "(timeout) maint space" } | |
109 | } | |
110 | ||
111 | send_gdb "maint space 1\n" | |
112 | gdb_expect { | |
113 | -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
114 | { pass "maint space 1" } | |
115 | -re ".*$gdb_prompt $" { fail "maint space 1" } | |
116 | timeout { fail "(timeout) maint space 1" } | |
117 | } | |
118 | ||
119 | ||
120 | send_gdb "maint time\n" | |
121 | gdb_expect { | |
122 | -re "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
123 | { pass "maint time" } | |
124 | -re ".*$gdb_prompt $" { fail "maint time" } | |
125 | timeout { fail "(timeout) maint time" } | |
126 | } | |
127 | ||
128 | send_gdb "maint time 1\n" | |
129 | gdb_expect { | |
130 | -re "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
131 | { pass "maint time 1" } | |
132 | -re ".*$gdb_prompt $" { fail "maint time 1" } | |
133 | timeout { fail "(timeout) maint time 1" } | |
134 | } | |
135 | ||
136 | send_gdb "maint time 0\n" | |
137 | gdb_expect { | |
138 | -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
139 | { pass "maint time 0" } | |
140 | -re ".*$gdb_prompt $" { fail "maint time 0" } | |
141 | timeout { fail "(timeout) maint time 0" } | |
142 | } | |
143 | ||
144 | ||
145 | send_gdb "maint space 0\n" | |
146 | gdb_expect { | |
147 | -re "maint space 0\r\n$gdb_prompt $"\ | |
148 | { pass "maint space 0" } | |
149 | -re ".*$gdb_prompt $" { fail "maint space 0" } | |
150 | timeout { fail "(timeout) maint space 0" } | |
151 | } | |
152 | ||
153 | send_gdb "maint demangle\n" | |
154 | gdb_expect { | |
155 | -re "\"maintenance demangle\" takes an argument to demangle\\..*$gdb_prompt $"\ | |
156 | { pass "maint demangle" } | |
157 | -re ".*$gdb_prompt $" { fail "maint demangle" } | |
158 | timeout { fail "(timeout) maint demangle" } | |
159 | } | |
160 | ||
161 | send_gdb "maint demangle main\n" | |
162 | gdb_expect { | |
163 | -re "Can't demangle \"main\".*$gdb_prompt $"\ | |
164 | { pass "maint demangle" } | |
165 | -re ".*$gdb_prompt $" { fail "maint demangle" } | |
166 | timeout { fail "(timeout) maint demangle" } | |
167 | } | |
168 | ||
169 | ||
170 | send_gdb "maint print statistics\n" | |
171 | gdb_expect { | |
172 | -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 $"\ | |
173 | { pass "maint print statistics" } | |
174 | -re ".*$gdb_prompt $" { fail "maint print statistics" } | |
175 | timeout { fail "(timeout) maint print statistics" } | |
176 | } | |
177 | ||
178 | send_gdb "maint print objfiles\n" | |
adf40b2e | 179 | |
c906108c | 180 | # To avoid timeouts, we avoid expects with many .* patterns that match |
adf40b2e JM |
181 | # many lines. Instead, we keep track of which milestones we've seen |
182 | # in the output, and stop when we've seen all of them. | |
183 | ||
184 | set header 0 | |
185 | set psymtabs 0 | |
186 | set symtabs 0 | |
187 | set keep_looking 1 | |
188 | ||
189 | while {$keep_looking} { | |
190 | gdb_expect { | |
191 | ||
192 | -re ".*Object file.*break: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 } | |
193 | -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 } | |
194 | -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 } | |
195 | ||
196 | -re ".*$gdb_prompt $" { | |
197 | set keep_looking 0 | |
198 | } | |
199 | timeout { | |
200 | fail "(timeout) maint print objfiles" | |
201 | set keep_looking 0 | |
202 | } | |
203 | } | |
c906108c | 204 | } |
adf40b2e JM |
205 | |
206 | proc maint_pass_if {val name} { | |
207 | if $val { pass $name } else { fail $name } | |
c906108c SS |
208 | } |
209 | ||
adf40b2e JM |
210 | maint_pass_if $header "maint print objfiles: header" |
211 | maint_pass_if $psymtabs "maint print objfiles: psymtabs" | |
212 | maint_pass_if $symtabs "maint print objfiles: symtabs" | |
213 | ||
c906108c SS |
214 | send_gdb "maint print psymbols\n" |
215 | gdb_expect { | |
216 | -re "print-psymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ | |
217 | { pass "maint print psymbols w/o args" } | |
218 | -re ".*$gdb_prompt $" { fail "maint print psymbols w/o args" } | |
219 | timeout { fail "(timeout) maint print psymbols w/o args" } | |
220 | } | |
221 | ||
222 | send_gdb "maint print psymbols psymbols_output\n" | |
223 | gdb_expect { | |
224 | -re "^maint print psymbols psymbols_output\r\n$gdb_prompt $"\ | |
225 | { | |
226 | send_gdb "shell ls psymbols_output\n" | |
227 | gdb_expect { | |
228 | -re "psymbols_output\r\n$gdb_prompt $"\ | |
229 | { | |
230 | # We want this grep to be as specific as possible, | |
231 | # so it's less likely to match symbol file names in | |
232 | # psymbols_output. Yes, this actually happened; | |
233 | # poor expect got tons of output, and timed out | |
234 | # trying to match it. --- Jim Blandy <jimb@cygnus.com> | |
235 | send_gdb "shell grep 'main.*function' psymbols_output\n" | |
236 | gdb_expect { | |
237 | -re ".main., function, $hex.*$gdb_prompt $"\ | |
238 | { pass "maint print psymbols" } | |
239 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
240 | timeout { fail "(timeout) maint print psymbols" } | |
241 | } | |
242 | gdb_test "shell rm -f psymbols_output" "" | |
243 | ||
244 | } | |
245 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
246 | timeout { fail "(timeout) maint print psymbols" } | |
247 | } | |
248 | } | |
249 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
250 | timeout { fail "(timeout) maint print psymbols" } | |
251 | } | |
252 | ||
253 | ||
254 | send_gdb "maint print msymbols\n" | |
255 | gdb_expect { | |
256 | -re "print-msymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ | |
257 | { pass "maint print msymbols w/o args" } | |
258 | -re ".*$gdb_prompt $" { fail "maint print msymbols w/o args" } | |
259 | timeout { fail "(timeout) maint print msymbols w/o args" } | |
260 | } | |
261 | ||
262 | send_gdb "maint print msymbols msymbols_output\n" | |
263 | gdb_expect { | |
264 | -re "^maint print msymbols msymbols_output\r\n$gdb_prompt $"\ | |
265 | { | |
266 | send_gdb "shell ls msymbols_output\n" | |
267 | gdb_expect { | |
268 | -re "msymbols_output\r\n$gdb_prompt $"\ | |
269 | { | |
270 | send_gdb "shell grep factorial msymbols_output\n" | |
271 | gdb_expect { | |
272 | -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $"\ | |
273 | { pass "maint print msymbols" } | |
274 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
275 | timeout { fail "(timeout) maint print msymbols" } | |
276 | } | |
277 | gdb_test "shell rm -f msymbols_output" "" | |
278 | ||
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 | } | |
287 | ||
288 | ||
289 | send_gdb "maint print symbols\n" | |
290 | gdb_expect { | |
291 | -re "Arguments missing: an output file name and an optional symbol file name.*$gdb_prompt $"\ | |
292 | { pass "maint print symbols w/o args" } | |
293 | -re ".*$gdb_prompt $" { fail "maint print symbols w/o args" } | |
294 | timeout { fail "(timeout) maint print symbols w/o args" } | |
295 | } | |
296 | ||
adf40b2e JM |
297 | # This command can legitimately take many minutes to execute. If the |
298 | # executable is dynamically linked, then you get all the debugging | |
299 | # info for the entire library --- 89Mb on my system. -jimb | |
300 | ||
301 | set old_timeout $timeout | |
302 | set timeout 600 | |
303 | ||
c906108c SS |
304 | send_gdb "maint print symbols symbols_output\n" |
305 | gdb_expect { | |
306 | -re "^maint print symbols symbols_output\r\n$gdb_prompt $"\ | |
307 | { | |
308 | send_gdb "shell ls symbols_output\n" | |
309 | gdb_expect { | |
310 | -re "symbols_output\r\n$gdb_prompt $"\ | |
311 | { | |
312 | # See comments for `maint print psymbols'. | |
adf40b2e | 313 | send_gdb "shell grep 'main(.*block' symbols_output\n" |
c906108c SS |
314 | gdb_expect { |
315 | -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $"\ | |
316 | { pass "maint print symbols" } | |
317 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
318 | timeout { fail "(timeout) maint print symbols" } | |
319 | } | |
320 | gdb_test "shell rm -f symbols_output" "" | |
321 | ||
322 | } | |
323 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
324 | timeout { fail "(timeout) maint print symbols" } | |
325 | } | |
326 | } | |
327 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
328 | timeout { fail "(timeout) maint print symbols" } | |
329 | } | |
330 | ||
adf40b2e | 331 | set timeout $old_timeout |
c906108c SS |
332 | |
333 | send_gdb "maint print type argc\n" | |
334 | gdb_expect { | |
335 | -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 $"\ | |
336 | { pass "maint print type" } | |
337 | -re ".*$gdb_prompt $" { fail "maint print type" } | |
338 | timeout { fail "(timeout) maint print type" } | |
339 | } | |
340 | ||
341 | #send_gdb "maint print unwind &main\n" | |
342 | #gdb_expect { | |
343 | # -re ".*unwind_table_entry \\($hex\\):\r\n\tregion_start = $hex <main>\r\n\tregion_end = $hex <main\\+220>\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 $"\ | |
344 | # { pass "maint print unwind" } | |
345 | # -re ".*$gdb_prompt $" { fail "maint print unwind" } | |
346 | # timeout { fail "(timeout) maint print unwind" } | |
347 | # } | |
348 | ||
349 | set oldtimeout $timeout | |
350 | set timeout [expr $timeout + 300] | |
351 | ||
352 | # It'd be nice to check for every possible section. However, that's | |
353 | # problematic, since the relative ordering wanders from release to | |
354 | # release of the compilers. Instead, we'll just check for two | |
355 | # sections which appear to always come out in the same relative | |
356 | # order. (If that changes, then we should just check for one | |
357 | # section.) | |
358 | # | |
359 | # And by the way: This testpoint will break for PA64, where a.out's | |
360 | # are ELF files. | |
361 | # | |
362 | send_gdb "maint info sections\n" | |
363 | gdb_expect { | |
364 | -re "Exec file:\r\n.*break., file type.*$gdb_prompt $"\ | |
365 | { pass "maint info sections" } | |
366 | -re ".*$gdb_prompt $" { fail "maint info sections" } | |
367 | timeout { fail "(timeout) maint info sections" } | |
368 | } | |
369 | ||
370 | send_gdb "maint info breakpoints\n" | |
371 | gdb_expect { | |
372 | -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:60\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $"\ | |
373 | { pass "maint info breakpoints" } | |
374 | -re ".*$gdb_prompt $" { fail "maint info breakpoints" } | |
375 | timeout { fail "(timeout) maint info breakpoints" } | |
376 | } | |
377 | ||
378 | # Try it again, and check for shlib event info. Not supported everywhere. | |
adf40b2e JM |
379 | if {! ([istarget "hppa*-*-hpux*"] |
380 | || [istarget "*-*-linux*"] | |
381 | || [istarget "*-*-solaris*"])} then { | |
c906108c SS |
382 | setup_xfail "*-*-*" |
383 | } | |
384 | send_gdb "maint info breakpoints\n" | |
385 | gdb_expect { | |
386 | -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:60\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 $"\ | |
387 | { pass "maint info breakpoints: shlib events" } | |
388 | -re ".*$gdb_prompt $" { | |
389 | fail "maint info breakpoints: shlib events" | |
390 | } | |
391 | timeout { | |
392 | fail "(timeout) maint info breakpoints: shlib events" | |
393 | } | |
394 | } | |
395 | ||
396 | ||
397 | send_gdb "maint print\n" | |
398 | gdb_expect { | |
399 | -re "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ | |
400 | { pass "maint print w/o args" } | |
401 | -re ".*$gdb_prompt $" { fail "maint print w/o args" } | |
402 | timeout { fail "(timeout) maint print w/o args" } | |
403 | } | |
404 | ||
405 | send_gdb "maint info\n" | |
406 | gdb_expect { | |
407 | -re "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ | |
408 | { pass "maint info w/o args" } | |
409 | -re ".*$gdb_prompt $" { fail "maint info w/o args" } | |
410 | timeout { fail "(timeout) maint info w/o args" } | |
411 | } | |
412 | ||
413 | send_gdb "maint\n" | |
414 | gdb_expect { | |
415 | -re "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ | |
416 | { pass "maint w/o args" } | |
417 | -re ".*$gdb_prompt $" { fail "maint w/o args" } | |
418 | timeout { fail "(timeout) maint w/o args" } | |
419 | } | |
420 | ||
421 | ||
422 | set timeout $oldtimeout | |
423 | ||
424 | #============test help on maint commands | |
425 | ||
426 | send_gdb "help maint\n" | |
427 | gdb_expect { | |
428 | -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 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 $"\ | |
429 | { pass "help maint" } | |
430 | -re ".*$gdb_prompt $" { fail "help maint" } | |
431 | timeout { fail "(timeout) help maint" } | |
432 | } | |
433 | ||
434 | ||
435 | send_gdb "help maint check-symtabs\n" | |
436 | gdb_expect { | |
437 | -re "Check consistency of psymtabs and symtabs\\..*$gdb_prompt $"\ | |
438 | { pass "help maint check-symtabs" } | |
439 | -re ".*$gdb_prompt $" { fail "help maint check-symtabs" } | |
440 | timeout { fail "(timeout) help maint check-symtabs" } | |
441 | } | |
442 | ||
443 | send_gdb "help maint space\n" | |
444 | gdb_expect { | |
445 | -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 $"\ | |
446 | { pass "help maint space" } | |
447 | -re ".*$gdb_prompt $" { fail "help maint space" } | |
448 | timeout { fail "(timeout) help maint space" } | |
449 | } | |
450 | ||
451 | send_gdb "help maint time\n" | |
452 | gdb_expect { | |
453 | -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 $"\ | |
454 | { pass "help maint time" } | |
455 | -re ".*$gdb_prompt $" { fail "help maint time" } | |
456 | timeout { fail "(timeout) help maint time" } | |
457 | } | |
458 | ||
459 | send_gdb "help maint demangle\n" | |
460 | gdb_expect { | |
461 | -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 $"\ | |
462 | { pass "help maint demangle" } | |
463 | -re ".*$gdb_prompt $" { fail "help maint demangle" } | |
464 | timeout { fail "(timeout) help maint demangle" } | |
465 | } | |
466 | ||
467 | send_gdb "help maint dump-me\n" | |
468 | gdb_expect { | |
469 | -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 $"\ | |
470 | { pass "help maint dump-me" } | |
471 | -re ".*$gdb_prompt $" { fail "help maint dump-me" } | |
472 | timeout { fail "(timeout) help maint dump-me" } | |
473 | } | |
474 | ||
475 | send_gdb "help maint print statistics\n" | |
476 | gdb_expect { | |
477 | -re "Print statistics about internal gdb state\\..*$gdb_prompt $"\ | |
478 | { pass "help maint print statistics" } | |
479 | -re ".*$gdb_prompt $" { fail "help maint print statistics" } | |
480 | timeout { fail "(timeout) help maint print statistics" } | |
481 | } | |
482 | ||
483 | send_gdb "help maint print objfiles\n" | |
484 | gdb_expect { | |
485 | -re "Print dump of current object file definitions\\..*$gdb_prompt $"\ | |
486 | { pass "help maint print objfiles" } | |
487 | -re ".*$gdb_prompt $" { fail "help maint print objfiles" } | |
488 | timeout { fail "(timeout) help maint print objfiles" } | |
489 | } | |
490 | ||
491 | send_gdb "help maint print psymbols\n" | |
492 | gdb_expect { | |
493 | -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 $"\ | |
494 | { pass "help maint print psymbols" } | |
495 | -re ".*$gdb_prompt $" { fail "help maint print psymbols" } | |
496 | timeout { fail "(timeout) help maint print psymbols" } | |
497 | } | |
498 | ||
499 | send_gdb "help maint print msymbols\n" | |
500 | gdb_expect { | |
501 | -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 $"\ | |
502 | { pass "help maint print msymbols" } | |
503 | -re ".*$gdb_prompt $" { fail "help maint print msymbols" } | |
504 | timeout { fail "(timeout) help maint print msymbols" } | |
505 | } | |
506 | ||
507 | send_gdb "help maint print symbols\n" | |
508 | gdb_expect { | |
509 | -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 $"\ | |
510 | { pass "help maint print symbols" } | |
511 | -re ".*$gdb_prompt $" { fail "help maint print symbols" } | |
512 | timeout { fail "(timeout) help maint print symbols" } | |
513 | } | |
514 | ||
515 | ||
516 | send_gdb "help maint print type\n" | |
517 | gdb_expect { | |
518 | -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 $"\ | |
519 | { pass "help maint print type" } | |
520 | -re ".*$gdb_prompt $" { fail "help maint print type" } | |
521 | timeout { fail "(timeout) help maint print type" } | |
522 | } | |
523 | ||
524 | #send_gdb "help maint print unwind\n" | |
525 | #gdb_expect { | |
526 | # -re "Print unwind table entry at given address\\..*$gdb_prompt $"\ | |
527 | # { pass "help maint print unwind" } | |
528 | # -re ".*$gdb_prompt $" { fail "help maint print unwind" } | |
529 | # timeout { fail "(timeout) help maint print unwind" } | |
530 | # } | |
531 | ||
532 | send_gdb "help maint info sections\n" | |
533 | gdb_expect { | |
534 | -re "List the BFD sections of the exec and core files\\..*$gdb_prompt $"\ | |
535 | { pass "help maint info sections" } | |
536 | -re ".*$gdb_prompt $" { fail "help maint info sections" } | |
537 | timeout { fail "(timeout) help maint info sections" } | |
538 | } | |
539 | ||
540 | ||
541 | send_gdb "help maint info breakpoints\n" | |
542 | gdb_expect { | |
543 | -re "Status of all breakpoints, or breakpoint number NUMBER.*$gdb_prompt $" { pass "help maint info breakpoints" } | |
544 | -re ".*$gdb_prompt $" { fail "help maint info breakpoints" } | |
545 | timeout { fail "(timeout) help maint info breakpoints" } | |
546 | } | |
547 | ||
548 | #send_gdb "help maint info breakpoints\n" | |
549 | #expect { | |
550 | # -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 $"\ | |
551 | # { pass "help maint info breakpoints" } | |
552 | # -re ".*$gdb_prompt $" { fail "help maint info breakpoints" } | |
553 | # timeout { fail "(timeout) help maint info breakpoints" } | |
554 | # } | |
555 | ||
556 | send_gdb "help maint info\n" | |
557 | gdb_expect { | |
558 | -re "Commands for showing internal info about the program being debugged.*unambiguous\\..*$gdb_prompt $"\ | |
559 | { pass "help maint info" } | |
560 | -re ".*$gdb_prompt $" { fail "help maint info" } | |
561 | timeout { fail "(timeout) help maint info" } | |
562 | } | |
563 | ||
564 | send_gdb "help maint print\n" | |
565 | gdb_expect { | |
566 | -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 $"\ | |
567 | { pass "help maint print" } | |
568 | -re ".*$gdb_prompt $" { fail "help maint print" } | |
569 | timeout { fail "(timeout) help maint print" } | |
570 | } | |
571 | ||
572 | send_gdb "help maint\n" | |
573 | gdb_expect { | |
574 | -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 $"\ | |
575 | { pass "help maint" } | |
576 | -re ".*$gdb_prompt $" { fail "help maint" } | |
577 | timeout { fail "(timeout) help maint" } | |
578 | } | |
579 | ||
580 | #set oldtimeout $timeout | |
581 | #set timeout [expr $timeout + 300] | |
582 | ||
583 | send_gdb "maint dump-me\n" | |
584 | gdb_expect { | |
585 | -re "Should GDB dump core.*\\(y or n\\) $"\ | |
586 | { send_gdb "n\n" | |
587 | gdb_expect { | |
588 | -re ".*$gdb_prompt $" { pass "maint dump-me" } | |
589 | timeout { fail "(timeout) maint dump-me" } | |
590 | } | |
591 | } | |
592 | -re ".*$gdb_prompt $" { fail "maint dump-me" } | |
593 | timeout { fail "(timeout) maint dump-me" } | |
594 | } | |
595 | ||
596 | #set timeout $oldtimeout | |
597 | ||
598 | ||
599 | gdb_exit | |
600 | return 0 |