binutils/objdump: Fix disassemble for huge elf sections
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.linespec / linespec.exp
CommitLineData
61baf725 1# Copyright 2011-2017 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]} {
84c93cd5 26 unsupported "skipping c++ tests"
f8eba3c6
TT
27 return
28}
29
5b362f04 30if {[prepare_for_testing "failed to prepare" $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
156bffd0
SL
46# Copying files to a remote host loses the directory prefix during
47# compilation.
48if { [is_remote host] } {
49 untested "breakpoints using dir/file:line"
50} else {
51 gdb_test "break one/thefile.cc:$l1" \
52 "Breakpoint $decimal at $hex: file .*thefile.cc, line $l1." \
53 "single-location break using dir/file:line"
54
55 gdb_test "clear one/thefile.cc:$l1" \
56 "Deleted breakpoint $decimal *" \
57 "clear breakpoint using dir/file:line"
58}
4aac40c8 59
f8eba3c6 60gdb_test "break thefile.cc:$l1" \
4aac40c8 61 "Breakpoint $decimal at $hex: thefile.cc:$l1. \[(\]2 locations\[)\]" \
f8eba3c6
TT
62 "multi-location break using file:line"
63
f8eba3c6 64gdb_test "break dupname" \
4aac40c8 65 "Breakpoint $decimal at $hex: dupname. \[(\]2 locations\[)\]" \
f8eba3c6
TT
66 "multi-location break using duplicate function name"
67
68gdb_test "break dupname:label" \
4aac40c8 69 "Breakpoint $decimal at $hex: dupname:label. \[(\]2 locations\[)\]" \
f8eba3c6
TT
70 "multi-location break using duplicate function name and label"
71
58ce7251
SDJ
72# Testing if the "condition" command completes only the breakpoints,
73# not the locations.
74gdb_test "complete condition " "condition $decimal\r\ncondition $decimal\r\ncondition $decimal"
75
f8eba3c6
TT
76gdb_test_no_output "set breakpoint pending off" \
77 "disable pending breakpoints for linespec tests"
78
79# This is PR breakpoints/12856.
80gdb_test "break lspec.cc:nosuchfunction" \
81 "Function \"nosuchfunction\" not defined in \"lspec.cc\"." \
82 "set breakpoint on non-existent function"
83
84gdb_test "break NameSpace::overload" \
85 "Breakpoint \[0-9\]+ at $hex: NameSpace::overload. \[(\]3 locations\[)\]" \
86 "set breakpoint at all instances of NameSpace::overload"
87
88gdb_test "break lspec.cc:NameSpace::overload" \
89 "Breakpoint \[0-9\]+ at $hex: file .*lspec.cc, line 7." \
90 "set breakpoint at lspec.cc instance of NameSpace::overload"
91
92gdb_test "break lspec.cc:NameSpace::overload(double)" \
93 "Function \"NameSpace::overload\\(double\\)\" not defined in \"lspec.cc\"." \
94 "set breakpoint at non-existent lspec.cc instance of NameSpace::overload"
95
96gdb_test "break NameSpace::overload()" \
97 "Breakpoint \[0-9\]+ at $hex: file .*lspec.cc, line 7." \
98 "set breakpoint at specific instance of NameSpace::overload"
99
100# This should manage to set a breakpoint even though body.h does not
101# include all of the function in question.
102set line [gdb_get_line_number "body breakpoint no code" body.h]
103gdb_test "break body.h:$line" \
104 "Breakpoint \[0-9\]+.*" \
105 "set breakpoint in body.h"
106
107# This should only have a single location -- in f1.
108set line [gdb_get_line_number "f1 breakpoint" lspec.h]
109gdb_test "break lspec.h:$line" \
110 "Breakpoint \[0-9\]+ at $hex: file .*lspec.h, line $line." \
111 "set breakpoint in f1"
112
113#
114# Multi-inferior tests.
115#
116
117gdb_test "add-inferior" "Added inferior 2" \
118 "add inferior for linespec tests"
119
120gdb_test "inferior 2" "Switching to inferior 2 .*" \
121 "switch to inferior 2 for linespec tests"
122
123# Note that in particular this should not cause errors when re-setting
124# breakpoints.
125gdb_test "file $binfile" \
126 "Reading symbols from .*done." \
127 "set the new inferior file for linespec tests"
128
129gdb_test "break main" \
130 "Breakpoint \[0-9\]+ at $hex: main. .2 locations." \
131 "set breakpoint at main in both inferiors"
This page took 0.672147 seconds and 4 git commands to generate.