OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [gdb-5.3/] [gdb/] [testsuite/] [gdb.base/] [list.exp] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2002
2
# Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 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
 
23
if $tracelevel then {
24
        strace $tracelevel
25
}
26
 
27
set prms_id 0
28
set bug_id 0
29
 
30
set testfile "list"
31
set binfile ${objdir}/${subdir}/${testfile}
32
 
33
# Need to download the header to the host.
34
remote_download host ${srcdir}/${subdir}/list0.h list0.h
35
 
36
 
37
if  { [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
 
41
if  { [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
 
45
if  { [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.
53
if [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
 
62
set set_listsize_count 0;
63
 
64
proc 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
 
86
proc test_listsize {} {
87
    global gdb_prompt
88
    global hp_cc_compiler
89
    global hp_aCC_compiler
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
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.
98
    # The second case is for optimized code, it is still correct.
99
 
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
    }
106
 
107
    # Ensure we can limit printouts to one line
108
 
109
    if [set_listsize 1] {
110
        gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1"
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 ] {
117
        gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 2"
118
        gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2"
119
        gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2"
120
    }
121
 
122
    # Try small listsize > 1 that is an odd number
123
 
124
    if [ set_listsize 3 ] {
125
        gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 1 with listsize 3"
126
        gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3"
127
        gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3"
128
    }
129
 
130
    # Try small listsize > 2 that is an even number.
131
 
132
    if [ set_listsize 4 ] then {
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"
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 {
143
        gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 1 with listsize 100"
144
 
145
        gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 10 with listsize 100"
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
 
164
proc test_list_include_file {} {
165
    global gdb_prompt
166
 
167
    setup_xfail_format "DWARF 1"
168
    setup_xfail_format "COFF"
169
    gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*10\[ \t\]+bar \\(x\\+\\+\\);" "list line 1 in include file"
170
 
171
    setup_xfail_format "DWARF 1"
172
    setup_xfail_format "COFF"
173
    gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF"
174
}
175
 
176
#
177
# Test "list filename:number" for C source file
178
#
179
 
180
proc test_list_filename_and_number {} {
181
    global gdb_prompt
182
 
183
    set testcnt 0
184
 
185
    send_gdb "list list0.c:1\n"
186
    gdb_expect {
187
        -re "1\[ \t\]+#include \"list0.h\".*10\[ \t]+x = 0;\r\n$gdb_prompt $" {
188
            incr testcnt
189
        }
190
        -re ".*$gdb_prompt $" { fail "list list0.c:1" ; gdb_suppress_tests }
191
        timeout { fail "list list0.c:1 (timeout)" ; gdb_suppress_tests }
192
    }
193
    send_gdb "list list0.c:10\n"
194
    gdb_expect {
195
        -re "5\[ \t\]+int x;.*14\[ \t\]+foo .x\[+)\]+;\r\n$gdb_prompt $" {
196
            incr testcnt
197
        }
198
        -re ".*$gdb_prompt $" { fail "list list.c:10" ; gdb_suppress_tests }
199
        timeout { fail "list list.c:10 (timeout)" ; gdb_suppress_tests }
200
    }
201
    send_gdb "list list1.c:1\n"
202
    gdb_expect {
203
        -re "1\[ \t\]+\#include.*4\[ \t\]+.*int oof\[ \t\]*\(.*\);\r\n.*$gdb_prompt $" {
204
            incr testcnt
205
        }
206
        -re ".*$gdb_prompt $" { fail "list list1.c:1" ; gdb_suppress_tests }
207
        timeout { fail "list list1.c:1 (timeout)" ; gdb_suppress_tests }
208
    }
209
    send_gdb "list list1.c:12\n"
210
    gdb_expect {
211
        -re "12\[ \t\]+long_line \[(\]+.*\[)\]+;.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {
212
            incr testcnt
213
        }
214
        -re ".*$gdb_prompt $" { fail "list list1.c:12" ; gdb_suppress_tests }
215
        timeout { fail "list list1.c:12 (timeout)" ; gdb_suppress_tests }
216
    }
217
    pass "list filename:number ($testcnt tests)"
218
    gdb_stop_suppressing_tests;
219
}
220
 
221
#
222
# Test "list function" for C source file
223
#
224
 
225
proc test_list_function {} {
226
    global gdb_prompt
227
    global gcc_compiled
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.
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"
233
 
234
    # Ultrix gdb takes the second case below; it's also correct.
235
    # SunPRO cc is the third case.
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"
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.
241
    setup_xfail "powerpc-*-*"
242
    setup_xfail_format "DWARF 1"
243
    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"
244
}
245
 
246
proc test_list_forward {} {
247
    global gdb_prompt
248
 
249
    set testcnt 0
250
 
251
    send_gdb "list list0.c:10\n"
252
    gdb_expect {
253
        -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
254
        -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }
255
        timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }
256
    }
257
 
258
    send_gdb "list\n"
259
    gdb_expect {
260
        -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
261
        -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }
262
        timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }
263
    }
264
 
265
    send_gdb "list\n"
266
    gdb_expect {
267
        -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
268
        -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }
269
        timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }
270
    }
271
 
272
    send_gdb "list\n"
273
    gdb_expect {
274
        -re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr testcnt }
275
        -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }
276
        timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }
277
    }
