Reviewed and approved by Jim Blandy
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / list.exp
CommitLineData
74641dfb 1# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2003
b6ba6518 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
6# the Free Software Foundation; either version 2 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, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18# Please email any bugs, comments, and/or additions to this file to:
19# bug-gdb@prep.ai.mit.edu
20
21# This file was written by Fred Fish. (fnf@cygnus.com)
22
23if $tracelevel then {
24 strace $tracelevel
25}
26
27set prms_id 0
28set bug_id 0
29
30set testfile "list"
31set binfile ${objdir}/${subdir}/${testfile}
32
33# Need to download the header to the host.
34remote_download host ${srcdir}/${subdir}/list0.h list0.h
35
36
37if { [gdb_compile "${srcdir}/${subdir}/list0.c" "${binfile}0.o" object {debug}] != "" } {
38 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
39}
40
41if { [gdb_compile "${srcdir}/${subdir}/list1.c" "${binfile}1.o" object {debug}] != "" } {
42 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
43}
44
45if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } {
46 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
47}
48
49
50
51# Create and source the file that provides information about the compiler
52# used to compile the test case.
53if [get_compiler_info ${binfile}] {
54 return -1;
55}
56
57#
58# Local utility proc just to set and verify listsize
59# Return 1 if success, 0 if fail.
60#
61
62set set_listsize_count 0;
63
64proc set_listsize { arg } {
65 global gdb_prompt
66 global set_listsize_count;
67
68 incr set_listsize_count;
69 if [gdb_test "set listsize $arg" "" "setting listsize to $arg #$set_listsize_count"] {
70 return 0;
71 }
72 if { $arg <= 0 } {
73 set arg "unlimited";
74 }
75
76 if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show listsize $arg #$set_listsize_count"] {
77 return 0;
78 }
79 return 1
80}
81
82#
83# Test display of listsize lines around a given line number.
84#
85
86proc test_listsize {} {
87 global gdb_prompt
085dd6e6
JM
88 global hp_cc_compiler
89 global hp_aCC_compiler
c906108c
SS
90
91 # Show default size
92
93 gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
94
95 # Show the default lines
d7679631
FF
96 # Note that remote targets that have debugging info for _start available will
97 # list the lines there instead of main, so we skip this test for remote targets.
c906108c
SS
98 # The second case is for optimized code, it is still correct.
99
d7679631
FF
100 if [is_remote target] {
101 runto_main;
102 unsupported "list default lines around main";
103 } else {
104 gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*10\[ \t\]+x = 0;|2.*11\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
105 }
c906108c
SS
106
107 # Ensure we can limit printouts to one line
108
085dd6e6 109 if [set_listsize 1] {
c906108c 110 gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1"
c906108c
SS
111 gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1"
112 }
113
114 # Try just two lines
115
116 if [ set_listsize 2 ] {
d4f3574e 117 gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 2"
c906108c 118 gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2"
085dd6e6 119 gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2"
c906108c
SS
120 }
121
122 # Try small listsize > 1 that is an odd number
123
124 if [ set_listsize 3 ] {
d4f3574e 125 gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 1 with listsize 3"
085dd6e6 126 gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3"
085dd6e6 127 gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3"
c906108c
SS
128 }
129
130 # Try small listsize > 2 that is an even number.
131
132 if [ set_listsize 4 ] then {
d4f3574e
SS
133 gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 1 with listsize 4"
134 gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 2 with listsize 4"
c906108c
SS
135
136 gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4"
137 gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4"
138 }
139
140 # Try a size larger than the entire file.
141
142 if [ set_listsize 100 ] then {
085dd6e6 143 gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 1 with listsize 100"
c906108c 144
085dd6e6 145 gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 10 with listsize 100"
c906108c
SS
146 }
147
148 # Try listsize of 0 which suppresses printing.
149
150 set_listsize 0
151 gdb_test "list 1" "" "listsize of 0 suppresses output"
152
153 # Try listsize of -1 which is special, and means unlimited.
154
155 set_listsize -1
156 setup_xfail "*-*-*"
157 gdb_test "list 1" "1\[ \t\]+#include .*\r\n39\[ \t\]+\}" "list line 1 with unlimited listsize"
158}
159
160#
161# Test "list filename:number" for C include file
162#
163
164proc test_list_include_file {} {
165 global gdb_prompt
166
c906108c 167 setup_xfail_format "COFF"
d4f3574e 168 gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*10\[ \t\]+bar \\(x\\+\\+\\);" "list line 1 in include file"
c906108c 169
c906108c 170 setup_xfail_format "COFF"
085dd6e6 171 gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF"
c906108c
SS
172}
173
174#
175# Test "list filename:number" for C source file
176#
177
178proc test_list_filename_and_number {} {
179 global gdb_prompt
180
181 set testcnt 0
182
183 send_gdb "list list0.c:1\n"
184 gdb_expect {
d4f3574e 185 -re "1\[ \t\]+#include \"list0.h\".*10\[ \t]+x = 0;\r\n$gdb_prompt $" {
c906108c
SS
186 incr testcnt
187 }
188 -re ".*$gdb_prompt $" { fail "list list0.c:1" ; gdb_suppress_tests }
189 timeout { fail "list list0.c:1 (timeout)" ; gdb_suppress_tests }
190 }
191 send_gdb "list list0.c:10\n"
192 gdb_expect {
193 -re "5\[ \t\]+int x;.*14\[ \t\]+foo .x\[+)\]+;\r\n$gdb_prompt $" {
194 incr testcnt
195 }
196 -re ".*$gdb_prompt $" { fail "list list.c:10" ; gdb_suppress_tests }
197 timeout { fail "list list.c:10 (timeout)" ; gdb_suppress_tests }
198 }
199 send_gdb "list list1.c:1\n"
200 gdb_expect {
085dd6e6 201 -re "1\[ \t\]+\#include.*4\[ \t\]+.*int oof\[ \t\]*\(.*\);\r\n.*$gdb_prompt $" {
c906108c
SS
202 incr testcnt
203 }
204 -re ".*$gdb_prompt $" { fail "list list1.c:1" ; gdb_suppress_tests }
205 timeout { fail "list list1.c:1 (timeout)" ; gdb_suppress_tests }
206 }
207 send_gdb "list list1.c:12\n"
208 gdb_expect {
085dd6e6 209 -re "12\[ \t\]+long_line \[(\]+.*\[)\]+;.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {
c906108c
SS
210 incr testcnt
211 }
212 -re ".*$gdb_prompt $" { fail "list list1.c:12" ; gdb_suppress_tests }
213 timeout { fail "list list1.c:12 (timeout)" ; gdb_suppress_tests }
214 }
215 pass "list filename:number ($testcnt tests)"
216 gdb_stop_suppressing_tests;
217}
218
219#
220# Test "list function" for C source file
221#
222
223proc test_list_function {} {
224 global gdb_prompt
c906108c
SS
225
226 # gcc appears to generate incorrect debugging information for code
227 # in include files, which breaks this test.
228 # SunPRO cc is the second case below, it's also correct.
d4f3574e 229 gdb_test "list main" "(5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\]+#include .*10\[ \t\]+x = 0;)" "list function in source file 1"
c906108c
SS
230
231 # Ultrix gdb takes the second case below; it's also correct.
232 # SunPRO cc is the third case.
085dd6e6 233 gdb_test "list bar" "(4\[ \t\]+void.*\[ \t\]*long_line.*;.*bar.*9\[ \t\]*.*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;|7\[ \t\]+void.*14\[ \t\]+\})" "list function in source file 2"
c906108c
SS
234
235 # Test "list function" for C include file
236 # Ultrix gdb is the second case, still correct.
237 # SunPRO cc is the third case.
c906108c
SS
238 gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+including file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;)" "list function in include file"
239}
240
241proc test_list_forward {} {
242 global gdb_prompt
243
244 set testcnt 0
245
246 send_gdb "list list0.c:10\n"
247 gdb_expect {
248 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
249 -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }
250 timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }
251 }
252
253 send_gdb "list\n"
254 gdb_expect {
255 -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
256 -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }
257 timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }
258 }
259
260 send_gdb "list\n"
261 gdb_expect {
262 -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
263 -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }
264 timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }
265 }
266
267 send_gdb "list\n"
268 gdb_expect {
085dd6e6 269 -re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr testcnt }
c906108c
SS
270 -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }
271 timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }
272 }
273
274 pass "successive list commands to page forward ($testcnt tests)"
275 gdb_stop_suppressing_tests;
276}
277
a0b3c4fd
JM
278# Test that repeating the list linenum command doesn't print the same
279# lines over again. Note that this test makes sure that the argument
280# linenum is dropped, when we repeat the previous command. 'x/5i $pc'
281# works the same way.
282
283proc test_repeat_list_command {} {
284 global gdb_prompt
285
286 set testcnt 0
287
288 send_gdb "list list0.c:10\n"
289 gdb_expect {
290 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
291 -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }
292 timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }
293 }
294
295 send_gdb "\n"
296 gdb_expect {
297 -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
298 -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }
299 timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }
300 }
301
302 send_gdb "\n"
303 gdb_expect {
304 -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
305 -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }
306 timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }
307 }
308
309 send_gdb "\n"
310 gdb_expect {
311 -re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr testcnt }
312 -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }
313 timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }
314 }
315
316 pass "repeat list commands to page forward using 'return' ($testcnt tests)"
317 gdb_stop_suppressing_tests;
318}
319
c906108c
SS
320proc test_list_backwards {} {
321 global gdb_prompt
322
323 set testcnt 0
324
325 send_gdb "list list0.c:33\n"
326 gdb_expect {
085dd6e6 327 -re "28\[ \t\]+foo \\(.*\\);.*37\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt }
c906108c
SS
328 -re ".*$gdb_prompt $" { fail "list list0.c:33" ; gdb_suppress_tests }
329 timeout { fail "list list0.c:33 (timeout)" ; gdb_suppress_tests }
330 }
331
332 send_gdb "list -\n"
333 gdb_expect {
334 -re "18\[ \t\]+foo \[(\]+.*\[)\]+;.*27\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
335 -re ".*$gdb_prompt $" { fail "list 18-27" ; gdb_suppress_tests }
336 timeout { fail "list 18-27 (timeout)" ; gdb_suppress_tests }
337 }
338
339 send_gdb "list -\n"
340 gdb_expect {
341 -re "8\[ \t\]+breakpoint\[(\]\[)\];.*17\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
342 -re ".*$gdb_prompt $" { fail "list 8-17" ; gdb_suppress_tests }
343 timeout { fail "list 8-17 (timeout)" ; gdb_suppress_tests }
344 }
345
346 send_gdb "list -\n"
347 gdb_expect {
348 -re "1\[ \t\]+#include .*7\[ \t\]+set_debug_traps\[(\]\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
349 -re ".*$gdb_prompt $" { fail "list 1-7" ; gdb_suppress_tests }
350 timeout { fail "list 1-7 (timeout)" ; gdb_suppress_tests }
351 }
352
353 pass "$testcnt successive \"list -\" commands to page backwards"
354 gdb_stop_suppressing_tests;
355}
356
357#
358# Test "list first,last"
359#
360
361proc test_list_range {} {
362 global gdb_prompt
363
085dd6e6 364 gdb_test "list list0.c:2,list0.c:5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; filename:line1,filename:line2"
c906108c 365
085dd6e6 366 gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2"
c906108c
SS
367
368# gdb_test "list -1,6" "Line number 0 out of range; .*list0.c has 39 lines." "list range; lower bound negative"
369
370# gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative"
371
085dd6e6 372 gdb_test "list 30,45" "30\[ \t\]+foo \(.*\);.*43\[ \t\]+\}" "list range; upper bound past EOF"
c906108c 373
085dd6e6 374 gdb_test "list 45,100" "Line number 45 out of range; .*list0.c has 43 lines." "list range; both bounds past EOF"
c906108c
SS
375
376 gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in different files." "list range, must be same files"
377}
378
379#
380# Test "list filename:function"
381#
382
383proc test_list_filename_and_function {} {
384 global gdb_prompt
385
386 set testcnt 0
387
388 # gcc appears to generate incorrect debugging information for code
389 # in include files, which breaks this test.
390 # SunPRO cc is the second case below, it's also correct.
c906108c
SS
391 send_gdb "list list0.c:main\n"
392 gdb_expect {
d4f3574e 393 -re "1\[ \t\]+#include .*10\[ \t\]+x = 0;\r\n$gdb_prompt $" {
c906108c
SS
394 incr testcnt
395 }
396 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
397 pass "list function in source file 1"
398 }
399 -re ".*$gdb_prompt $" { fail "list list0.c:main" }
400 timeout { fail "list list0.c:main (timeout)" }
401 }
402
c906108c
SS
403 # Not sure what the point of having this function be unused is.
404 # AIX is legitimately removing it.
405 setup_xfail "rs6000-*-aix*"
406 send_gdb "list list0.c:unused\n"
407 gdb_expect {
085dd6e6 408 -re "40\[ \t\]+unused.*43\[ \t\]+\}\r\n$gdb_prompt $" {
c906108c
SS
409 incr testcnt
410 }
411 -re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" {
412 incr testcnt
413 }
414 -re ".*$gdb_prompt $" { fail "list list0.c:unused" }
415 timeout { fail "list list0.c:unused (timeout)" }
416 }
417 clear_xfail "rs6000-*-aix*"
418
419 # gcc appears to generate incorrect debugging information for code
420 # in include files, which breaks this test.
421 # Ultrix gdb is the second case, one line different but still correct.
422 # SunPRO cc is the third case.
423 setup_xfail "rs6000-*-*" 1804
c906108c
SS
424 setup_xfail_format "COFF"
425 send_gdb "list list0.h:foo\n"
426 gdb_expect {
427 -re "2\[ \t\]+including file. This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
428 incr testcnt
429 }
430 -re "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
431 incr testcnt
432 }
433 -re "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
434 incr testcnt
435 }
436 -re "No source file named list0.h.\r\n$gdb_prompt $" {
437 fail "list list0.h:foo"
438 }
439 -re ".*$gdb_prompt $" { fail "list list0.h:foo" }
440 timeout { fail "list list0.h:foo (timeout)" }
441 }
442
443 # Ultrix gdb is the second case.
c906108c
SS
444 send_gdb "list list1.c:bar\n"
445 gdb_expect {
085dd6e6 446 -re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" {
c906108c
SS
447 incr testcnt
448 }
085dd6e6 449 -re "4\[ \t\]+void.*12\[ \t\]*long_line ..;\r\n$gdb_prompt $" {
c906108c
SS
450 incr testcnt
451 }
085dd6e6 452 -re "4\[ \t\]+void.*11\[ \t\]*\r\n$gdb_prompt $" {
c906108c
SS
453 incr testcnt
454 }
455 -re ".*$gdb_prompt $" { fail "list list1.c:bar" }
456 timeout { fail "list list1.c:bar (timeout)" }
457 }
458
c906108c
SS
459 # Not sure what the point of having this function be unused is.
460 # AIX is legitimately removing it.
461 setup_xfail "rs6000-*-aix*"
462 send_gdb "list list1.c:unused\n"
463 gdb_expect {
085dd6e6 464 -re "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {
c906108c
SS
465 incr testcnt
466 }
085dd6e6 467 -re "14.*19\[ \t\]+\}\r\n.*$gdb_prompt $" {
c906108c
SS
468 incr testcnt
469 }
470 -re ".*$gdb_prompt $" { fail "list list1.c:unused" }
471 timeout { fail "list list1.c:unused (timeout)" }
472 }
473 clear_xfail "rs6000-*-aix*"
474
475 pass "list filename:function ($testcnt tests)"
476
477 # Test some invalid specs
478 # The following test takes the FIXME result on most systems using
479 # DWARF. It fails to notice that main() is not in the file requested.
480
481 setup_xfail "*-*-*"
482
483# Does this actually work ANYWHERE? I believe not, as this is an `aspect' of
484# lookup_symbol(), where, when it is given a specific symtab which does not
485# contain the requested symbol, it will subsequently search all of the symtabs
486# for the requested symbol.
487
488 gdb_test "list list0.c:foo" "Function \"foo\" not defined in .*list0.c" "list filename:function; wrong filename rejected"
489
085dd6e6 490 gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file"
c906108c 491
085dd6e6 492 gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function"
c906108c
SS
493
494}
495
496proc test_forward_search {} {
497 global timeout
498
499 gdb_test "set listsize 4" ""
500 # On SunOS4, this gives us lines 19-22. On AIX, it gives us
501 # lines 20-23. This depends on whether the line number of a function
502 # is considered to be the openbrace or the first statement--either one
503 # is acceptable.
085dd6e6 504 gdb_test "list long_line" "24\[ \t\]+long_line .*"
c906108c
SS
505
506 gdb_test "search 4321" " not found"
507
085dd6e6 508 gdb_test "search 6789" "28\[ \t\]+oof .6789.;"
c906108c
SS
509
510 # Test that GDB won't crash if the line being searched is extremely long.
511
512 set oldtimeout $timeout
513 set timeout [expr "$timeout + 300"]
514 verbose "Timeout is now $timeout seconds" 2
515 gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)"
516 set timeout $oldtimeout
517 verbose "Timeout is now $timeout seconds" 2
518}
519
520# Start with a fresh gdb.
521
522gdb_exit
523gdb_start
524gdb_reinitialize_dir $srcdir/$subdir
525gdb_load ${binfile}
526
527if [target_info exists gdb_stub] {
528 gdb_step_for_stub;
529}
530
531gdb_test "set width 0" "" "set width 0"
532
533test_listsize
534get_debug_format
535if [ set_listsize 10 ] then {
536 test_list_include_file
537 test_list_filename_and_number
538 test_list_function
539 test_list_forward
540 test_list_backwards
a0b3c4fd 541 test_repeat_list_command
c906108c
SS
542 test_list_range
543 test_list_filename_and_function
544 test_forward_search
545}
085dd6e6
JM
546
547remote_exec build "rm -f list0.h"
This page took 0.679331 seconds and 4 git commands to generate.