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