]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.linespec/linespec.exp
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.linespec / linespec.exp
CommitLineData
8acc9f48 1# Copyright 2011-2013 Free Software Foundation, Inc.
f8eba3c6
TT
2
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
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
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/>.
15
16# Tests of ambiguous linespecs.
17
f91e3dc1 18standard_testfile lspec.cc
f8eba3c6 19
f91e3dc1 20set exefile $testfile
f8eba3c6
TT
21
22set baseone base/one/thefile.cc
23set basetwo base/two/thefile.cc
24
25if {[skip_cplus_tests]} {
26 unsupported linespec.exp
27 return
28}
29
30if {[prepare_for_testing ${testfile}.exp $exefile \
f91e3dc1 31 [list $srcfile $baseone $basetwo] \
da8cb7ec 32 {debug nowarnings c++}]} {
f8eba3c6
TT
33 return -1
34}
35
36gdb_test_no_output "set multiple-symbols all" \
37 "set multiple-symbols to all for linespec tests"
38
39set l1 [gdb_get_line_number "thefile breakpoint" $baseone]
40set l2 [gdb_get_line_number "thefile breakpoint" $basetwo]
41
42if {$l1 != $l2} {
43 error "somebody incompatibly modified the source files needed by linespec.exp"
44}
45
4aac40c8
TT
46gdb_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
50gdb_test "clear one/thefile.cc:$l1" \
51 "Deleted breakpoint $decimal *" \
52 "clear breakpoint using dir/file:line"
53
f8eba3c6 54gdb_test "break thefile.cc:$l1" \
4aac40c8 55 "Breakpoint $decimal at $hex: thefile.cc:$l1. \[(\]2 locations\[)\]" \
f8eba3c6
TT
56 "multi-location break using file:line"
57
f8eba3c6 58gdb_test "break dupname" \
4aac40c8 59 "Breakpoint $decimal at $hex: dupname. \[(\]2 locations\[)\]" \
f8eba3c6
TT
60 "multi-location break using duplicate function name"
61
62gdb_test "break dupname:label" \
4aac40c8 63 "Breakpoint $decimal at $hex: dupname:label. \[(\]2 locations\[)\]" \
f8eba3c6
TT
64 "multi-location break using duplicate function name and label"
65
66gdb_test_no_output "set breakpoint pending off" \
67 "disable pending breakpoints for linespec tests"
68
69# This is PR breakpoints/12856.
70gdb_test "break lspec.cc:nosuchfunction" \
71 "Function \"nosuchfunction\" not defined in \"lspec.cc\"." \
72 "set breakpoint on non-existent function"
73
74gdb_test "break NameSpace::overload" \
75 "Breakpoint \[0-9\]+ at $hex: NameSpace::overload. \[(\]3 locations\[)\]" \
76 "set breakpoint at all instances of NameSpace::overload"
77
78gdb_test "break lspec.cc:NameSpace::overload" \
79 "Breakpoint \[0-9\]+ at $hex: file .*lspec.cc, line 7." \
80 "set breakpoint at lspec.cc instance of NameSpace::overload"
81
82gdb_test "break lspec.cc:NameSpace::overload(double)" \
83 "Function \"NameSpace::overload\\(double\\)\" not defined in \"lspec.cc\"." \
84 "set breakpoint at non-existent lspec.cc instance of NameSpace::overload"
85
86gdb_test "break NameSpace::overload()" \
87 "Breakpoint \[0-9\]+ at $hex: file .*lspec.cc, line 7." \
88 "set breakpoint at specific instance of NameSpace::overload"
89
90# This should manage to set a breakpoint even though body.h does not
91# include all of the function in question.
92set line [gdb_get_line_number "body breakpoint no code" body.h]
93gdb_test "break body.h:$line" \
94 "Breakpoint \[0-9\]+.*" \
95 "set breakpoint in body.h"
96
97# This should only have a single location -- in f1.
98set line [gdb_get_line_number "f1 breakpoint" lspec.h]
99gdb_test "break lspec.h:$line" \
100 "Breakpoint \[0-9\]+ at $hex: file .*lspec.h, line $line." \
101 "set breakpoint in f1"
102
103#
104# Multi-inferior tests.
105#
106
107gdb_test "add-inferior" "Added inferior 2" \
108 "add inferior for linespec tests"
109
110gdb_test "inferior 2" "Switching to inferior 2 .*" \
111 "switch to inferior 2 for linespec tests"
112
113# Note that in particular this should not cause errors when re-setting
114# breakpoints.
115gdb_test "file $binfile" \
116 "Reading symbols from .*done." \
117 "set the new inferior file for linespec tests"
118
119gdb_test "break main" \
120 "Breakpoint \[0-9\]+ at $hex: main. .2 locations." \
121 "set breakpoint at main in both inferiors"