Commit | Line | Data |
---|---|---|
0b302171 | 1 | # Copyright 1998-2003, 2007-2012 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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
c906108c SS |
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. | |
e22f8b7c | 12 | # |
c906108c | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 15 | |
c906108c SS |
16 | # This file was written by Elena Zannoni (ezannoni@cygnus.com) |
17 | ||
18 | # this file tests maintenance commands and help on those. | |
19 | ||
20 | # source file used is break.c | |
21 | ||
22 | ||
23 | #maintenance check-symtabs -- Check consistency of psymtabs and symtabs | |
24 | #maintenance space -- Set the display of space usage | |
4f337972 AC |
25 | #maintenance set -- Set GDB internal variables used by the GDB maintainer |
26 | #maintenance show -- Show GDB internal variables used by the GDB maintainer | |
c906108c SS |
27 | #maintenance time -- Set the display of time usage |
28 | #maintenance demangle -- Demangle a C++ mangled name | |
29 | #maintenance dump-me -- Get fatal error; make debugger dump its core | |
30 | #maintenance print -- Maintenance command for printing GDB internal state | |
31 | #maintenance info -- Commands for showing internal info about the program being debugged | |
7be570e7 | 32 | #maintenance internal-error -- Give GDB an internal error. |
c906108c | 33 | # |
00905d52 | 34 | #maintenance print dummy-frames -- Print the dummy frame stack |
c906108c SS |
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 | ||
c906108c SS |
50 | set testfile "break" |
51 | set srcfile ${testfile}.c | |
a1dea79a | 52 | set srcfile1 ${testfile}1.c |
c906108c | 53 | set binfile ${objdir}/${subdir}/${testfile} |
a1dea79a | 54 | |
fc91c6c2 | 55 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } { |
b60f0898 JB |
56 | untested maint.exp |
57 | return -1 | |
a1dea79a FF |
58 | } |
59 | ||
fc91c6c2 | 60 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } { |
b60f0898 JB |
61 | untested maint.exp |
62 | return -1 | |
a1dea79a FF |
63 | } |
64 | ||
fc91c6c2 | 65 | if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } { |
b60f0898 JB |
66 | untested maint.exp |
67 | return -1 | |
c906108c SS |
68 | } |
69 | ||
70 | ||
71 | gdb_exit | |
72 | gdb_start | |
73 | gdb_reinitialize_dir $srcdir/$subdir | |
b78974c3 PA |
74 | |
75 | # The commands we test here produce many lines of output; disable "press | |
76 | # <return> to continue" prompts. | |
77 | gdb_test_no_output "set height 0" | |
78 | ||
79 | # Tests that require that no program is running | |
80 | ||
81 | gdb_file_cmd ${binfile} | |
82 | ||
83 | # Test for a regression where this command would internal-error if the | |
84 | # program wasn't running. | |
85 | gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*" | |
86 | ||
87 | # Tests that can or should be done with a running program | |
88 | ||
c906108c SS |
89 | gdb_load ${binfile} |
90 | ||
91 | if ![runto_main] then { | |
92 | perror "tests suppressed" | |
93 | } | |
94 | ||
95 | ||
c906108c SS |
96 | # |
97 | # this command does not produce any output | |
98 | # unless there is some problem with the symtabs and psymtabs | |
99 | # so that branch will really never be covered in this tests here!! | |
100 | # | |
101 | ||
a0b3c4fd JM |
102 | # guo: on linux this command output is huge. for some reason splitting up |
103 | # the regexp checks works. | |
104 | # | |
c906108c SS |
105 | send_gdb "maint check-symtabs\n" |
106 | gdb_expect { | |
65731a6b MS |
107 | -re "^maint check-symtabs" { |
108 | gdb_expect { | |
109 | -re "$gdb_prompt $" { | |
110 | pass "maint check-symtabs" | |
a0b3c4fd | 111 | } |
65731a6b | 112 | timeout { fail "(timeout) maint check-symtabs" } |
a0b3c4fd | 113 | } |
65731a6b MS |
114 | } |
115 | -re ".*$gdb_prompt $" { fail "maint check-symtabs" } | |
116 | timeout { fail "(timeout) maint check-symtabs" } | |
117 | } | |
c906108c | 118 | |
65731a6b MS |
119 | gdb_test "maint space" \ |
120 | "\"maintenance space\" takes a numeric argument\\." | |
c906108c | 121 | |
65731a6b MS |
122 | gdb_test "maint space 1" \ |
123 | "Space used: $decimal \\(\\+$decimal for this command\\)" | |
c906108c | 124 | |
65731a6b MS |
125 | gdb_test "maint time" \ |
126 | "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\)" | |
c906108c | 127 | |
65731a6b MS |
128 | gdb_test "maint time 1" \ |
129 | "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\)" | |
c906108c | 130 | |
65731a6b MS |
131 | gdb_test "maint time 0" \ |
132 | "Space used: $decimal \\(\\+$decimal for this command\\)" | |
c906108c | 133 | |
65731a6b | 134 | gdb_test_no_output "maint space 0" |
c906108c | 135 | |
65731a6b MS |
136 | gdb_test "maint demangle" \ |
137 | "\"maintenance demangle\" takes an argument to demangle\\." | |
c906108c | 138 | |
65731a6b | 139 | gdb_test "maint demangle main" "Can't demangle \"main\"" |
c906108c | 140 | |
c906108c | 141 | |
c906108c | 142 | |
dbdfa66c CV |
143 | # The timeout value is raised, because printing all the symbols and |
144 | # statistical information about Cygwin and Windows libraries takes a lot | |
cb80163c DE |
145 | # of time. |
146 | if [istarget "*-*-cygwin*"] { | |
147 | set oldtimeout $timeout | |
148 | set timeout [expr $timeout + 500] | |
149 | } | |
c906108c | 150 | |
55b7ce7f UW |
151 | send_gdb "maint print statistics\n" |
152 | gdb_expect { | |
706e3705 | 153 | -re "Statistics for\[^\n\r\]*break\[^\n\r\]*:\r\n Number of \"minimal\" symbols read: $decimal\r\n Number of \"partial\" symbols read: $decimal\r\n Number of \"full\" symbols read: $decimal\r\n Number of \"types\" defined: $decimal\r\n Number of psym tables \\(not yet expanded\\): $decimal\r\n Number of symbol tables: $decimal\r\n Number of symbol tables with line tables: $decimal\r\n Number of symbol tables with blockvectors: $decimal\r\n Total memory used for objfile obstack: $decimal\r\n Total memory used for BFD obstack: $decimal\r\n Total memory used for psymbol cache: $decimal\r\n Total memory used for macro cache: $decimal\r\n Total memory used for file name cache: $decimal\r\n" { |
55b7ce7f UW |
154 | gdb_expect { |
155 | -re "$gdb_prompt $" { | |
156 | pass "maint print statistics" | |
157 | } | |
158 | timeout { fail "(timeout) maint print statistics" } | |
159 | } | |
65731a6b | 160 | } |
55b7ce7f UW |
161 | -re ".*$gdb_prompt $" { fail "maint print statistics" } |
162 | timeout { fail "(timeout) maint print statistics" } | |
65731a6b | 163 | } |
c906108c | 164 | |
00905d52 | 165 | # There aren't any ... |
27d3a1a2 | 166 | gdb_test_no_output "maint print dummy-frames" |
00905d52 | 167 | |
c906108c | 168 | send_gdb "maint print objfiles\n" |
adf40b2e | 169 | |
c906108c | 170 | # To avoid timeouts, we avoid expects with many .* patterns that match |
adf40b2e JM |
171 | # many lines. Instead, we keep track of which milestones we've seen |
172 | # in the output, and stop when we've seen all of them. | |
173 | ||
174 | set header 0 | |
175 | set psymtabs 0 | |
176 | set symtabs 0 | |
177 | set keep_looking 1 | |
178 | ||
179 | while {$keep_looking} { | |
180 | gdb_expect { | |
181 | ||
03dd63aa | 182 | -re ".*Object file.*break($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 } |
adf40b2e JM |
183 | -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 } |
184 | -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 } | |
185 | ||
186 | -re ".*$gdb_prompt $" { | |
187 | set keep_looking 0 | |
188 | } | |
189 | timeout { | |
190 | fail "(timeout) maint print objfiles" | |
191 | set keep_looking 0 | |
192 | } | |
193 | } | |
c906108c | 194 | } |
adf40b2e JM |
195 | |
196 | proc maint_pass_if {val name} { | |
197 | if $val { pass $name } else { fail $name } | |
c906108c SS |
198 | } |
199 | ||
adf40b2e JM |
200 | maint_pass_if $header "maint print objfiles: header" |
201 | maint_pass_if $psymtabs "maint print objfiles: psymtabs" | |
202 | maint_pass_if $symtabs "maint print objfiles: symtabs" | |
203 | ||
65731a6b MS |
204 | gdb_test "maint print psymbols" \ |
205 | "print-psymbols takes an output file name and optional symbol file name" \ | |
206 | "maint print psymbols w/o args" | |
207 | ||
208 | ||
c906108c | 209 | |
3bcbaac5 | 210 | send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n" |
c906108c | 211 | gdb_expect { |
65731a6b MS |
212 | -re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $" { |
213 | send_gdb "shell ls psymbols_output\n" | |
214 | gdb_expect { | |
215 | -re "psymbols_output\r\n$gdb_prompt $" { | |
216 | # We want this grep to be as specific as possible, | |
217 | # so it's less likely to match symbol file names in | |
218 | # psymbols_output. Yes, this actually happened; | |
219 | # poor expect got tons of output, and timed out | |
220 | # trying to match it. --- Jim Blandy <jimb@cygnus.com> | |
221 | send_gdb "shell grep 'main.*function' psymbols_output\n" | |
222 | gdb_expect { | |
223 | -re ".main., function, $hex.*$gdb_prompt $" { | |
224 | pass "maint print psymbols 1" | |
225 | } | |
226 | -re ".*main. .., function, $hex.*$gdb_prompt $" { | |
227 | pass "maint print psymbols 2" | |
228 | } | |
229 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
230 | timeout { fail "(timeout) maint print psymbols" } | |
231 | } | |
f6978de9 | 232 | gdb_test "shell rm -f psymbols_output" ".*" |
65731a6b MS |
233 | } |
234 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
235 | timeout { fail "(timeout) maint print psymbols" } | |
236 | } | |
237 | } | |
238 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
239 | timeout { fail "(timeout) maint print psymbols" } | |
240 | } | |
c906108c | 241 | |
65731a6b MS |
242 | gdb_test "maint print msymbols" \ |
243 | "print-msymbols takes an output file name and optional symbol file name" \ | |
244 | "maint print msymbols w/o args" | |
c906108c | 245 | |
c906108c | 246 | |
3bcbaac5 | 247 | send_gdb "maint print msymbols msymbols_output ${binfile}\n" |
c906108c | 248 | gdb_expect { |
65731a6b MS |
249 | -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $" { |
250 | send_gdb "shell ls msymbols_output\n" | |
251 | gdb_expect { | |
252 | -re "msymbols_output\r\n$gdb_prompt $" { | |
253 | send_gdb "shell grep factorial msymbols_output\n" | |
254 | gdb_expect { | |
efd11a33 | 255 | -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" { |
65731a6b MS |
256 | pass "maint print msymbols" |
257 | } | |
258 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
259 | timeout { fail "(timeout) maint print msymbols" } | |
260 | } | |
f6978de9 | 261 | gdb_test "shell rm -f msymbols_output" ".*" |
65731a6b MS |
262 | } |
263 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
264 | timeout { fail "(timeout) maint print msymbols" } | |
265 | } | |
266 | } | |
267 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
268 | timeout { fail "(timeout) maint print msymbols" } | |
269 | } | |
c906108c | 270 | |
dbdfa66c CV |
271 | # Check that maint print msymbols allows relative pathnames |
272 | set mydir [pwd] | |
65731a6b MS |
273 | gdb_test "cd ${objdir}" \ |
274 | "Working directory [string_to_regexp ${objdir}]\..*" \ | |
275 | "cd to objdir" | |
276 | ||
dbdfa66c CV |
277 | gdb_test_multiple "maint print msymbols msymbols_output2 ${subdir}/${testfile}" "maint print msymbols" { |
278 | -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" { | |
279 | gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" { | |
280 | -re "msymbols_output2\r\n$gdb_prompt $" { | |
281 | gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" { | |
efd11a33 | 282 | -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" { |
dbdfa66c CV |
283 | pass "maint print msymbols" |
284 | } | |
285 | -re ".*$gdb_prompt $" { | |
286 | fail "maint print msymbols" | |
287 | } | |
288 | timeout { | |
289 | fail "(timeout) maint print msymbols" | |
290 | } | |
291 | } | |
f6978de9 | 292 | gdb_test "shell rm -f msymbols_output2" ".*" |
dbdfa66c CV |
293 | } |
294 | -re ".*$gdb_prompt $" { | |
295 | fail "maint print msymbols" | |
296 | } | |
297 | timeout { | |
298 | fail "(timeout) maint print msymbols" | |
299 | } | |
300 | } | |
301 | } | |
302 | -re ".*$gdb_prompt $" { | |
303 | fail "maint print msymbols" | |
304 | } | |
305 | timeout { | |
306 | fail "(timeout) maint print msymbols" | |
307 | } | |
308 | } | |
65731a6b MS |
309 | gdb_test "cd ${mydir}" \ |
310 | "Working directory [string_to_regexp ${mydir}]\..*" \ | |
311 | "cd to mydir" | |
312 | ||
313 | gdb_test "maint print symbols" \ | |
314 | "Arguments missing: an output file name and an optional symbol file name" \ | |
315 | "maint print symbols w/o args" | |
c906108c | 316 | |
c906108c | 317 | |
3bcbaac5 DJ |
318 | # Request symbols for one particular source file so that we don't try to |
319 | # dump the symbol information for the entire C library - over 500MB nowadays | |
320 | # for GNU libc. | |
adf40b2e | 321 | |
3bcbaac5 | 322 | send_gdb "maint print symbols symbols_output ${srcdir}/${subdir}/${srcfile}\n" |
c906108c | 323 | gdb_expect { |
65731a6b MS |
324 | -re "^maint print symbols symbols_output \[^\n\]*\r\n$gdb_prompt $" { |
325 | send_gdb "shell ls symbols_output\n" | |
326 | gdb_expect { | |
327 | -re "symbols_output\r\n$gdb_prompt $" { | |
328 | # See comments for `maint print psymbols'. | |
329 | send_gdb "shell grep 'main(.*block' symbols_output\n" | |
330 | gdb_expect { | |
331 | -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $" { | |
332 | pass "maint print symbols" | |
333 | } | |
334 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
335 | timeout { fail "(timeout) maint print symbols" } | |
336 | } | |
f6978de9 | 337 | gdb_test "shell rm -f symbols_output" ".*" |
65731a6b MS |
338 | } |
339 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
340 | timeout { fail "(timeout) maint print symbols" } | |
341 | } | |
342 | } | |
343 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
344 | timeout { fail "(timeout) maint print symbols" } | |
345 | } | |
c906108c | 346 | |
b4ba55a1 JB |
347 | set msg "maint print type" |
348 | gdb_test_multiple "maint print type argc" $msg { | |
349 | -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\n$gdb_prompt $" { | |
350 | pass $msg | |
351 | } | |
352 | } | |
c906108c | 353 | |
a0b3c4fd JM |
354 | if [istarget "hppa*-*-11*"] { |
355 | setup_xfail hppa*-*-*11* CLLbs14860 | |
65731a6b MS |
356 | gdb_test_multiple "maint print unwind &main" "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\tRegion_description = $hex\r\n\tEntry_FR = $hex\r\n\tEntry_GR = $hex\r\n\tTotal_frame_size = $hex\r\n$gdb_prompt $" { | |
358 | pass "maint print unwind" | |
359 | } | |
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 | } | |
a0b3c4fd JM |
363 | } |
364 | } | |
c906108c SS |
365 | |
366 | set oldtimeout $timeout | |
367 | set timeout [expr $timeout + 300] | |
368 | ||
369 | # It'd be nice to check for every possible section. However, that's | |
370 | # problematic, since the relative ordering wanders from release to | |
371 | # release of the compilers. Instead, we'll just check for two | |
372 | # sections which appear to always come out in the same relative | |
373 | # order. (If that changes, then we should just check for one | |
374 | # section.) | |
375 | # | |
376 | # And by the way: This testpoint will break for PA64, where a.out's | |
377 | # are ELF files. | |
293e2f9e DJ |
378 | |
379 | # Standard GNU names. | |
380 | set text_section ".text" | |
381 | set data_section ".data" | |
382 | ||
65731a6b MS |
383 | gdb_test_multiple "maint info sections" "maint info sections" { |
384 | -re "Exec file:\r\n.*break($EXEEXT)?., file type.*ER_RO.*$gdb_prompt $" { | |
385 | # Looks like RealView which uses different section names. | |
386 | set text_section ER_RO | |
387 | set data_section ER_RW | |
388 | pass "maint info sections" | |
389 | } | |
d93f7b5c YQ |
390 | -re "Exec file:\r\n.*break($EXEEXT)?., file type.*neardata.*$gdb_prompt $" { |
391 | # c6x doesn't have .data section. It has .neardata and .fardata section. | |
392 | set data_section ".neardata" | |
393 | pass "maint info sections" | |
394 | } | |
65731a6b MS |
395 | -re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $" { |
396 | pass "maint info sections" | |
397 | } | |
398 | } | |
c906108c | 399 | |
8ddad156 MS |
400 | # Test for new option: maint info sections <section name> |
401 | # If you don't have a .text section, this will require tweaking. | |
65731a6b MS |
402 | |
403 | gdb_test_multiple "maint info sections $text_section" \ | |
404 | "maint info sections .text" { | |
405 | -re ".* \\.bss .*$gdb_prompt $" { | |
406 | fail "maint info sections .text" | |
407 | } | |
408 | -re ".* $data_section .*$gdb_prompt $" { | |
409 | fail "maint info sections .text" | |
410 | } | |
411 | -re ".* $text_section .*$gdb_prompt $" { | |
412 | pass "maint info sections .text" | |
413 | } | |
414 | } | |
8ddad156 MS |
415 | |
416 | # Test for new option: CODE section flag | |
417 | # If your data section is tagged CODE, xfail this test. | |
65731a6b MS |
418 | |
419 | gdb_test_multiple "maint info sections CODE" "maint info sections CODE" { | |
293e2f9e DJ |
420 | -re ".* $data_section .*$gdb_prompt $" { fail "maint info sections CODE" } |
421 | -re ".* $text_section .*$gdb_prompt $" { pass "maint info sections CODE" } | |
8ddad156 MS |
422 | } |
423 | ||
424 | # Test for new option: DATA section flag | |
425 | # If your text section is tagged DATA, xfail this test. | |
dbdfa66c | 426 | # |
58e8570a | 427 | # The "maint info sections DATA" test is marked for XFAIL on Windows, |
dbdfa66c CV |
428 | # because Windows has text sections marked DATA. |
429 | setup_xfail "*-*-*cygwin*" | |
58e8570a | 430 | setup_xfail "*-*-*mingw*" |
65731a6b MS |
431 | |
432 | gdb_test_multiple "maint info sections DATA" "maint info sections DATA" { | |
293e2f9e DJ |
433 | -re ".* $text_section .*$gdb_prompt $" { fail "maint info sections DATA" } |
434 | -re ".* $data_section .*$gdb_prompt $" { pass "maint info sections DATA" } | |
759f0f0b | 435 | -re ".* .rodata .*$gdb_prompt $" { pass "maint info sections DATA" } |
8ddad156 MS |
436 | } |
437 | ||
a1dea79a FF |
438 | set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] |
439 | ||
65731a6b MS |
440 | gdb_test_multiple "maint info breakpoints" "maint info breakpoints" { |
441 | -re "Num\[ \t\]+Type\[ \t\]+Disp\[ \t\]+Enb\[ \t\]+Address\[ \t\]+What\r\n1\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y\[ \t\]+$hex\[ \t\]+in main at.*break.c:$bp_location6 inf 1\r\n\[ \t\]+breakpoint already hit 1 time\r\n.*$gdb_prompt $" { | |
442 | pass "maint info breakpoints" | |
443 | } | |
444 | -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:$bp_location6 sspace 1\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 $" { | |
445 | pass "maint info breakpoints (with shlib events)" | |
446 | } | |
c906108c SS |
447 | } |
448 | ||
65731a6b MS |
449 | gdb_test "maint print" \ |
450 | "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*" \ | |
451 | "maint print w/o args" | |
c906108c | 452 | |
65731a6b MS |
453 | gdb_test "maint info" \ |
454 | "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*" \ | |
455 | "maint info w/o args" | |
c906108c | 456 | |
65731a6b MS |
457 | gdb_test "maint" \ |
458 | "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*" \ | |
459 | "maint w/o args" | |
c906108c SS |
460 | |
461 | set timeout $oldtimeout | |
462 | ||
463 | #============test help on maint commands | |
464 | ||
65731a6b MS |
465 | gdb_test "help maint" \ |
466 | "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../ObjC 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\\..*" | |
c906108c | 467 | |
65731a6b MS |
468 | gdb_test "help maint check-symtabs" \ |
469 | "Check consistency of psymtabs and symtabs\\..*" | |
c906108c | 470 | |
65731a6b MS |
471 | gdb_test "help maint space" \ |
472 | "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\\..*" | |
c906108c | 473 | |
65731a6b MS |
474 | gdb_test "help maint time" \ |
475 | "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\\..*" | |
c906108c | 476 | |
65731a6b MS |
477 | gdb_test "help maint demangle" \ |
478 | "Demangle a C\\+\\+/ObjC mangled name\\.\r\nCall internal GDB demangler routine to demangle a C\\+\\+ link name\r\nand prints the result\\..*" | |
c906108c | 479 | |
65731a6b MS |
480 | gdb_test "help maint dump-me" \ |
481 | "Get fatal error; make debugger dump its core\\.\r\nGDB sets its handling of SIGQUIT back to SIG_DFL and then sends\r\nitself a SIGQUIT signal\\..*" | |
c906108c | 482 | |
65731a6b MS |
483 | gdb_test "help maint internal-error" \ |
484 | "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*" | |
7be570e7 | 485 | |
65731a6b MS |
486 | gdb_test "help maint internal-warning" \ |
487 | "Give GDB an internal warning\\.\r\nCause GDB to behave as if an internal warning was reported\\..*" | |
dec43320 | 488 | |
65731a6b MS |
489 | gdb_test "help maint print statistics" \ |
490 | "Print statistics about internal gdb state\\..*" | |
c906108c | 491 | |
00905d52 AC |
492 | gdb_test "help maint print dummy-frames" \ |
493 | "Print the contents of the internal dummy-frame stack." | |
494 | ||
65731a6b MS |
495 | gdb_test "help maint print objfiles" \ |
496 | "Print dump of current object file definitions\\..*" | |
c906108c | 497 | |
65731a6b MS |
498 | gdb_test "help maint print psymbols" \ |
499 | "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\\..*" | |
c906108c | 500 | |
65731a6b MS |
501 | gdb_test "help maint print msymbols" \ |
502 | "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\\..*" | |
c906108c | 503 | |
65731a6b MS |
504 | gdb_test "help maint print symbols" \ |
505 | "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\\..*" | |
c906108c | 506 | |
65731a6b MS |
507 | gdb_test "help maint print type" \ |
508 | "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\\..*" | |
c906108c | 509 | |
a0b3c4fd | 510 | if [istarget "hppa*-*-*"] { |
65731a6b MS |
511 | gdb_test "help maint print unwind" \ |
512 | "Print unwind table entry at given address\\..*" | |
a0b3c4fd | 513 | } |
c906108c | 514 | |
65731a6b MS |
515 | gdb_test "help maint info sections" \ |
516 | "List the BFD sections of the exec and core files\\..*" | |
c906108c | 517 | |
65731a6b MS |
518 | gdb_test "help maint info breakpoints" \ |
519 | "Status of all breakpoints, or breakpoint number NUMBER.*" | |
c906108c | 520 | |
c906108c SS |
521 | |
522 | #send_gdb "help maint info breakpoints\n" | |
523 | #expect { | |
524 | # -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 $"\ | |
525 | # { pass "help maint info breakpoints" } | |
526 | # -re ".*$gdb_prompt $" { fail "help maint info breakpoints" } | |
527 | # timeout { fail "(timeout) help maint info breakpoints" } | |
528 | # } | |
529 | ||
65731a6b MS |
530 | gdb_test "help maint info" \ |
531 | "Commands for showing internal info about the program being debugged.*unambiguous\\..*" | |
c906108c | 532 | |
d8295fe9 VP |
533 | test_prefix_command_help {"maint print" "maintenance print"} { |
534 | "Maintenance command for printing GDB internal state\\.\[\r\n\]+" | |
535 | } | |
c906108c | 536 | |
d8295fe9 VP |
537 | test_prefix_command_help {"maint" "maintenance"} { |
538 | "Commands for use by GDB maintainers\\.\[\r\n\]+" | |
539 | "Includes commands to dump specific internal GDB structures in\[\r\n\]+" | |
540 | "a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+" | |
541 | "to test internal functions such as the C\\+\\+/ObjC demangler, etc\\.\[\r\n\]+" | |
542 | } | |
c906108c SS |
543 | |
544 | #set oldtimeout $timeout | |
545 | #set timeout [expr $timeout + 300] | |
546 | ||
65731a6b MS |
547 | gdb_test_multiple "maint dump-me" "maint dump-me" { |
548 | -re "Should GDB dump core.*\\(y or n\\) $" { | |
549 | gdb_test "n" ".*" "maint dump-me" | |
550 | } | |
551 | } | |
c906108c | 552 | |
7be570e7 | 553 | send_gdb "maint internal-error\n" |
039cf96d AC |
554 | gdb_expect { |
555 | -re "A problem internal to GDB has been detected" { | |
556 | pass "maint internal-error" | |
557 | if [gdb_internal_error_resync] { | |
558 | pass "internal-error resync" | |
559 | } else { | |
560 | fail "internal-error resync" | |
7be570e7 JM |
561 | } |
562 | } | |
563 | -re ".*$gdb_prompt $" { | |
564 | fail "maint internal-error" | |
039cf96d | 565 | untested "internal-error resync" |
7be570e7 JM |
566 | } |
567 | timeout { | |
039cf96d AC |
568 | fail "maint internal-error (timeout)" |
569 | untested "internal-error resync" | |
7be570e7 JM |
570 | } |
571 | } | |
572 | ||
c906108c SS |
573 | #set timeout $oldtimeout |
574 | ||
575 | ||
576 | gdb_exit | |
577 | return 0 |