2 # Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # This file tests setting breakpoints according to the full path of a
20 set testfile "fullname"
21 set srcfile ${testfile}.c
22 set binfile ${objdir}/${subdir}/${testfile}
24 # We rely on being able to copy things around.
26 if { [is_remote host] } {
27 untested "setting breakpoints by full path"
31 # Create a temporary file in the build directory. Use a different
32 # filename in case ${srcdir} == ${objdir}.
33 if { [catch {file copy -force ${srcdir}/${subdir}/${srcfile} \
34 ${objdir}/${subdir}/tmp-${srcfile}}] != 0 } {
35 error "Could not create temporary file"
39 # Build the test executable using an absolute path.
40 if { [gdb_compile "${objdir}/${subdir}/tmp-${srcfile}" "${binfile}" executable {debug}] != "" } {
44 # Unlike most GDB tests, we do not use gdb_reinitialize_dir in this script.
45 # We're testing GDB's ability to find files in other ways.
47 # Get the line number.
49 set line [gdb_get_line_number "set breakpoint 1 here"]
51 # Initialize GDB after getting the line number, to make sure
52 # symbols aren't loaded.
58 set msg "set breakpoint by full path before loading symbols - built absolute"
59 if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
65 gdb_test "break main" \
66 "Breakpoint.*at.*line.*" "set breakpoint at main - built absolute"
68 set msg "set breakpoint by full path after loading symbols - built absolute"
69 if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
75 # Build the test executable using a relative path.
76 if { [gdb_compile "${subdir}/tmp-${srcfile}" "${binfile}" executable {debug}] != "" } {
84 set msg "set breakpoint by full path before loading symbols - built relative"
85 if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
91 gdb_test "break main" \
92 "Breakpoint.*at.*line.*" "set breakpoint at main - built relative"
94 set msg "set breakpoint by full path after loading symbols - built relative"
95 if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
101 # Build the test executable using relative paths not relative to the directory
102 # we'll run GDB from.
106 if { [gdb_compile "tmp-${srcfile}" "${testfile}" executable {debug}] != "" } {
116 set msg "set breakpoint by full path before loading symbols - built other"
117 if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
123 gdb_test "break main" \
124 "Breakpoint.*at.*line.*" "set breakpoint at main - built other"
126 set msg "set breakpoint by full path after loading symbols - built other"
127 if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {