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