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