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