278
 
279
    pass "successive list commands to page forward ($testcnt tests)"
280
    gdb_stop_suppressing_tests;
281
}
282
 
283
# Test that repeating the list linenum command doesn't print the same
284
# lines over again.  Note that this test makes sure that the argument
285
# linenum is dropped, when we repeat the previous command. 'x/5i $pc'
286
# works the same way.
287
 
288
proc test_repeat_list_command {} {
289
    global gdb_prompt
290
 
291
    set testcnt 0
292
 
293
    send_gdb "list list0.c:10\n"
294
    gdb_expect {
295
        -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
296
        -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }
297
        timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }
298
    }
299
 
300
    send_gdb "\n"
301
    gdb_expect {
302
        -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
303
        -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }
304
        timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }
305
    }
306
 
307
    send_gdb "\n"
308
    gdb_expect {
309
        -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
310
        -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }
311
        timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }
312
    }
313
 
314
    send_gdb "\n"
315
    gdb_expect {
316
        -re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr testcnt }
317
        -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }
318
        timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }
319
    }
320
 
321
    pass "repeat list commands to page forward using 'return' ($testcnt tests)"
322
    gdb_stop_suppressing_tests;
323
}
324
 
325
proc test_list_backwards {} {
326
    global gdb_prompt
327
 
328
    set testcnt 0
329
 
330
    send_gdb "list list0.c:33\n"
331
    gdb_expect {
332
        -re "28\[ \t\]+foo \\(.*\\);.*37\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt }
333
        -re ".*$gdb_prompt $" { fail "list list0.c:33" ; gdb_suppress_tests }
334
        timeout { fail "list list0.c:33 (timeout)" ; gdb_suppress_tests }
335
    }
336
 
337
    send_gdb "list -\n"
338
    gdb_expect {
339
        -re "18\[ \t\]+foo \[(\]+.*\[)\]+;.*27\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
340
        -re ".*$gdb_prompt $" { fail "list 18-27" ; gdb_suppress_tests }
341
        timeout { fail "list 18-27 (timeout)" ; gdb_suppress_tests }
342
    }
343
 
344
    send_gdb "list -\n"
345
    gdb_expect {
346
        -re "8\[ \t\]+breakpoint\[(\]\[)\];.*17\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
347
        -re ".*$gdb_prompt $" { fail "list 8-17" ; gdb_suppress_tests }
348
        timeout { fail "list 8-17 (timeout)" ; gdb_suppress_tests }
349
    }
350
 
351
    send_gdb "list -\n"
352
    gdb_expect {
353
        -re "1\[ \t\]+#include .*7\[ \t\]+set_debug_traps\[(\]\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
354
        -re ".*$gdb_prompt $" { fail "list 1-7" ; gdb_suppress_tests }
355
        timeout { fail "list 1-7 (timeout)" ; gdb_suppress_tests }
356
    }
357
 
358
    pass "$testcnt successive \"list -\" commands to page backwards"
359
    gdb_stop_suppressing_tests;
360
}
361
 
