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