]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.linespec/break-ask.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.linespec / break-ask.exp
CommitLineData
1d506c26 1# Copyright 2013-2024 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
0b94d2b9 18require allow_cplus_tests
33f448b1
JK
19
20set opts {debug c++}
21set objfile1 [standard_output_file ${testfile}one.o]
22set objfile2 [standard_output_file ${testfile}two.o]
23
24if { [file pathtype $objdir] == "relative" } {
25 untested "objdir $objdir should be absolute"
26 return
27}
019a5c62
SM
28
29with_cwd $srcdir/${subdir}/base/one {
30 if { [gdb_compile "thefile.cc" $objfile1 object $opts] != "" } {
31 untested "compilation failed"
32 return
33 }
34}
35
36with_cwd $srcdir/${subdir}/base/two {
37 if { [gdb_compile "thefile.cc" $objfile2 object $opts] != "" } {
38 untested "compilation failed"
39 return
40 }
33f448b1
JK
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}
08ec06d6 71gdb_test "2" "^Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\."
33f448b1
JK
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}
08ec06d6 91gdb_test "3" "^Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\."
33f448b1
JK
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 .*"