1 # Copyright 2020-2024 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Variant of struct-with-sig.exp where TUs are in .gnu_debugaltlink file.
20 # This test can only be run on targets which support DWARF-2 and use gas.
21 require dwarf2_support
23 standard_testfile main-foo.c .S .S
25 set build_id [string repeat ff 20]
27 # Make some DWARF for the dwz file.
28 set asm_file [standard_output_file $srcfile2]
29 Dwarf::assemble $asm_file {
32 tu {} 0x0000000000000001 the_type_i {
34 declare_labels int_type
36 the_type_i: structure_type {
47 {encoding @DW_ATE_signed}
53 tu {} 0x0000000000000002 the_type_j {
55 declare_labels int_type
57 the_type_j: structure_type {
68 {encoding @DW_ATE_signed}
75 # We're using an object instead of executable here to keep cc-with-tweaks.sh
76 # from modifying it. It also means we can set the build-id, rather than
77 # having to extract it.
78 if { [gdb_compile $asm_file $binfile.dwz object {nodebug}] != "" } {
82 set host_dwz_file [gdb_remote_download host $binfile.dwz]
84 # Make some DWARF for the executable.
85 set asm_file [standard_output_file $srcfile3]
86 Dwarf::assemble $asm_file {
87 gnu_debugaltlink $::host_dwz_file $::build_id
91 {DW_AT_language @DW_LANG_C}
96 {signature 0x0000000000000001 ref_sig8}
100 {MACRO_AT_func {main}}
107 {DW_AT_language @DW_LANG_C}
112 {signature 0x0000000000000002 ref_sig8}
116 {MACRO_AT_func {foo}}
122 save_vars { GDBFLAGS } {
123 append GDBFLAGS " -iex \"maint set dwarf synchronous on\""
125 if { [prepare_for_testing "failed to prepare" ${testfile} \
126 [list $srcfile $asm_file] {nodebug}] } {
131 set re "DWARF Error: .debug_types section not supported in dwz file"
132 gdb_assert { [regexp $re $gdb_file_cmd_msg] } "Dwarf Error message"