OLD | NEW |
1 # Copyright 2011-2012 Free Software Foundation, Inc. | 1 # Copyright 2011-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # 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 |
4 # 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 |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # 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, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # 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 |
14 # 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/>. |
15 | 15 |
16 # Tests of ambiguous linespecs. | 16 # Tests of ambiguous linespecs. |
17 | 17 |
18 set testfile linespec | 18 standard_testfile lspec.cc |
19 | 19 |
20 set exefile lspec | 20 set exefile $testfile |
21 set binfile ${objdir}/${subdir}/${exefile} | |
22 | 21 |
23 set baseone base/one/thefile.cc | 22 set baseone base/one/thefile.cc |
24 set basetwo base/two/thefile.cc | 23 set basetwo base/two/thefile.cc |
25 | 24 |
26 if {[skip_cplus_tests]} { | 25 if {[skip_cplus_tests]} { |
27 unsupported linespec.exp | 26 unsupported linespec.exp |
28 return | 27 return |
29 } | 28 } |
30 | 29 |
31 if {[prepare_for_testing ${testfile}.exp $exefile \ | 30 if {[prepare_for_testing ${testfile}.exp $exefile \ |
32 » [list lspec.cc $baseone $basetwo] \ | 31 » [list $srcfile $baseone $basetwo] \ |
33 » {debug nowarnings}]} { | 32 » {debug nowarnings c++}]} { |
34 return -1 | 33 return -1 |
35 } | 34 } |
36 | 35 |
37 gdb_test_no_output "set multiple-symbols all" \ | 36 gdb_test_no_output "set multiple-symbols all" \ |
38 "set multiple-symbols to all for linespec tests" | 37 "set multiple-symbols to all for linespec tests" |
39 | 38 |
40 set l1 [gdb_get_line_number "thefile breakpoint" $baseone] | 39 set l1 [gdb_get_line_number "thefile breakpoint" $baseone] |
41 set l2 [gdb_get_line_number "thefile breakpoint" $basetwo] | 40 set l2 [gdb_get_line_number "thefile breakpoint" $basetwo] |
42 | 41 |
43 if {$l1 != $l2} { | 42 if {$l1 != $l2} { |
44 error "somebody incompatibly modified the source files needed by linespec.ex
p" | 43 error "somebody incompatibly modified the source files needed by linespec.ex
p" |
45 } | 44 } |
46 | 45 |
| 46 gdb_test "break one/thefile.cc:$l1" \ |
| 47 "Breakpoint $decimal at $hex: file .*thefile.cc, line $l1." \ |
| 48 "single-location break using dir/file:line" |
| 49 |
| 50 gdb_test "clear one/thefile.cc:$l1" \ |
| 51 "Deleted breakpoint $decimal *" \ |
| 52 "clear breakpoint using dir/file:line" |
| 53 |
47 gdb_test "break thefile.cc:$l1" \ | 54 gdb_test "break thefile.cc:$l1" \ |
48 "Breakpoint 1 at $hex: thefile.cc:$l1. \[(\]2 locations\[)\]" \ | 55 "Breakpoint $decimal at $hex: thefile.cc:$l1. \[(\]2 locations\[)\]" \ |
49 "multi-location break using file:line" | 56 "multi-location break using file:line" |
50 | 57 |
51 # We'd like this to work, but it currently does not. | |
52 # gdb_test "break one/thefile.cc:$l1" | |
53 | |
54 gdb_test "break dupname" \ | 58 gdb_test "break dupname" \ |
55 "Breakpoint 2 at $hex: dupname. \[(\]2 locations\[)\]" \ | 59 "Breakpoint $decimal at $hex: dupname. \[(\]2 locations\[)\]" \ |
56 "multi-location break using duplicate function name" | 60 "multi-location break using duplicate function name" |
57 | 61 |
58 gdb_test "break dupname:label" \ | 62 gdb_test "break dupname:label" \ |
59 "Breakpoint 3 at $hex: dupname:label. \[(\]2 locations\[)\]" \ | 63 "Breakpoint $decimal at $hex: dupname:label. \[(\]2 locations\[)\]" \ |
60 "multi-location break using duplicate function name and label" | 64 "multi-location break using duplicate function name and label" |
61 | 65 |
62 gdb_test_no_output "set breakpoint pending off" \ | 66 gdb_test_no_output "set breakpoint pending off" \ |
63 "disable pending breakpoints for linespec tests" | 67 "disable pending breakpoints for linespec tests" |
64 | 68 |
65 # This is PR breakpoints/12856. | 69 # This is PR breakpoints/12856. |
66 gdb_test "break lspec.cc:nosuchfunction" \ | 70 gdb_test "break lspec.cc:nosuchfunction" \ |
67 "Function \"nosuchfunction\" not defined in \"lspec.cc\"." \ | 71 "Function \"nosuchfunction\" not defined in \"lspec.cc\"." \ |
68 "set breakpoint on non-existent function" | 72 "set breakpoint on non-existent function" |
69 | 73 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 112 |
109 # Note that in particular this should not cause errors when re-setting | 113 # Note that in particular this should not cause errors when re-setting |
110 # breakpoints. | 114 # breakpoints. |
111 gdb_test "file $binfile" \ | 115 gdb_test "file $binfile" \ |
112 "Reading symbols from .*done." \ | 116 "Reading symbols from .*done." \ |
113 "set the new inferior file for linespec tests" | 117 "set the new inferior file for linespec tests" |
114 | 118 |
115 gdb_test "break main" \ | 119 gdb_test "break main" \ |
116 "Breakpoint \[0-9\]+ at $hex: main. .2 locations." \ | 120 "Breakpoint \[0-9\]+ at $hex: main. .2 locations." \ |
117 "set breakpoint at main in both inferiors" | 121 "set breakpoint at main in both inferiors" |
OLD | NEW |