Commit | Line | Data |
---|---|---|
11bc5fe4 | 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 | ||
16 | standard_testfile lspec.cc | |
17 | ||
18 | if {[skip_cplus_tests]} { | |
5b362f04 | 19 | unsupported "skipping C++ tests" |
33f448b1 JK |
20 | return |
21 | } | |
22 | ||
23 | set opts {debug c++} | |
24 | set objfile1 [standard_output_file ${testfile}one.o] | |
25 | set objfile2 [standard_output_file ${testfile}two.o] | |
26 | ||
27 | if { [file pathtype $objdir] == "relative" } { | |
28 | untested "objdir $objdir should be absolute" | |
29 | return | |
30 | } | |
31 | set saved_pwd [pwd] | |
32 | cd $srcdir/${subdir}/base/one | |
33 | set err1 [gdb_compile "thefile.cc" $objfile1 object $opts] | |
34 | cd $saved_pwd | |
35 | cd $srcdir/${subdir}/base/two | |
36 | set err2 [gdb_compile "thefile.cc" $objfile2 object $opts] | |
37 | cd $saved_pwd | |
38 | if { $err1 != "" || $err2 != "" } { | |
39 | untested "compilation failed" | |
40 | return -1 | |
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 { | |
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 | } | |
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" "^2\r\nBreakpoint \[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 | ||
020a839d | 78 | gdb_test "info source" "\r\nLocated in \[^\r\n\]+base.one.thefile\\.cc\r\n.*" |
33f448b1 JK |
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" "^3\r\nBreakpoint \[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 | ||
020a839d | 98 | gdb_test "info source" "\r\nLocated in \[^\r\n\]+.base.two.thefile\\.cc\r\n.*" "info source other" |
33f448b1 JK |
99 | |
100 | gdb_continue_to_breakpoint "body_elsewhere other" ".* body_elsewhere marker .*" |