Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: gdb/testsuite/gdb.base/list.exp

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/testsuite/gdb.base/linespecs.exp ('k') | gdb/testsuite/gdb.base/list0.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 1992, 1994-1999, 2002-2003, 2007-2012 Free Software 1 # Copyright 1992-2013 Free Software Foundation, Inc.
2 # Foundation, Inc.
3 2
4 # This program is free software; you can redistribute it and/or modify 3 # 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 4 # 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 5 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version. 6 # (at your option) any later version.
8 # 7 #
9 # This program is distributed in the hope that it will be useful, 8 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details. 11 # GNU General Public License for more details.
13 # 12 #
14 # You should have received a copy of the GNU General Public License 13 # 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/>. 14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 15
17 # This file was written by Fred Fish. (fnf@cygnus.com) 16 # This file was written by Fred Fish. (fnf@cygnus.com)
18 17
19 18
20 set testfile "list" 19 standard_testfile list0.c list1.c
21 set binfile ${objdir}/${subdir}/${testfile}
22 20
23 # Need to download the header to the host. 21 # Need to download the header to the host.
24 remote_download host ${srcdir}/${subdir}/list0.h list0.h 22 gdb_remote_download host ${srcdir}/${subdir}/list0.h
25 23
26 24 if {[prepare_for_testing $testfile.exp $testfile [list $srcfile $srcfile2] \
27 if { [gdb_compile "${srcdir}/${subdir}/list0.c" "${binfile}0.o" object {debug}] != "" } { 25 » {debug}]} {
28 untested list.exp 26 return -1
29 return -1
30 } 27 }
31 28
32 if { [gdb_compile "${srcdir}/${subdir}/list1.c" "${binfile}1.o" object {debug}] != "" } {
33 untested list.exp
34 return -1
35 }
36
37 if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } {
38 untested list.exp
39 return -1
40 }
41
42
43
44 # Create and source the file that provides information about the compiler 29 # Create and source the file that provides information about the compiler
45 # used to compile the test case. 30 # used to compile the test case.
46 if [get_compiler_info] { 31 if [get_compiler_info] {
47 return -1; 32 return -1
48 } 33 }
49 34
35 # The last line in the file.
36 set last_line [gdb_get_line_number "last line" "list0.c"]
37
38 # Regex matching the last line in the file.
39 set last_line_re "${last_line}\[ \t\]+} /\\* last line \\*/"
40
50 # 41 #
51 # Local utility proc just to set and verify listsize 42 # Local utility proc just to set and verify listsize
52 # Return 1 if success, 0 if fail. 43 # Return 1 if success, 0 if fail.
53 # 44 #
54 45
55 set set_listsize_count 0; 46 set set_listsize_count 0
56 47
57 proc set_listsize { arg } { 48 proc set_listsize { arg } {
58 global gdb_prompt 49 global gdb_prompt
59 global set_listsize_count; 50 global set_listsize_count
60 51
61 incr set_listsize_count; 52 incr set_listsize_count
62 if [gdb_test "set listsize $arg" ".*" "setting listsize to $arg #$set_listsi ze_count"] { 53 if [gdb_test_no_output "set listsize $arg" "setting listsize to $arg #$set_l istsize_count"] {
63 » return 0; 54 » return 0
64 } 55 }
65 if { $arg <= 0 } { 56 if { $arg == 0 } {
66 » set arg "unlimited"; 57 » set arg "unlimited"
67 } 58 }
68 59
69 if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show li stsize $arg #$set_listsize_count"] { 60 if [gdb_test "show listsize" "Number of source lines.* is ${arg}.*" "show li stsize $arg #$set_listsize_count"] {
70 » return 0; 61 » return 0
71 } 62 }
72 return 1 63 return 1
73 } 64 }
74 65
75 # 66 #
76 # Test display of listsize lines around a given line number. 67 # Test display of listsize lines around a given line number.
77 # 68 #
78 69
79 proc test_listsize {} { 70 proc test_listsize {} {
80 global gdb_prompt 71 global gdb_prompt
81 global hp_cc_compiler 72 global hp_cc_compiler
82 global hp_aCC_compiler 73 global hp_aCC_compiler
74 global last_line_re
83 75
84 # Show default size 76 # Show default size
85 77
86 gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size" 78 gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
87 79
88 # Show the default lines 80 # Show the default lines
89 81
90 gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \ t\]+foo .x\[+)\]+;)" "list default lines around main" 82 gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \ t\]+foo .x\[+)\]+;)" "list default lines around main"
91 83
92 # Ensure we can limit printouts to one line 84 # Ensure we can limit printouts to one line
(...skipping 25 matching lines...) Expand all
118 gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list lin e 1 with listsize 4" 110 gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list lin e 1 with listsize 4"
119 gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list lin e 2 with listsize 4" 111 gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list lin e 2 with listsize 4"
120 112
121 gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list lin e 3 with listsize 4" 113 gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list lin e 3 with listsize 4"
122 gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with l istsize 4" 114 gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with l istsize 4"
123 } 115 }
124 116
125 # Try a size larger than the entire file. 117 # Try a size larger than the entire file.
126 118
127 if [ set_listsize 100 ] then { 119 if [ set_listsize 100 ] then {
128 » gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 1 with listsize 100" 120 » gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" " list line 1 with listsize 100"
129 121
130 » gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\} " "list line 10 with listsize 100" 122 » gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n${last_line_re}" "list line 10 with listsize 100"
131 } 123 }
132 124
133 # Try listsize of 0 which suppresses printing. 125 # Try listsize of 0 which is special, and means unlimited.
134 126
135 set_listsize 0 127 set_listsize 0
136 gdb_test "list 1" "" "listsize of 0 suppresses output" 128 gdb_test "list 1" "1\[ \t\]+#include .*\r\n${last_line_re}" "list line 1 wit h unlimited listsize"
137
138 # Try listsize of -1 which is special, and means unlimited.
139
140 set_listsize -1
141 setup_xfail "*-*-*"
142 gdb_test "list 1" "1\[ \t\]+#include .*\r\n39\[ \t\]+\}" "list line 1 with u nlimited listsize"
143 } 129 }
144 130
145 # 131 #
146 # Test "list filename:number" for C include file 132 # Test "list filename:number" for C include file
147 # 133 #
148 134
149 proc test_list_include_file {} { 135 proc test_list_include_file {} {
150 global gdb_prompt 136 global gdb_prompt
151 137
152 setup_xfail_format "COFF" 138 setup_xfail_format "COFF"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 177 }
192 send_gdb "list list1.c:12\n" 178 send_gdb "list list1.c:12\n"
193 gdb_expect { 179 gdb_expect {
194 -re "12\[ \t\]+long_line \[(\]+.*\[)\]+;.*13\[ \t\]+\}\r\n.*$gdb_prompt $" { 180 -re "12\[ \t\]+long_line \[(\]+.*\[)\]+;.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {
195 incr testcnt 181 incr testcnt
196 } 182 }
197 -re ".*$gdb_prompt $" { fail "list list1.c:12" ; gdb_suppress_tests } 183 -re ".*$gdb_prompt $" { fail "list list1.c:12" ; gdb_suppress_tests }
198 timeout { fail "list list1.c:12 (timeout)" ; gdb_suppress_tests } 184 timeout { fail "list list1.c:12 (timeout)" ; gdb_suppress_tests }
199 } 185 }
200 pass "list filename:number ($testcnt tests)" 186 pass "list filename:number ($testcnt tests)"
201 gdb_stop_suppressing_tests; 187 gdb_stop_suppressing_tests
202 } 188 }
203 189
204 # 190 #
205 # Test "list function" for C source file 191 # Test "list function" for C source file
206 # 192 #
207 193
208 proc test_list_function {} { 194 proc test_list_function {} {
209 global gdb_prompt 195 global gdb_prompt
210 196
211 # gcc appears to generate incorrect debugging information for code 197 # gcc appears to generate incorrect debugging information for code
212 # in include files, which breaks this test. 198 # in include files, which breaks this test.
213 # SunPRO cc is the second case below, it's also correct. 199 # SunPRO cc is the second case below, it's also correct.
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" 200 gdb_test "list main" "(5\[ \t\]+int x;.*8\[ \t\]+foo \[(\]+.*\[)\]+;|1\[ \t\ ]+#include .*7\[ \t\]+x = 0;)" "list function in source file 1"
215 201
216 # Ultrix gdb takes the second case below; it's also correct. 202 # Ultrix gdb takes the second case below; it's also correct.
217 # SunPRO cc is the third case. 203 # SunPRO cc is the third case.
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" 204 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"
219 205
220 # Test "list function" for C include file 206 # Test "list function" for C include file
221 # Ultrix gdb is the second case, still correct. 207 # Ultrix gdb is the second case, still correct.
222 # SunPRO cc is the third case. 208 # SunPRO cc is the third case.
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" 209 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"
224 } 210 }
225 211
226 proc test_list_forward {} { 212 proc test_list_forward {} {
227 global gdb_prompt 213 global gdb_prompt
214 global last_line_re
228 215
229 set testcnt 0 216 set testcnt 0
230 217
231 send_gdb "list list0.c:10\n" 218 send_gdb "list list0.c:10\n"
232 gdb_expect { 219 gdb_expect {
233 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } 220 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
234 -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests } 221 -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }
235 timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests } 222 timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }
236 } 223 }
237 224
238 send_gdb "list\n" 225 send_gdb "list\n"
239 gdb_expect { 226 gdb_expect {
240 -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd b_prompt $" { incr testcnt } 227 -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd b_prompt $" { incr testcnt }
241 -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests } 228 -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }
242 timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests } 229 timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }
243 } 230 }
244 231
245 send_gdb "list\n" 232 send_gdb "list\n"
246 gdb_expect { 233 gdb_expect {
247 -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd b_prompt $" { incr testcnt } 234 -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd b_prompt $" { incr testcnt }
248 -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests } 235 -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }
249 timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests } 236 timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }
250 } 237 }
251 238
252 send_gdb "list\n" 239 send_gdb "list\n"
253 gdb_expect { 240 gdb_expect {
254 » -re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr te stcnt } 241 » -re "35\[ \t\]+foo \\(.*\\);.*${last_line_re}\r\n$gdb_prompt $" { incr t estcnt }
255 -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests } 242 -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }
256 timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests } 243 timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }
257 } 244 }
258 245
259 pass "successive list commands to page forward ($testcnt tests)" 246 pass "successive list commands to page forward ($testcnt tests)"
260 gdb_stop_suppressing_tests; 247 gdb_stop_suppressing_tests
261 } 248 }
262 249
263 # Test that repeating the list linenum command doesn't print the same 250 # Test that repeating the list linenum command doesn't print the same
264 # lines over again. Note that this test makes sure that the argument 251 # lines over again. Note that this test makes sure that the argument
265 # linenum is dropped, when we repeat the previous command. 'x/5i $pc' 252 # linenum is dropped, when we repeat the previous command. 'x/5i $pc'
266 # works the same way. 253 # works the same way.
267 254
268 proc test_repeat_list_command {} { 255 proc test_repeat_list_command {} {
269 global gdb_prompt 256 global gdb_prompt
257 global last_line_re
270 258
271 set testcnt 0 259 set testcnt 0
272 260
273 send_gdb "list list0.c:10\n" 261 send_gdb "list list0.c:10\n"
274 gdb_expect { 262 gdb_expect {
275 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt } 263 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
276 -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests } 264 -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }
277 timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests } 265 timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }
278 } 266 }
279 267
280 send_gdb "\n" 268 send_gdb "\n"
281 gdb_expect { 269 gdb_expect {
282 -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd b_prompt $" { incr testcnt } 270 -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd b_prompt $" { incr testcnt }
283 -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests } 271 -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }
284 timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests } 272 timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }
285 } 273 }
286 274
287 send_gdb "\n" 275 send_gdb "\n"
288 gdb_expect { 276 gdb_expect {
289 -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd b_prompt $" { incr testcnt } 277 -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gd b_prompt $" { incr testcnt }
290 -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests } 278 -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }
291 timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests } 279 timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }
292 } 280 }
293 281
294 send_gdb "\n" 282 send_gdb "\n"
295 gdb_expect { 283 gdb_expect {
296 » -re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr te stcnt } 284 » -re "35\[ \t\]+foo \\(.*\\);.*${last_line_re}\r\n$gdb_prompt $" { incr t estcnt }
297 -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests } 285 -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }
298 timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests } 286 timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }
299 } 287 }
300 288
301 pass "repeat list commands to page forward using 'return' ($testcnt tests)" 289 pass "repeat list commands to page forward using 'return' ($testcnt tests)"
302 gdb_stop_suppressing_tests; 290 gdb_stop_suppressing_tests
303 } 291 }
304 292
305 proc test_list_backwards {} { 293 proc test_list_backwards {} {
306 global gdb_prompt 294 global gdb_prompt
307 295
308 set testcnt 0 296 set testcnt 0
309 297
310 send_gdb "list list0.c:33\n" 298 send_gdb "list list0.c:33\n"
311 gdb_expect { 299 gdb_expect {
312 -re "28\[ \t\]+foo \\(.*\\);.*37\[ \t\]+\}\r\n$gdb_prompt $" { incr test cnt } 300 -re "28\[ \t\]+foo \\(.*\\);.*37\[ \t\]+\}\r\n$gdb_prompt $" { incr test cnt }
(...skipping 16 matching lines...) Expand all
329 } 317 }
330 318
331 send_gdb "list -\n" 319 send_gdb "list -\n"
332 gdb_expect { 320 gdb_expect {
333 -re "1\[ \t\]+#include .*7\[ \t\]+x = 0;\r\n$gdb_prompt $" { incr testcn t } 321 -re "1\[ \t\]+#include .*7\[ \t\]+x = 0;\r\n$gdb_prompt $" { incr testcn t }
334 -re ".*$gdb_prompt $" { fail "list 1-7" ; gdb_suppress_tests } 322 -re ".*$gdb_prompt $" { fail "list 1-7" ; gdb_suppress_tests }
335 timeout { fail "list 1-7 (timeout)" ; gdb_suppress_tests } 323 timeout { fail "list 1-7 (timeout)" ; gdb_suppress_tests }
336 } 324 }
337 325
338 pass "$testcnt successive \"list -\" commands to page backwards" 326 pass "$testcnt successive \"list -\" commands to page backwards"
339 gdb_stop_suppressing_tests; 327 gdb_stop_suppressing_tests
340 } 328 }
341 329
342 # 330 #
343 # Test "list first,last" 331 # Test "list first,last"
344 # 332 #
345 333
346 proc test_list_range {} { 334 proc test_list_range {} {
347 global gdb_prompt 335 global gdb_prompt
336 global last_line_re
337 global last_line
348 338
349 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" 339 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"
350 340
351 gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x; " "list range; line1,line2" 341 gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x; " "list range; line1,line2"
352 342
353 # gdb_test "list -1,6" "Line number 0 out of range; .*list0.c has 39 li nes." "list range; lower bound negative" 343 # gdb_test "list -1,6" "Line number 0 out of range; .*list0.c has 39 li nes." "list range; lower bound negative"
354 344
355 # gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative" 345 # gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative"
356 346
357 gdb_test "list 30,45" "30\[ \t\]+foo \(.*\);.*43\[ \t\]+\}" "list range; upp er bound past EOF" 347 set past_end [expr ${last_line} + 10]
348 set much_past_end [expr ${past_end} + 10]
358 349
359 gdb_test "list 45,100" "Line number 45 out of range; .*list0.c has 43 lines. " "list range; both bounds past EOF" 350 gdb_test "list 30,${past_end}" "30\[ \t\]+foo \(.*\);.*${last_line_re}" "lis t range; upper bound past EOF"
351
352 gdb_test "list ${past_end},${much_past_end}" "Line number ${past_end} out of range; .*list0.c has ${last_line} lines." "list range; both bounds past EOF"
360 353
361 gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in differe nt files." "list range, must be same files" 354 gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in differe nt files." "list range, must be same files"
362 } 355 }
363 356
364 # 357 #
365 # Test "list filename:function" 358 # Test "list filename:function"
366 # 359 #
367 360
368 proc test_list_filename_and_function {} { 361 proc test_list_filename_and_function {} {
369 global gdb_prompt 362 global gdb_prompt
363 global last_line_re
370 364
371 set testcnt 0 365 set testcnt 0
372 366
373 # gcc appears to generate incorrect debugging information for code 367 # gcc appears to generate incorrect debugging information for code
374 # in include files, which breaks this test. 368 # in include files, which breaks this test.
375 # SunPRO cc is the second case below, it's also correct. 369 # SunPRO cc is the second case below, it's also correct.
376 send_gdb "list list0.c:main\n" 370 send_gdb "list list0.c:main\n"
377 gdb_expect { 371 gdb_expect {
378 -re "1\[ \t\]+#include .*10\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { 372 -re "1\[ \t\]+#include .*10\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
379 incr testcnt 373 incr testcnt
380 } 374 }
381 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { 375 -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
382 pass "list function in source file 1" 376 pass "list function in source file 1"
383 } 377 }
384 -re ".*$gdb_prompt $" { fail "list list0.c:main" } 378 -re ".*$gdb_prompt $" { fail "list list0.c:main" }
385 timeout { fail "list list0.c:main (timeout)" } 379 timeout { fail "list list0.c:main (timeout)" }
386 } 380 }
387 381
388 # Not sure what the point of having this function be unused is. 382 # Not sure what the point of having this function be unused is.
389 # AIX is legitimately removing it. 383 # AIX is legitimately removing it.
390 setup_xfail "rs6000-*-aix*" 384 setup_xfail "rs6000-*-aix*"
391 send_gdb "list list0.c:unused\n" 385 send_gdb "list list0.c:unused\n"
392 gdb_expect { 386 gdb_expect {
393 » -re "40\[ \t\]+unused.*43\[ \t\]+\}\r\n$gdb_prompt $" { 387 » -re "40\[ \t\]+unused.*${last_line_re}\r\n$gdb_prompt $" {
394 incr testcnt 388 incr testcnt
395 } 389 }
396 -re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" { 390 -re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" {
397 incr testcnt 391 incr testcnt
398 } 392 }
399 -re ".*$gdb_prompt $" { fail "list list0.c:unused" } 393 -re ".*$gdb_prompt $" { fail "list list0.c:unused" }
400 timeout { fail "list list0.c:unused (timeout)" } 394 timeout { fail "list list0.c:unused (timeout)" }
401 } 395 }
402 clear_xfail "rs6000-*-aix*" 396 clear_xfail "rs6000-*-aix*"
403 397
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 test_list_forward 523 test_list_forward
530 test_list_backwards 524 test_list_backwards
531 test_repeat_list_command 525 test_repeat_list_command
532 test_list_range 526 test_list_range
533 test_list_filename_and_function 527 test_list_filename_and_function
534 test_forward_search 528 test_forward_search
535 test_only_end 529 test_only_end
536 } 530 }
537 531
538 remote_exec build "rm -f list0.h" 532 remote_exec build "rm -f list0.h"
OLDNEW
« no previous file with comments | « gdb/testsuite/gdb.base/linespecs.exp ('k') | gdb/testsuite/gdb.base/list0.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698