1 # Copyright 2019-2025 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 # Test that GDB can find the default symtab when it is a symbolic link. 17 standard_testfile 18 19 set test "file symbolic link name" 20 set linksrc "link-${srcfile}" 21 set srcfilelink [standard_output_file $linksrc] 22 23 24 # Remove any existing symlink and build executable using a 25 # symbolic link to the actual source file. 26 remote_file host delete $srcfilelink 27 set status [remote_exec host \ 28 "ln -sf $srcdir/$subdir/$srcfile $srcfilelink"] 29 if {[lindex $status 0] != 0} { 30 unsupported "$test (host does not support symbolic links)" 31 return 0 32 } 33 34 if {[prepare_for_testing $testfile $testfile $srcfilelink]} { 35 return -1 36 } 37 38 if {![runto_main]} { 39 return -1 40 } 41 42 # Using a line number ensures that the default symtab is used. 43 gdb_breakpoint [gdb_get_line_number "break here" $srcfile] message 44 gdb_continue_to_breakpoint "run to breakpoint marker" 45