1# Copyright 2021-2023 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 16load_lib dwarf.exp 17 18# This test can only be run on targets which support DWARF-2 and use gas. 19if {![dwarf2_support]} { 20 return 0 21} 22 23# No remote host testing either. 24if {[is_remote host]} { 25 return 0 26} 27 28standard_testfile main.c dwznolink.S 29 30set asm_file [standard_output_file $srcfile2] 31 32# The DWARF should contain a reference to a supplementary ("dwz") 33# file, but the section that links to the file should be missing. At 34# one point, this caused gdb crashes. 35Dwarf::assemble $asm_file { 36 cu {} { 37 compile_unit {{language @DW_LANG_C}} { 38 constant { 39 {name 0 DW_FORM_GNU_strp_alt} 40 {type 97 DW_FORM_GNU_ref_alt} 41 {const_value 99 data1} 42 } 43 } 44 } 45} 46 47# We can't use prepare_for_testing here because we need to check the 48# 'file' command's output. 49if {[build_executable $testfile.exp $testfile \ 50 [list $srcfile $asm_file] {nodebug quiet}]} { 51 return -1 52} 53 54gdb_exit 55gdb_start 56gdb_reinitialize_dir $srcdir/$subdir 57 58gdb_test "file -readnow $binfile" \ 59 "could not read '.gnu_debugaltlink' section" \ 60 "file $testfile" 61