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