Commit | Line | Data |
---|---|---|
4c38e0a4 | 1 | # Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2007, 2008, 2009, 2010 |
6aba47ca | 2 | # Free Software Foundation, Inc. |
c906108c SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
c906108c SS |
17 | # This file was written by Elena Zannoni (ezannoni@cygnus.com) |
18 | ||
19 | # this file tests maintenance commands and help on those. | |
20 | ||
21 | # source file used is break.c | |
22 | ||
23 | ||
24 | #maintenance check-symtabs -- Check consistency of psymtabs and symtabs | |
25 | #maintenance space -- Set the display of space usage | |
4f337972 AC |
26 | #maintenance set -- Set GDB internal variables used by the GDB maintainer |
27 | #maintenance show -- Show GDB internal variables used by the GDB maintainer | |
c906108c SS |
28 | #maintenance time -- Set the display of time usage |
29 | #maintenance demangle -- Demangle a C++ mangled name | |
30 | #maintenance dump-me -- Get fatal error; make debugger dump its core | |
31 | #maintenance print -- Maintenance command for printing GDB internal state | |
32 | #maintenance info -- Commands for showing internal info about the program being debugged | |
7be570e7 | 33 | #maintenance internal-error -- Give GDB an internal error. |
c906108c | 34 | # |
00905d52 | 35 | #maintenance print dummy-frames -- Print the dummy frame stack |
c906108c SS |
36 | #maintenance print statistics -- Print statistics about internal gdb state |
37 | #maintenance print objfiles -- Print dump of current object file definitions | |
38 | #maintenance print psymbols -- Print dump of current partial symbol definitions | |
39 | #maintenance print msymbols -- Print dump of current minimal symbol definitions | |
40 | #maintenance print symbols -- Print dump of current symbol definitions | |
41 | #maintenance print type -- Print a type chain for a given symbol | |
42 | #maintenance print unwind -- Print unwind table entry at given address | |
43 | # | |
44 | # | |
45 | #maintenance info sections -- List the BFD sections of the exec and core files | |
46 | #maintenance info breakpoints -- Status of all breakpoints | |
47 | # | |
48 | ||
49 | ||
50 | ||
51 | if $tracelevel then { | |
52 | strace $tracelevel | |
53 | } | |
54 | ||
55 | global usestubs | |
56 | ||
57 | # | |
58 | # test running programs | |
59 | # | |
c906108c SS |
60 | |
61 | set testfile "break" | |
62 | set srcfile ${testfile}.c | |
a1dea79a | 63 | set srcfile1 ${testfile}1.c |
c906108c | 64 | set binfile ${objdir}/${subdir}/${testfile} |
a1dea79a | 65 | |
fc91c6c2 | 66 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } { |
b60f0898 JB |
67 | untested maint.exp |
68 | return -1 | |
a1dea79a FF |
69 | } |
70 | ||
fc91c6c2 | 71 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } { |
b60f0898 JB |
72 | untested maint.exp |
73 | return -1 | |
a1dea79a FF |
74 | } |
75 | ||
fc91c6c2 | 76 | if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } { |
b60f0898 JB |
77 | untested maint.exp |
78 | return -1 | |
c906108c SS |
79 | } |
80 | ||
81 | ||
82 | gdb_exit | |
83 | gdb_start | |
84 | gdb_reinitialize_dir $srcdir/$subdir | |
85 | gdb_load ${binfile} | |
86 | ||
87 | if ![runto_main] then { | |
88 | perror "tests suppressed" | |
89 | } | |
90 | ||
91 | ||
92 | # The commands we test here produce many lines of output; disable "press | |
93 | # <return> to continue" prompts. | |
94 | send_gdb "set height 0\n" | |
95 | gdb_expect -re "$gdb_prompt $" | |
96 | ||
c906108c SS |
97 | |
98 | # | |
99 | # this command does not produce any output | |
100 | # unless there is some problem with the symtabs and psymtabs | |
101 | # so that branch will really never be covered in this tests here!! | |
102 | # | |
103 | ||
a0b3c4fd JM |
104 | # guo: on linux this command output is huge. for some reason splitting up |
105 | # the regexp checks works. | |
106 | # | |
c906108c SS |
107 | send_gdb "maint check-symtabs\n" |
108 | gdb_expect { | |
a0b3c4fd JM |
109 | -re "^maint check-symtabs" { |
110 | gdb_expect { | |
111 | -re "$gdb_prompt $" \ | |
c906108c | 112 | { pass "maint check-symtabs" } |
a0b3c4fd JM |
113 | timeout { fail "(timeout) maint check-symtabs" } |
114 | } | |
115 | } | |
c906108c SS |
116 | -re ".*$gdb_prompt $" { fail "maint check-symtabs" } |
117 | timeout { fail "(timeout) maint check-symtabs" } | |
118 | } | |
119 | ||
120 | send_gdb "maint space\n" | |
121 | gdb_expect { | |
122 | -re "\"maintenance space\" takes a numeric argument\\..*$gdb_prompt $"\ | |
123 | { pass "maint space" } | |
124 | -re ".*$gdb_prompt $" { fail "maint space" } | |
125 | timeout { fail "(timeout) maint space" } | |
126 | } | |
127 | ||
128 | send_gdb "maint space 1\n" | |
129 | gdb_expect { | |
130 | -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
131 | { pass "maint space 1" } | |
132 | -re ".*$gdb_prompt $" { fail "maint space 1" } | |
133 | timeout { fail "(timeout) maint space 1" } | |
134 | } | |
135 | ||
136 | ||
137 | send_gdb "maint time\n" | |
138 | gdb_expect { | |
139 | -re "\"maintenance time\" takes a numeric argument\\..*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
140 | { pass "maint time" } | |
141 | -re ".*$gdb_prompt $" { fail "maint time" } | |
142 | timeout { fail "(timeout) maint time" } | |
143 | } | |
144 | ||
145 | send_gdb "maint time 1\n" | |
146 | gdb_expect { | |
147 | -re "Command execution time: $decimal.*Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
148 | { pass "maint time 1" } | |
149 | -re ".*$gdb_prompt $" { fail "maint time 1" } | |
150 | timeout { fail "(timeout) maint time 1" } | |
151 | } | |
152 | ||
153 | send_gdb "maint time 0\n" | |
154 | gdb_expect { | |
155 | -re "Space used: $decimal \\(\\+$decimal for this command\\).*$gdb_prompt $"\ | |
156 | { pass "maint time 0" } | |
157 | -re ".*$gdb_prompt $" { fail "maint time 0" } | |
158 | timeout { fail "(timeout) maint time 0" } | |
159 | } | |
160 | ||
161 | ||
162 | send_gdb "maint space 0\n" | |
163 | gdb_expect { | |
164 | -re "maint space 0\r\n$gdb_prompt $"\ | |
165 | { pass "maint space 0" } | |
166 | -re ".*$gdb_prompt $" { fail "maint space 0" } | |
167 | timeout { fail "(timeout) maint space 0" } | |
168 | } | |
169 | ||
170 | send_gdb "maint demangle\n" | |
171 | gdb_expect { | |
172 | -re "\"maintenance demangle\" takes an argument to demangle\\..*$gdb_prompt $"\ | |
173 | { pass "maint demangle" } | |
174 | -re ".*$gdb_prompt $" { fail "maint demangle" } | |
175 | timeout { fail "(timeout) maint demangle" } | |
176 | } | |
177 | ||
178 | send_gdb "maint demangle main\n" | |
179 | gdb_expect { | |
180 | -re "Can't demangle \"main\".*$gdb_prompt $"\ | |
181 | { pass "maint demangle" } | |
182 | -re ".*$gdb_prompt $" { fail "maint demangle" } | |
183 | timeout { fail "(timeout) maint demangle" } | |
184 | } | |
185 | ||
dbdfa66c CV |
186 | # The timeout value is raised, because printing all the symbols and |
187 | # statistical information about Cygwin and Windows libraries takes a lot | |
188 | # of time. | |
189 | if [istarget "*-*-cygwin*"] { | |
190 | set oldtimeout $timeout | |
191 | set timeout [expr $timeout + 500] | |
192 | } | |
c906108c SS |
193 | |
194 | send_gdb "maint print statistics\n" | |
195 | gdb_expect { | |
c4f90d87 | 196 | -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*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 $"\ |
30fc0091 EZ |
197 | { |
198 | # Old output for gdb 6.0 and earlier | |
199 | pass "maint print statistics" | |
200 | } | |
201 | -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for objfile obstack.*Total memory used for psymbol cache.*Total memory used for macro cache.*$gdb_prompt $"\ | |
c906108c SS |
202 | { pass "maint print statistics" } |
203 | -re ".*$gdb_prompt $" { fail "maint print statistics" } | |
204 | timeout { fail "(timeout) maint print statistics" } | |
205 | } | |
206 | ||
00905d52 AC |
207 | # There aren't any ... |
208 | gdb_test "maint print dummy-frames" "" | |
209 | ||
c906108c | 210 | send_gdb "maint print objfiles\n" |
adf40b2e | 211 | |
c906108c | 212 | # To avoid timeouts, we avoid expects with many .* patterns that match |
adf40b2e JM |
213 | # many lines. Instead, we keep track of which milestones we've seen |
214 | # in the output, and stop when we've seen all of them. | |
215 | ||
216 | set header 0 | |
217 | set psymtabs 0 | |
218 | set symtabs 0 | |
219 | set keep_looking 1 | |
220 | ||
221 | while {$keep_looking} { | |
222 | gdb_expect { | |
223 | ||
03dd63aa | 224 | -re ".*Object file.*break($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 } |
adf40b2e JM |
225 | -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 } |
226 | -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 } | |
227 | ||
228 | -re ".*$gdb_prompt $" { | |
229 | set keep_looking 0 | |
230 | } | |
231 | timeout { | |
232 | fail "(timeout) maint print objfiles" | |
233 | set keep_looking 0 | |
234 | } | |
235 | } | |
c906108c | 236 | } |
adf40b2e JM |
237 | |
238 | proc maint_pass_if {val name} { | |
239 | if $val { pass $name } else { fail $name } | |
c906108c SS |
240 | } |
241 | ||
adf40b2e JM |
242 | maint_pass_if $header "maint print objfiles: header" |
243 | maint_pass_if $psymtabs "maint print objfiles: psymtabs" | |
244 | maint_pass_if $symtabs "maint print objfiles: symtabs" | |
245 | ||
c906108c SS |
246 | send_gdb "maint print psymbols\n" |
247 | gdb_expect { | |
248 | -re "print-psymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ | |
249 | { pass "maint print psymbols w/o args" } | |
250 | -re ".*$gdb_prompt $" { fail "maint print psymbols w/o args" } | |
251 | timeout { fail "(timeout) maint print psymbols w/o args" } | |
252 | } | |
253 | ||
3bcbaac5 | 254 | send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n" |
c906108c | 255 | gdb_expect { |
3bcbaac5 | 256 | -re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $"\ |
c906108c SS |
257 | { |
258 | send_gdb "shell ls psymbols_output\n" | |
259 | gdb_expect { | |
260 | -re "psymbols_output\r\n$gdb_prompt $"\ | |
261 | { | |
262 | # We want this grep to be as specific as possible, | |
263 | # so it's less likely to match symbol file names in | |
264 | # psymbols_output. Yes, this actually happened; | |
265 | # poor expect got tons of output, and timed out | |
266 | # trying to match it. --- Jim Blandy <jimb@cygnus.com> | |
267 | send_gdb "shell grep 'main.*function' psymbols_output\n" | |
268 | gdb_expect { | |
269 | -re ".main., function, $hex.*$gdb_prompt $"\ | |
a0b3c4fd JM |
270 | { pass "maint print psymbols 1" } |
271 | -re ".*main. .., function, $hex.*$gdb_prompt $"\ | |
272 | { pass "maint print psymbols 2" } | |
c906108c SS |
273 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } |
274 | timeout { fail "(timeout) maint print psymbols" } | |
275 | } | |
276 | gdb_test "shell rm -f psymbols_output" "" | |
277 | ||
278 | } | |
279 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
280 | timeout { fail "(timeout) maint print psymbols" } | |
281 | } | |
282 | } | |
283 | -re ".*$gdb_prompt $" { fail "maint print psymbols" } | |
284 | timeout { fail "(timeout) maint print psymbols" } | |
285 | } | |
286 | ||
287 | ||
288 | send_gdb "maint print msymbols\n" | |
289 | gdb_expect { | |
290 | -re "print-msymbols takes an output file name and optional symbol file name.*$gdb_prompt $"\ | |
291 | { pass "maint print msymbols w/o args" } | |
292 | -re ".*$gdb_prompt $" { fail "maint print msymbols w/o args" } | |
293 | timeout { fail "(timeout) maint print msymbols w/o args" } | |
294 | } | |
295 | ||
3bcbaac5 | 296 | send_gdb "maint print msymbols msymbols_output ${binfile}\n" |
c906108c | 297 | gdb_expect { |
3bcbaac5 | 298 | -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $"\ |
c906108c SS |
299 | { |
300 | send_gdb "shell ls msymbols_output\n" | |
301 | gdb_expect { | |
302 | -re "msymbols_output\r\n$gdb_prompt $"\ | |
303 | { | |
304 | send_gdb "shell grep factorial msymbols_output\n" | |
305 | gdb_expect { | |
759f0f0b | 306 | -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex factorial.*$gdb_prompt $"\ |
c906108c SS |
307 | { pass "maint print msymbols" } |
308 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
309 | timeout { fail "(timeout) maint print msymbols" } | |
310 | } | |
311 | gdb_test "shell rm -f msymbols_output" "" | |
312 | ||
313 | } | |
314 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
315 | timeout { fail "(timeout) maint print msymbols" } | |
316 | } | |
317 | } | |
318 | -re ".*$gdb_prompt $" { fail "maint print msymbols" } | |
319 | timeout { fail "(timeout) maint print msymbols" } | |
320 | } | |
321 | ||
dbdfa66c CV |
322 | # Check that maint print msymbols allows relative pathnames |
323 | set mydir [pwd] | |
c499ed39 | 324 | gdb_test "cd ${objdir}" "Working directory [string_to_regexp ${objdir}]\..*" "cd to objdir" |
dbdfa66c CV |
325 | gdb_test_multiple "maint print msymbols msymbols_output2 ${subdir}/${testfile}" "maint print msymbols" { |
326 | -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" { | |
327 | gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" { | |
328 | -re "msymbols_output2\r\n$gdb_prompt $" { | |
329 | gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" { | |
759f0f0b | 330 | -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex factorial.*$gdb_prompt $" { |
dbdfa66c CV |
331 | pass "maint print msymbols" |
332 | } | |
333 | -re ".*$gdb_prompt $" { | |
334 | fail "maint print msymbols" | |
335 | } | |
336 | timeout { | |
337 | fail "(timeout) maint print msymbols" | |
338 | } | |
339 | } | |
340 | gdb_test "shell rm -f msymbols_output2" "" | |
341 | } | |
342 | -re ".*$gdb_prompt $" { | |
343 | fail "maint print msymbols" | |
344 | } | |
345 | timeout { | |
346 | fail "(timeout) maint print msymbols" | |
347 | } | |
348 | } | |
349 | } | |
350 | -re ".*$gdb_prompt $" { | |
351 | fail "maint print msymbols" | |
352 | } | |
353 | timeout { | |
354 | fail "(timeout) maint print msymbols" | |
355 | } | |
356 | } | |
c499ed39 | 357 | gdb_test "cd ${mydir}" "Working directory [string_to_regexp ${mydir}]\..*" "cd to mydir" |
c906108c SS |
358 | |
359 | send_gdb "maint print symbols\n" | |
360 | gdb_expect { | |
361 | -re "Arguments missing: an output file name and an optional symbol file name.*$gdb_prompt $"\ | |
362 | { pass "maint print symbols w/o args" } | |
363 | -re ".*$gdb_prompt $" { fail "maint print symbols w/o args" } | |
364 | timeout { fail "(timeout) maint print symbols w/o args" } | |
365 | } | |
366 | ||
3bcbaac5 DJ |
367 | # Request symbols for one particular source file so that we don't try to |
368 | # dump the symbol information for the entire C library - over 500MB nowadays | |
369 | # for GNU libc. | |
adf40b2e | 370 | |
3bcbaac5 | 371 | send_gdb "maint print symbols symbols_output ${srcdir}/${subdir}/${srcfile}\n" |
c906108c | 372 | gdb_expect { |
3bcbaac5 | 373 | -re "^maint print symbols symbols_output \[^\n\]*\r\n$gdb_prompt $"\ |
c906108c SS |
374 | { |
375 | send_gdb "shell ls symbols_output\n" | |
376 | gdb_expect { | |
377 | -re "symbols_output\r\n$gdb_prompt $"\ | |
378 | { | |
379 | # See comments for `maint print psymbols'. | |
adf40b2e | 380 | send_gdb "shell grep 'main(.*block' symbols_output\n" |
c906108c SS |
381 | gdb_expect { |
382 | -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $"\ | |
383 | { pass "maint print symbols" } | |
384 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
385 | timeout { fail "(timeout) maint print symbols" } | |
386 | } | |
387 | gdb_test "shell rm -f symbols_output" "" | |
388 | ||
389 | } | |
390 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
391 | timeout { fail "(timeout) maint print symbols" } | |
392 | } | |
393 | } | |
394 | -re ".*$gdb_prompt $" { fail "maint print symbols" } | |
395 | timeout { fail "(timeout) maint print symbols" } | |
396 | } | |
397 | ||
b4ba55a1 JB |
398 | set msg "maint print type" |
399 | gdb_test_multiple "maint print type argc" $msg { | |
400 | -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 $" { | |
401 | pass $msg | |
402 | } | |
403 | } | |
c906108c | 404 | |
a0b3c4fd JM |
405 | if [istarget "hppa*-*-11*"] { |
406 | setup_xfail hppa*-*-*11* CLLbs14860 | |
407 | send "maint print unwind &main\n" | |
408 | expect { | |
409 | -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 $"\ | |
410 | { pass "maint print unwind" } | |
411 | -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 $"\ | |
412 | { xfail "maint print unwind" } | |
413 | -re ".*$gdb_prompt $" { xfail "maint info unwind" } | |
414 | timeout { fail "(timeout) maint print unwind" } | |
415 | } | |
416 | } | |
c906108c SS |
417 | |
418 | set oldtimeout $timeout | |
419 | set timeout [expr $timeout + 300] | |
420 | ||
421 | # It'd be nice to check for every possible section. However, that's | |
422 | # problematic, since the relative ordering wanders from release to | |
423 | # release of the compilers. Instead, we'll just check for two | |
424 | # sections which appear to always come out in the same relative | |
425 | # order. (If that changes, then we should just check for one | |
426 | # section.) | |
427 | # | |
428 | # And by the way: This testpoint will break for PA64, where a.out's | |
429 | # are ELF files. | |
293e2f9e DJ |
430 | |
431 | # Standard GNU names. | |
432 | set text_section ".text" | |
433 | set data_section ".data" | |
434 | ||
c906108c SS |
435 | send_gdb "maint info sections\n" |
436 | gdb_expect { | |
293e2f9e DJ |
437 | -re "Exec file:\r\n.*break($EXEEXT)?., file type.*ER_RO.*$gdb_prompt $" { |
438 | # Looks like RealView which uses different section names. | |
439 | set text_section ER_RO | |
440 | set data_section ER_RW | |
441 | pass "maint info sections" | |
442 | } | |
03dd63aa | 443 | -re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $"\ |
c906108c SS |
444 | { pass "maint info sections" } |
445 | -re ".*$gdb_prompt $" { fail "maint info sections" } | |
446 | timeout { fail "(timeout) maint info sections" } | |
447 | } | |
448 | ||
8ddad156 MS |
449 | # Test for new option: maint info sections <section name> |
450 | # If you don't have a .text section, this will require tweaking. | |
293e2f9e | 451 | send_gdb "maint info sections $text_section\n" |
8ddad156 | 452 | gdb_expect { |
0993fe05 | 453 | -re ".* \\.bss .*$gdb_prompt $" { fail "maint info sections .text" } |
293e2f9e DJ |
454 | -re ".* $data_section .*$gdb_prompt $" { fail "maint info sections .text" } |
455 | -re ".* $text_section .*$gdb_prompt $" { pass "maint info sections .text" } | |
0ab84fb7 | 456 | -re ".*$gdb_prompt $" { fail "maint info sections .text" } |
8ddad156 MS |
457 | timeout { fail "(timeout) maint info sections .text" } |
458 | } | |
459 | ||
460 | # Test for new option: CODE section flag | |
461 | # If your data section is tagged CODE, xfail this test. | |
462 | send_gdb "maint info sections CODE\n" | |
463 | gdb_expect { | |
293e2f9e DJ |
464 | -re ".* $data_section .*$gdb_prompt $" { fail "maint info sections CODE" } |
465 | -re ".* $text_section .*$gdb_prompt $" { pass "maint info sections CODE" } | |
0ab84fb7 | 466 | -re ".*$gdb_prompt $" { fail "maint info sections CODE" } |
8ddad156 MS |
467 | timeout { fail "(timeout) maint info sections CODE" } |
468 | } | |
469 | ||
470 | # Test for new option: DATA section flag | |
471 | # If your text section is tagged DATA, xfail this test. | |
dbdfa66c CV |
472 | # |
473 | # The "maint info sections DATA" test is marked for XFAIL on Cygwin, | |
474 | # because Windows has text sections marked DATA. | |
475 | setup_xfail "*-*-*cygwin*" | |
8ddad156 MS |
476 | send_gdb "maint info sections DATA\n" |
477 | gdb_expect { | |
293e2f9e DJ |
478 | -re ".* $text_section .*$gdb_prompt $" { fail "maint info sections DATA" } |
479 | -re ".* $data_section .*$gdb_prompt $" { pass "maint info sections DATA" } | |
759f0f0b | 480 | -re ".* .rodata .*$gdb_prompt $" { pass "maint info sections DATA" } |
0ab84fb7 | 481 | -re ".*$gdb_prompt $" { fail "maint info sections DATA" } |
8ddad156 MS |
482 | timeout { fail "(timeout) maint info sections DATA" } |
483 | } | |
484 | ||
a1dea79a FF |
485 | set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] |
486 | ||
c906108c SS |
487 | send_gdb "maint info breakpoints\n" |
488 | gdb_expect { | |
6c95b8df | 489 | -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 $"\ |
aaf320fa | 490 | { pass "maint info breakpoints" } |
6c95b8df | 491 | -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 $"\ |
aaf320fa FF |
492 | { pass "maint info breakpoints (with shlib events)" } |
493 | -re ".*$gdb_prompt $" { fail "maint info breakpoints" } | |
494 | timeout { fail "(timeout) maint info breakpoints" } | |
c906108c SS |
495 | } |
496 | ||
c906108c SS |
497 | send_gdb "maint print\n" |
498 | gdb_expect { | |
499 | -re "\"maintenance print\" must be followed by the name of a print command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ | |
500 | { pass "maint print w/o args" } | |
501 | -re ".*$gdb_prompt $" { fail "maint print w/o args" } | |
502 | timeout { fail "(timeout) maint print w/o args" } | |
503 | } | |
504 | ||
505 | send_gdb "maint info\n" | |
506 | gdb_expect { | |
507 | -re "\"maintenance info\" must be followed by the name of an info command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ | |
508 | { pass "maint info w/o args" } | |
509 | -re ".*$gdb_prompt $" { fail "maint info w/o args" } | |
510 | timeout { fail "(timeout) maint info w/o args" } | |
511 | } | |
512 | ||
513 | send_gdb "maint\n" | |
514 | gdb_expect { | |
515 | -re "\"maintenance\" must be followed by the name of a maintenance command\\.\r\nList.*unambiguous\\..*$gdb_prompt $"\ | |
516 | { pass "maint w/o args" } | |
517 | -re ".*$gdb_prompt $" { fail "maint w/o args" } | |
518 | timeout { fail "(timeout) maint w/o args" } | |
519 | } | |
520 | ||
521 | ||
522 | set timeout $oldtimeout | |
523 | ||
524 | #============test help on maint commands | |
525 | ||
526 | send_gdb "help maint\n" | |
527 | gdb_expect { | |
c60b7188 | 528 | -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../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\\..*$gdb_prompt $"\ |
c906108c SS |
529 | { pass "help maint" } |
530 | -re ".*$gdb_prompt $" { fail "help maint" } | |
531 | timeout { fail "(timeout) help maint" } | |
532 | } | |
533 | ||
534 | ||
535 | send_gdb "help maint check-symtabs\n" | |
536 | gdb_expect { | |
537 | -re "Check consistency of psymtabs and symtabs\\..*$gdb_prompt $"\ | |
538 | { pass "help maint check-symtabs" } | |
539 | -re ".*$gdb_prompt $" { fail "help maint check-symtabs" } | |
540 | timeout { fail "(timeout) help maint check-symtabs" } | |
541 | } | |
542 | ||
543 | send_gdb "help maint space\n" | |
544 | gdb_expect { | |
545 | -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 $"\ | |
546 | { pass "help maint space" } | |
547 | -re ".*$gdb_prompt $" { fail "help maint space" } | |
548 | timeout { fail "(timeout) help maint space" } | |
549 | } | |
550 | ||
551 | send_gdb "help maint time\n" | |
552 | gdb_expect { | |
553 | -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 $"\ | |
554 | { pass "help maint time" } | |
555 | -re ".*$gdb_prompt $" { fail "help maint time" } | |
556 | timeout { fail "(timeout) help maint time" } | |
557 | } | |
558 | ||
559 | send_gdb "help maint demangle\n" | |
560 | gdb_expect { | |
c60b7188 | 561 | -re "Demangle a C\\+\\+/ObjC mangled name\\.\r\nCall internal GDB demangler routine to demangle a C\\+\\+ link name\r\nand prints the result\\..*$gdb_prompt $"\ |
c906108c SS |
562 | { pass "help maint demangle" } |
563 | -re ".*$gdb_prompt $" { fail "help maint demangle" } | |
564 | timeout { fail "(timeout) help maint demangle" } | |
565 | } | |
566 | ||
567 | send_gdb "help maint dump-me\n" | |
568 | gdb_expect { | |
9e297a97 | 569 | -re "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\\..*$gdb_prompt $"\ |
c906108c SS |
570 | { pass "help maint dump-me" } |
571 | -re ".*$gdb_prompt $" { fail "help maint dump-me" } | |
572 | timeout { fail "(timeout) help maint dump-me" } | |
573 | } | |
574 | ||
7be570e7 JM |
575 | send_gdb "help maint internal-error\n" |
576 | gdb_expect { | |
577 | -re "Give GDB an internal error\\.\r\nCause GDB to behave as if an internal error was detected\\..*$gdb_prompt $"\ | |
578 | { pass "help maint internal-error" } | |
579 | -re ".*$gdb_prompt $" { fail "help maint internal-error" } | |
580 | timeout { fail "(timeout) help maint internal-error" } | |
581 | } | |
582 | ||
dec43320 AC |
583 | send_gdb "help maint internal-warning\n" |
584 | gdb_expect { | |
585 | -re "Give GDB an internal warning\\.\r\nCause GDB to behave as if an internal warning was reported\\..*$gdb_prompt $"\ | |
586 | { pass "help maint internal-warning" } | |
587 | -re ".*$gdb_prompt $" { fail "help maint internal-warning" } | |
588 | timeout { fail "(timeout) help maint internal-warning" } | |
589 | } | |
590 | ||
c906108c SS |
591 | send_gdb "help maint print statistics\n" |
592 | gdb_expect { | |
593 | -re "Print statistics about internal gdb state\\..*$gdb_prompt $"\ | |
594 | { pass "help maint print statistics" } | |
595 | -re ".*$gdb_prompt $" { fail "help maint print statistics" } | |
596 | timeout { fail "(timeout) help maint print statistics" } | |
597 | } | |
598 | ||
00905d52 AC |
599 | gdb_test "help maint print dummy-frames" \ |
600 | "Print the contents of the internal dummy-frame stack." | |
601 | ||
c906108c SS |
602 | send_gdb "help maint print objfiles\n" |
603 | gdb_expect { | |
604 | -re "Print dump of current object file definitions\\..*$gdb_prompt $"\ | |
605 | { pass "help maint print objfiles" } | |
606 | -re ".*$gdb_prompt $" { fail "help maint print objfiles" } | |
607 | timeout { fail "(timeout) help maint print objfiles" } | |
608 | } | |
609 | ||
610 | send_gdb "help maint print psymbols\n" | |
611 | gdb_expect { | |
612 | -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 $"\ | |
613 | { pass "help maint print psymbols" } | |
614 | -re ".*$gdb_prompt $" { fail "help maint print psymbols" } | |
615 | timeout { fail "(timeout) help maint print psymbols" } | |
616 | } | |
617 | ||
618 | send_gdb "help maint print msymbols\n" | |
619 | gdb_expect { | |
620 | -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 $"\ | |
621 | { pass "help maint print msymbols" } | |
622 | -re ".*$gdb_prompt $" { fail "help maint print msymbols" } | |
623 | timeout { fail "(timeout) help maint print msymbols" } | |
624 | } | |
625 | ||
626 | send_gdb "help maint print symbols\n" | |
627 | gdb_expect { | |
628 | -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 $"\ | |
629 | { pass "help maint print symbols" } | |
630 | -re ".*$gdb_prompt $" { fail "help maint print symbols" } | |
631 | timeout { fail "(timeout) help maint print symbols" } | |
632 | } | |
633 | ||
634 | ||
635 | send_gdb "help maint print type\n" | |
636 | gdb_expect { | |
637 | -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 $"\ | |
638 | { pass "help maint print type" } | |
639 | -re ".*$gdb_prompt $" { fail "help maint print type" } | |
640 | timeout { fail "(timeout) help maint print type" } | |
641 | } | |
642 | ||
a0b3c4fd JM |
643 | if [istarget "hppa*-*-*"] { |
644 | send_gdb "help maint print unwind\n" | |
645 | gdb_expect { | |
646 | -re "Print unwind table entry at given address\\..*$gdb_prompt $"\ | |
647 | { pass "help maint print unwind" } | |
648 | -re ".*$gdb_prompt $" { fail "help maint print unwind" } | |
649 | timeout { fail "(timeout) help maint print unwind" } | |
650 | } | |
651 | } | |
c906108c SS |
652 | |
653 | send_gdb "help maint info sections\n" | |
654 | gdb_expect { | |
655 | -re "List the BFD sections of the exec and core files\\..*$gdb_prompt $"\ | |
656 | { pass "help maint info sections" } | |
657 | -re ".*$gdb_prompt $" { fail "help maint info sections" } | |
658 | timeout { fail "(timeout) help maint info sections" } | |
659 | } | |
660 | ||
661 | ||
662 | send_gdb "help maint info breakpoints\n" | |
663 | gdb_expect { | |
664 | -re "Status of all breakpoints, or breakpoint number NUMBER.*$gdb_prompt $" { pass "help maint info breakpoints" } | |
665 | -re ".*$gdb_prompt $" { fail "help maint info breakpoints" } | |
666 | timeout { fail "(timeout) help maint info breakpoints" } | |
667 | } | |
668 | ||
669 | #send_gdb "help maint info breakpoints\n" | |
670 | #expect { | |
671 | # -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 $"\ | |
672 | # { pass "help maint info breakpoints" } | |
673 | # -re ".*$gdb_prompt $" { fail "help maint info breakpoints" } | |
674 | # timeout { fail "(timeout) help maint info breakpoints" } | |
675 | # } | |
676 | ||
677 | send_gdb "help maint info\n" | |
678 | gdb_expect { | |
679 | -re "Commands for showing internal info about the program being debugged.*unambiguous\\..*$gdb_prompt $"\ | |
680 | { pass "help maint info" } | |
681 | -re ".*$gdb_prompt $" { fail "help maint info" } | |
682 | timeout { fail "(timeout) help maint info" } | |
683 | } | |
684 | ||
d8295fe9 VP |
685 | test_prefix_command_help {"maint print" "maintenance print"} { |
686 | "Maintenance command for printing GDB internal state\\.\[\r\n\]+" | |
687 | } | |
c906108c | 688 | |
d8295fe9 VP |
689 | test_prefix_command_help {"maint" "maintenance"} { |
690 | "Commands for use by GDB maintainers\\.\[\r\n\]+" | |
691 | "Includes commands to dump specific internal GDB structures in\[\r\n\]+" | |
692 | "a human readable form, to cause GDB to deliberately dump core,\[\r\n\]+" | |
693 | "to test internal functions such as the C\\+\\+/ObjC demangler, etc\\.\[\r\n\]+" | |
694 | } | |
c906108c SS |
695 | |
696 | #set oldtimeout $timeout | |
697 | #set timeout [expr $timeout + 300] | |
698 | ||
699 | send_gdb "maint dump-me\n" | |
700 | gdb_expect { | |
701 | -re "Should GDB dump core.*\\(y or n\\) $"\ | |
702 | { send_gdb "n\n" | |
703 | gdb_expect { | |
704 | -re ".*$gdb_prompt $" { pass "maint dump-me" } | |
705 | timeout { fail "(timeout) maint dump-me" } | |
706 | } | |
707 | } | |
708 | -re ".*$gdb_prompt $" { fail "maint dump-me" } | |
709 | timeout { fail "(timeout) maint dump-me" } | |
710 | } | |
711 | ||
7be570e7 | 712 | send_gdb "maint internal-error\n" |
039cf96d AC |
713 | gdb_expect { |
714 | -re "A problem internal to GDB has been detected" { | |
715 | pass "maint internal-error" | |
716 | if [gdb_internal_error_resync] { | |
717 | pass "internal-error resync" | |
718 | } else { | |
719 | fail "internal-error resync" | |
7be570e7 JM |
720 | } |
721 | } | |
722 | -re ".*$gdb_prompt $" { | |
723 | fail "maint internal-error" | |
039cf96d | 724 | untested "internal-error resync" |
7be570e7 JM |
725 | } |
726 | timeout { | |
039cf96d AC |
727 | fail "maint internal-error (timeout)" |
728 | untested "internal-error resync" | |
7be570e7 JM |
729 | } |
730 | } | |
731 | ||
c906108c SS |
732 | #set timeout $oldtimeout |
733 | ||
734 | ||
735 | gdb_exit | |
736 | return 0 |