Update copyright year range in all GDB files.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.linespec / break-ask.exp
CommitLineData
b811d2c2 1# Copyright 2013-2020 Free Software Foundation, Inc.
33f448b1
JK
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
16standard_testfile lspec.cc
17
18if {[skip_cplus_tests]} {
5b362f04 19 unsupported "skipping C++ tests"
33f448b1
JK
20 return
21}
22
23set opts {debug c++}
24set objfile1 [standard_output_file ${testfile}one.o]
25set objfile2 [standard_output_file ${testfile}two.o]
26
27if { [file pathtype $objdir] == "relative" } {
28 untested "objdir $objdir should be absolute"
29 return
30}
31set saved_pwd [pwd]
32cd $srcdir/${subdir}/base/one
33set err1 [gdb_compile "thefile.cc" $objfile1 object $opts]
34cd $saved_pwd
35cd $srcdir/${subdir}/base/two
36set err2 [gdb_compile "thefile.cc" $objfile2 object $opts]
37cd $saved_pwd
38if { $err1 != "" || $err2 != "" } {
39 untested "compilation failed"
40 return -1
41}
42
43if { [gdb_compile "$srcdir/${subdir}/$srcfile $objfile1 $objfile2" \
44 $binfile executable $opts] != "" } {
45 return -1
46}
47
48clean_restart ${testfile}
49
50gdb_test_no_output "set multiple-symbols ask"
51
52gdb_test_no_output "set filename-display absolute"
53set cmd "break twodup"
54set test "break twodup absolute"
55gdb_test_multiple $cmd $test {
020a839d 56 -re "^$cmd\r\n\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] \[^\r\n\]+base.one.thefile\\.cc:twodup\\\(\\\)\r\n\\\[3\\\] \[^\r\n\]+base.two.thefile\\.cc:twodup\\\(\\\)\r\n> $" {
33f448b1
JK
57 pass $test
58 }
59}
60gdb_test "0" "canceled"
61
62gdb_test_no_output "set filename-display relative"
63
64set cmd "break twodup"
65set test "break twodup relative"
66gdb_test_multiple $cmd $test {
67 -re "^$cmd\r\n\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] thefile\\.cc:twodup\\\(\\\)\r\n\\\[3\\\] thefile\\.cc:twodup\\\(\\\)\r\n> $" {
68 pass $test
69 }
70}
71gdb_test "2" "^2\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\."
72
73gdb_breakpoint "body_elsewhere"
74
75gdb_run_cmd
76gdb_test "" "Breakpoint \[0-9\]+, twodup \\(\\) at thefile.cc:\[0-9\]+\r\n.*" "expect breakpoint"
77
020a839d 78gdb_test "info source" "\r\nLocated in \[^\r\n\]+base.one.thefile\\.cc\r\n.*"
33f448b1
JK
79
80gdb_continue_to_breakpoint "body_elsewhere" ".* body_elsewhere marker .*"
81
82delete_breakpoints
83
84set cmd "break twodup"
85set test "break twodup relative other"
86gdb_test_multiple $cmd $test {
87 -re "^$cmd\r\n\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] thefile\\.cc:twodup\\\(\\\)\r\n\\\[3\\\] thefile\\.cc:twodup\\\(\\\)\r\n> $" {
88 pass $test
89 }
90}
91gdb_test "3" "^3\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\."
92
93gdb_breakpoint "body_elsewhere"
94
95gdb_run_cmd
96gdb_test "" "Breakpoint \[0-9\]+, twodup \\(\\) at thefile.cc:\[0-9\]+\r\n.*" "expect breakpoint other"
97
020a839d 98gdb_test "info source" "\r\nLocated in \[^\r\n\]+.base.two.thefile\\.cc\r\n.*" "info source other"
33f448b1
JK
99
100gdb_continue_to_breakpoint "body_elsewhere other" ".* body_elsewhere marker .*"
This page took 0.763503 seconds and 4 git commands to generate.