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