362
#
363
# Test "list first,last"
364
#
365
 
366
proc test_list_range {} {
367
    global gdb_prompt
368
 
369
    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"
370
 
371
    gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2"
372
 
373
#    gdb_test     "list -1,6"   "Line number 0 out of range; .*list0.c has 39 lines." "list range; lower bound negative"
374
 
375
#    gdb_test     "list -100,-40"       "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative"
376
 
377
    gdb_test "list 30,45" "30\[ \t\]+foo \(.*\);.*43\[ \t\]+\}" "list range; upper bound past EOF"
378
 
379
    gdb_test "list 45,100" "Line number 45 out of range; .*list0.c has 43 lines." "list range; both bounds past EOF"
380
 
381
    gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in different files." "list range, must be same files"
382
}
383
 
384
#
385
# Test "list filename:function"
386
#
387
 
388
proc test_list_filename_and_function {} {
389
    global gdb_prompt
390
 
391
    set testcnt 0
392
 
393
    # gcc appears to generate incorrect debugging information for code
394
    # in include files, which breaks this test.
395
    # SunPRO cc is the second case below, it's also correct.
396
    send_gdb "list list0.c:main\n"
397
    gdb_expect {
398
        -re "1\[ \t\]+#include .*10\[ \t\]+x = 0;\r\n$gdb_prompt $" {
399
            incr testcnt
400
        }
401
        -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
402
            pass "list function in source file 1"
403
        }
404
        -re ".*$gdb_prompt $" { fail "list list0.c:main" }
405
        timeout { fail "list list0.c:main (timeout)" }
406
    }
407
 
408
    # The i960 is a second case
409
 
410
    # Not sure what the point of having this function be unused is.
411
    # AIX is legitimately removing it.
412
    setup_xfail "rs6000-*-aix*"
413
    send_gdb "list list0.c:unused\n"
414
    gdb_expect {
415
        -re "40\[ \t\]+unused.*43\[ \t\]+\}\r\n$gdb_prompt $" {
416
            incr testcnt
417
        }
418
        -re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" {
419
            incr testcnt
420
        }
421
        -re ".*$gdb_prompt $" { fail "list list0.c:unused" }
422
        timeout { fail "list list0.c:unused (timeout)" }
423
    }
424
    clear_xfail "rs6000-*-aix*"
425
 
426
    # gcc appears to generate incorrect debugging information for code
427
    # in include files, which breaks this test.
428
    # Ultrix gdb is the second case, one line different but still correct.
429
    # SunPRO cc is the third case.
430
    setup_xfail "rs6000-*-*" 1804
431
    setup_xfail "powerpc-*-*" 1804
432
    setup_xfail_format "DWARF 1"
433
    setup_xfail_format "COFF"
434
    send_gdb "list list0.h:foo\n"
435
    gdb_expect {
436
        -re "2\[ \t\]+including file.  This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
437
            incr testcnt
438
        }
439
        -re "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
440
            incr testcnt
441
        }
442
        -re "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
443
            incr testcnt
444
        }
445
        -re "No source file named list0.h.\r\n$gdb_prompt $" {
446
            fail "list list0.h:foo"
447
        }
448
        -re ".*$gdb_prompt $" { fail "list list0.h:foo" }
449
        timeout { fail "list list0.h:foo (timeout)" }
450
    }
451
 
452
    # Ultrix gdb is the second case.
