OLD | NEW |
1 # Copyright 1992, 1994-1999, 2002-2003, 2007-2012 Free Software | 1 # Copyright 1992, 1994-1999, 2002-2003, 2007-2012 Free Software |
2 # Foundation, Inc. | 2 # Foundation, Inc. |
3 | 3 |
4 # This program is free software; you can redistribute it and/or modify | 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 | 5 # it under the terms of the GNU General Public License as published by |
6 # the Free Software Foundation; either version 3 of the License, or | 6 # the Free Software Foundation; either version 3 of the License, or |
7 # (at your option) any later version. | 7 # (at your option) any later version. |
8 # | 8 # |
9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. |
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
17 # This file was written by Fred Fish. (fnf@cygnus.com) | 17 # This file was written by Fred Fish. (fnf@cygnus.com) |
18 | 18 |
19 if $tracelevel then { | |
20 strace $tracelevel | |
21 } | |
22 | |
23 | 19 |
24 set testfile "list" | 20 set testfile "list" |
25 set binfile ${objdir}/${subdir}/${testfile} | 21 set binfile ${objdir}/${subdir}/${testfile} |
26 | 22 |
27 # Need to download the header to the host. | 23 # Need to download the header to the host. |
28 remote_download host ${srcdir}/${subdir}/list0.h list0.h | 24 remote_download host ${srcdir}/${subdir}/list0.h list0.h |
29 | 25 |
30 | 26 |
31 if { [gdb_compile "${srcdir}/${subdir}/list0.c" "${binfile}0.o" object {debug}]
!= "" } { | 27 if { [gdb_compile "${srcdir}/${subdir}/list0.c" "${binfile}0.o" object {debug}]
!= "" } { |
32 untested list.exp | 28 untested list.exp |
33 return -1 | 29 return -1 |
34 } | 30 } |
35 | 31 |
36 if { [gdb_compile "${srcdir}/${subdir}/list1.c" "${binfile}1.o" object {debug}]
!= "" } { | 32 if { [gdb_compile "${srcdir}/${subdir}/list1.c" "${binfile}1.o" object {debug}]
!= "" } { |
37 untested list.exp | 33 untested list.exp |
38 return -1 | 34 return -1 |
39 } | 35 } |
40 | 36 |
41 if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}]
!= "" } { | 37 if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}]
!= "" } { |
42 untested list.exp | 38 untested list.exp |
43 return -1 | 39 return -1 |
44 } | 40 } |
45 | 41 |
46 | 42 |
47 | 43 |
48 # Create and source the file that provides information about the compiler | 44 # Create and source the file that provides information about the compiler |
49 # used to compile the test case. | 45 # used to compile the test case. |
50 if [get_compiler_info ${binfile}] { | 46 if [get_compiler_info] { |
51 return -1; | 47 return -1; |
52 } | 48 } |
53 | 49 |
54 # | 50 # |
55 # Local utility proc just to set and verify listsize | 51 # Local utility proc just to set and verify listsize |
56 # Return 1 if success, 0 if fail. | 52 # Return 1 if success, 0 if fail. |
57 # | 53 # |
58 | 54 |
59 set set_listsize_count 0; | 55 set set_listsize_count 0; |
60 | 56 |
(...skipping 13 matching lines...) Expand all Loading... |
74 return 0; | 70 return 0; |
75 } | 71 } |
76 return 1 | 72 return 1 |
77 } | 73 } |
78 | 74 |
79 # | 75 # |
80 # Test display of listsize lines around a given line number. | 76 # Test display of listsize lines around a given line number. |
81 # | 77 # |
82 | 78 |
83 proc test_listsize {} { | 79 proc test_listsize {} { |
84 global gdb_prompt use_gdb_stub | 80 global gdb_prompt |
85 global hp_cc_compiler | 81 global hp_cc_compiler |
86 global hp_aCC_compiler | 82 global hp_aCC_compiler |
87 | 83 |
88 # Show default size | 84 # Show default size |
89 | 85 |
90 gdb_test "show listsize" "Number of source lines gdb will list by default is
10.*" "show default list size" | 86 gdb_test "show listsize" "Number of source lines gdb will list by default is
10.*" "show default list size" |
91 | 87 |
92 # Show the default lines | 88 # Show the default lines |
93 # Note that remote targets that have debugging info for _start available wil
l | 89 |
94 # list the lines there instead of main, so we skip this test for remote targ
ets. | 90 gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \
t\]+foo .x\[+)\]+;)" "list default lines around main" |
95 # The second case is for optimized code, it is still correct. | |
96 | |
97 if $use_gdb_stub { | |
98 » runto_main; | |
99 » unsupported "list default lines around main"; | |
100 } else { | |
101 » gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*10\[ \t\]+x = 0;|2.*11\
[ \t\]+foo .x\[+)\]+;)" "list default lines around main" | |
102 } | |
103 | 91 |
104 # Ensure we can limit printouts to one line | 92 # Ensure we can limit printouts to one line |
105 | 93 |
106 if [set_listsize 1] { | 94 if [set_listsize 1] { |
107 gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with list
size 1" | 95 gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with list
size 1" |
108 gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1" | 96 gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1" |
109 } | 97 } |
110 | 98 |
111 # Try just two lines | 99 # Try just two lines |
112 | 100 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 # Test "list filename:number" for C source file | 160 # Test "list filename:number" for C source file |
173 # | 161 # |
174 | 162 |
175 proc test_list_filename_and_number {} { | 163 proc test_list_filename_and_number {} { |
176 global gdb_prompt | 164 global gdb_prompt |
177 | 165 |
178 set testcnt 0 | 166 set testcnt 0 |
179 | 167 |
180 send_gdb "list list0.c:1\n" | 168 send_gdb "list list0.c:1\n" |
181 gdb_expect { | 169 gdb_expect { |
182 » -re "1\[ \t\]+#include \"list0.h\".*10\[ \t]+x = 0;\r\n$gdb_prompt $" { | 170 » -re "1\[ \t\]+#include \"list0.h\".*10\[ \t\]+foo .x\[+)\]+;\r\n$gdb_pro
mpt $" { |
183 incr testcnt | 171 incr testcnt |
184 } | 172 } |
185 -re ".*$gdb_prompt $" { fail "list list0.c:1" ; gdb_suppress_tests } | 173 -re ".*$gdb_prompt $" { fail "list list0.c:1" ; gdb_suppress_tests } |
186 timeout { fail "list list0.c:1 (timeout)" ; gdb_suppress_tests } | 174 timeout { fail "list list0.c:1 (timeout)" ; gdb_suppress_tests } |
187 } | 175 } |
188 send_gdb "list list0.c:10\n" | 176 send_gdb "list list0.c:10\n" |
189 gdb_expect { | 177 gdb_expect { |
190 -re "5\[ \t\]+int x;.*14\[ \t\]+foo .x\[+)\]+;\r\n$gdb_prompt $" { | 178 -re "5\[ \t\]+int x;.*14\[ \t\]+foo .x\[+)\]+;\r\n$gdb_prompt $" { |
191 incr testcnt | 179 incr testcnt |
192 } | 180 } |
(...skipping 23 matching lines...) Expand all Loading... |
216 # | 204 # |
217 # Test "list function" for C source file | 205 # Test "list function" for C source file |
218 # | 206 # |
219 | 207 |
220 proc test_list_function {} { | 208 proc test_list_function {} { |
221 global gdb_prompt | 209 global gdb_prompt |
222 | 210 |
223 # gcc appears to generate incorrect debugging information for code | 211 # gcc appears to generate incorrect debugging information for code |
224 # in include files, which breaks this test. | 212 # in include files, which breaks this test. |
225 # SunPRO cc is the second case below, it's also correct. | 213 # SunPRO cc is the second case below, it's also correct. |
226 gdb_test "list main" "(5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t
\]+#include .*10\[ \t\]+x = 0;)" "list function in source file 1" | 214 gdb_test "list main" "(5\[ \t\]+int x;.*8\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\
]+#include .*7\[ \t\]+x = 0;)" "list function in source file 1" |
227 | 215 |
228 # Ultrix gdb takes the second case below; it's also correct. | 216 # Ultrix gdb takes the second case below; it's also correct. |
229 # SunPRO cc is the third case. | 217 # SunPRO cc is the third case. |
230 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" | 218 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" |
231 | 219 |
232 # Test "list function" for C include file | 220 # Test "list function" for C include file |
233 # Ultrix gdb is the second case, still correct. | 221 # Ultrix gdb is the second case, still correct. |
234 # SunPRO cc is the third case. | 222 # SunPRO cc is the third case. |
235 gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+incl
uding file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]
+bar \[(\]+.*\[)\]+;)" "list function in include file" | 223 gdb_test "list foo" "(3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;|2\[ \t\]+incl
uding file.*11\[ \t\]+bar \[(\]+.*\[)\]+;|1\[ \t\]+/. An include file.*10\[ \t\]
+bar \[(\]+.*\[)\]+;)" "list function in include file" |
236 } | 224 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 316 |
329 send_gdb "list -\n" | 317 send_gdb "list -\n" |
330 gdb_expect { | 318 gdb_expect { |
331 -re "18\[ \t\]+foo \[(\]+.*\[)\]+;.*27\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd
b_prompt $" { incr testcnt } | 319 -re "18\[ \t\]+foo \[(\]+.*\[)\]+;.*27\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd
b_prompt $" { incr testcnt } |
332 -re ".*$gdb_prompt $" { fail "list 18-27" ; gdb_suppress_tests } | 320 -re ".*$gdb_prompt $" { fail "list 18-27" ; gdb_suppress_tests } |
333 timeout { fail "list 18-27 (timeout)" ; gdb_suppress_tests } | 321 timeout { fail "list 18-27 (timeout)" ; gdb_suppress_tests } |
334 } | 322 } |
335 | 323 |
336 send_gdb "list -\n" | 324 send_gdb "list -\n" |
337 gdb_expect { | 325 gdb_expect { |
338 » -re "8\[ \t\]+breakpoint\[(\]\[)\];.*17\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$g
db_prompt $" { incr testcnt } | 326 » -re "8\[ \t\]+foo \[(\]+.*\[)\]+;.*17\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb
_prompt $" { incr testcnt } |
339 -re ".*$gdb_prompt $" { fail "list 8-17" ; gdb_suppress_tests } | 327 -re ".*$gdb_prompt $" { fail "list 8-17" ; gdb_suppress_tests } |
340 timeout { fail "list 8-17 (timeout)" ; gdb_suppress_tests } | 328 timeout { fail "list 8-17 (timeout)" ; gdb_suppress_tests } |
341 } | 329 } |
342 | 330 |
343 send_gdb "list -\n" | 331 send_gdb "list -\n" |
344 gdb_expect { | 332 gdb_expect { |
345 » -re "1\[ \t\]+#include .*7\[ \t\]+set_debug_traps\[(\]\[)\]+;\r\n$gdb_pr
ompt $" { incr testcnt } | 333 » -re "1\[ \t\]+#include .*7\[ \t\]+x = 0;\r\n$gdb_prompt $" { incr testcn
t } |
346 -re ".*$gdb_prompt $" { fail "list 1-7" ; gdb_suppress_tests } | 334 -re ".*$gdb_prompt $" { fail "list 1-7" ; gdb_suppress_tests } |
347 timeout { fail "list 1-7 (timeout)" ; gdb_suppress_tests } | 335 timeout { fail "list 1-7 (timeout)" ; gdb_suppress_tests } |
348 } | 336 } |
349 | 337 |
350 pass "$testcnt successive \"list -\" commands to page backwards" | 338 pass "$testcnt successive \"list -\" commands to page backwards" |
351 gdb_stop_suppressing_tests; | 339 gdb_stop_suppressing_tests; |
352 } | 340 } |
353 | 341 |
354 # | 342 # |
355 # Test "list first,last" | 343 # Test "list first,last" |
(...skipping 24 matching lines...) Expand all Loading... |
380 proc test_list_filename_and_function {} { | 368 proc test_list_filename_and_function {} { |
381 global gdb_prompt | 369 global gdb_prompt |
382 | 370 |
383 set testcnt 0 | 371 set testcnt 0 |
384 | 372 |
385 # gcc appears to generate incorrect debugging information for code | 373 # gcc appears to generate incorrect debugging information for code |
386 # in include files, which breaks this test. | 374 # in include files, which breaks this test. |
387 # SunPRO cc is the second case below, it's also correct. | 375 # SunPRO cc is the second case below, it's also correct. |
388 send_gdb "list list0.c:main\n" | 376 send_gdb "list list0.c:main\n" |
389 gdb_expect { | 377 gdb_expect { |
390 » -re "1\[ \t\]+#include .*10\[ \t\]+x = 0;\r\n$gdb_prompt $" { | 378 » -re "1\[ \t\]+#include .*10\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $"
{ |
391 incr testcnt | 379 incr testcnt |
392 } | 380 } |
393 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { | 381 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { |
394 pass "list function in source file 1" | 382 pass "list function in source file 1" |
395 } | 383 } |
396 -re ".*$gdb_prompt $" { fail "list list0.c:main" } | 384 -re ".*$gdb_prompt $" { fail "list list0.c:main" } |
397 timeout { fail "list list0.c:main (timeout)" } | 385 timeout { fail "list list0.c:main (timeout)" } |
398 } | 386 } |
399 | 387 |
400 # Not sure what the point of having this function be unused is. | 388 # Not sure what the point of having this function be unused is. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 # Test that GDB won't crash if the line being searched is extremely long
. | 498 # Test that GDB won't crash if the line being searched is extremely long
. |
511 | 499 |
512 set oldtimeout $timeout | 500 set oldtimeout $timeout |
513 set timeout [expr "$timeout + 300"] | 501 set timeout [expr "$timeout + 300"] |
514 verbose "Timeout is now $timeout seconds" 2 | 502 verbose "Timeout is now $timeout seconds" 2 |
515 gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 ch
ars)" | 503 gdb_test "search 1234" ".*1234.*" "search extremely long line (> 5000 ch
ars)" |
516 set timeout $oldtimeout | 504 set timeout $oldtimeout |
517 verbose "Timeout is now $timeout seconds" 2 | 505 verbose "Timeout is now $timeout seconds" 2 |
518 } | 506 } |
519 | 507 |
| 508 proc test_only_end {} { |
| 509 gdb_test_no_output "set listsize 2" |
| 510 gdb_test "list 1" "list 1\r\n1\[ \t\]\[^\r\n\]*\r\n2\[ \t\]\[^\r\n\]*" |
| 511 gdb_test "list ,5" "list ,5\r\n4\[ \t\]\[^\r\n\]*\r\n5\[ \t\]\[^\r\n\]*" |
| 512 } |
| 513 |
520 # Start with a fresh gdb. | 514 # Start with a fresh gdb. |
521 | 515 |
522 gdb_exit | 516 gdb_exit |
523 gdb_start | 517 gdb_start |
524 gdb_reinitialize_dir $srcdir/$subdir | 518 gdb_reinitialize_dir $srcdir/$subdir |
525 gdb_load ${binfile} | 519 gdb_file_cmd ${binfile} |
526 | |
527 if [target_info exists gdb_stub] { | |
528 gdb_step_for_stub; | |
529 } | |
530 | 520 |
531 gdb_test_no_output "set width 0" | 521 gdb_test_no_output "set width 0" |
532 | 522 |
533 test_listsize | 523 test_listsize |
534 get_debug_format | 524 get_debug_format |
535 if [ set_listsize 10 ] then { | 525 if [ set_listsize 10 ] then { |
536 test_list_include_file | 526 test_list_include_file |
537 test_list_filename_and_number | 527 test_list_filename_and_number |
538 test_list_function | 528 test_list_function |
539 test_list_forward | 529 test_list_forward |
540 test_list_backwards | 530 test_list_backwards |
541 test_repeat_list_command | 531 test_repeat_list_command |
542 test_list_range | 532 test_list_range |
543 test_list_filename_and_function | 533 test_list_filename_and_function |
544 test_forward_search | 534 test_forward_search |
| 535 test_only_end |
545 } | 536 } |
546 | 537 |
547 remote_exec build "rm -f list0.h" | 538 remote_exec build "rm -f list0.h" |
OLD | NEW |