]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - 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
1 # Copyright 2013-2024 Free Software Foundation, Inc.
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 standard_testfile lspec.cc
17
18 require allow_cplus_tests
19
20 set opts {debug c++}
21 set objfile1 [standard_output_file ${testfile}one.o]
22 set objfile2 [standard_output_file ${testfile}two.o]
23
24 if { [file pathtype $objdir] == "relative" } {
25 untested "objdir $objdir should be absolute"
26 return
27 }
28
29 with_cwd $srcdir/${subdir}/base/one {
30 if { [gdb_compile "thefile.cc" $objfile1 object $opts] != "" } {
31 untested "compilation failed"
32 return
33 }
34 }
35
36 with_cwd $srcdir/${subdir}/base/two {
37 if { [gdb_compile "thefile.cc" $objfile2 object $opts] != "" } {
38 untested "compilation failed"
39 return
40 }
41 }
42
43 if { [gdb_compile "$srcdir/${subdir}/$srcfile $objfile1 $objfile2" \
44 $binfile executable $opts] != "" } {
45 return -1
46 }
47
48 clean_restart ${testfile}
49
50 gdb_test_no_output "set multiple-symbols ask"
51
52 gdb_test_no_output "set filename-display absolute"
53 set cmd "break twodup"
54 set test "break twodup absolute"
55 gdb_test_multiple $cmd $test {
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> $" {
57 pass $test
58 }
59 }
60 gdb_test "0" "canceled"
61
62 gdb_test_no_output "set filename-display relative"
63
64 set cmd "break twodup"
65 set test "break twodup relative"
66 gdb_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 }
71 gdb_test "2" "^Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\."
72
73 gdb_breakpoint "body_elsewhere"
74
75 gdb_run_cmd
76 gdb_test "" "Breakpoint \[0-9\]+, twodup \\(\\) at thefile.cc:\[0-9\]+\r\n.*" "expect breakpoint"
77
78 gdb_test "info source" "\r\nLocated in \[^\r\n\]+base.one.thefile\\.cc\r\n.*"
79
80 gdb_continue_to_breakpoint "body_elsewhere" ".* body_elsewhere marker .*"
81
82 delete_breakpoints
83
84 set cmd "break twodup"
85 set test "break twodup relative other"
86 gdb_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 }
91 gdb_test "3" "^Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file thefile\\.cc, line \[0-9a-f\]+\\."
92
93 gdb_breakpoint "body_elsewhere"
94
95 gdb_run_cmd
96 gdb_test "" "Breakpoint \[0-9\]+, twodup \\(\\) at thefile.cc:\[0-9\]+\r\n.*" "expect breakpoint other"
97
98 gdb_test "info source" "\r\nLocated in \[^\r\n\]+.base.two.thefile\\.cc\r\n.*" "info source other"
99
100 gdb_continue_to_breakpoint "body_elsewhere other" ".* body_elsewhere marker .*"