453
    send_gdb "list list1.c:bar\n"
454
    gdb_expect {
455
        -re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" {
456
            incr testcnt
457
        }
458
        -re "4\[ \t\]+void.*12\[ \t\]*long_line ..;\r\n$gdb_prompt $" {
459
            incr testcnt
460
        }
461
        -re "4\[ \t\]+void.*11\[ \t\]*\r\n$gdb_prompt $" {
462
            incr testcnt
463
        }
464
        -re ".*$gdb_prompt $" { fail "list list1.c:bar" }
465
        timeout { fail "list list1.c:bar (timeout)" }
466
    }
467
 
468
    # The i960 is a second case
469
 
470
    # Not sure what the point of having this function be unused is.
471
    # AIX is legitimately removing it.
472
    setup_xfail "rs6000-*-aix*"
473
    send_gdb "list list1.c:unused\n"
474
    gdb_expect {
475
        -re "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {
476
            incr testcnt
477
        }
478
        -re "14.*19\[ \t\]+\}\r\n.*$gdb_prompt $" {
479
            incr testcnt
480
        }
481
        -re ".*$gdb_prompt $" { fail "list list1.c:unused" }
482
        timeout { fail "list list1.c:unused (timeout)" }
483
    }
484
    clear_xfail "rs6000-*-aix*"
485
 
486
    pass "list filename:function ($testcnt tests)"
487
 
488
    # Test some invalid specs
489
    # The following test takes the FIXME result on most systems using
490
    # DWARF.  It fails to notice that main() is not in the file requested.
491
 
492
    setup_xfail "*-*-*"
493
 
494
# Does this actually work ANYWHERE?  I believe not, as this is an `aspect' of
495
# lookup_symbol(), where, when it is given a specific symtab which does not
496
# contain the requested symbol, it will subsequently search all of the symtabs
497
# for the requested symbol.
498
 
499
    gdb_test "list list0.c:foo" "Function \"foo\" not defined in .*list0.c" "list filename:function; wrong filename rejected"
500
 
501
    gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file"
502
 
503
    setup_xfail_format "DWARF 1"
504
    gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function"
505
 
506
}
507
 
508
proc test_forward_search {} {
509
        global timeout
510
 
511
        gdb_test "set listsize 4" ""
512
        # On SunOS4, this gives us lines 19-22.  On AIX, it gives us
513
        # lines 20-23.  This depends on whether the line number of a function
514
        # is considered to be the openbrace or the first statement--either one
515
        # is acceptable.
516
        gdb_test "list long_line" "24\[ \t\]+long_line .*"
517
 
518
        gdb_test "search 4321" " not found"
519
 
520
        gdb_test "search 6789" "28\[ \t\]+oof .6789.;"
521
 
522
        # Test that GDB won't crash if the line being searched is extremely long.
523
 
524
        set oldtimeout $timeout
525
        set timeout [expr "$timeout + 300"]
526
        verbose "Timeout is now $timeout seconds" 2
527
        gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 chars)"
528
        set timeout $oldtimeout
529
        verbose "Timeout is now $timeout seconds" 2
530
}
531
 
532
# Start with a fresh gdb.
533
 
534
gdb_exit
535
gdb_start
536
gdb_reinitialize_dir $srcdir/$subdir
537
gdb_load ${binfile}
538
 
539
if [target_info exists gdb_stub] {
540
    gdb_step_for_stub;
541
}
542
 
543
gdb_test "set width 0" "" "set width 0"
544
 
545
test_listsize
546
get_debug_format
547
if [ set_listsize 10 ] then {
548
    test_list_include_file
549
    test_list_filename_and_number
550
    test_list_function
551
    test_list_forward
552
    test_list_backwards
553
    test_repeat_list_command
554
    test_list_range
555
    test_list_filename_and_function
556
    test_forward_search
557
}
558
 
559
remote_exec build "rm -f list0.h"

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.