Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / struct-with-sig-2.exp
blob00af7251f9d1d1a3569b5e60b323b57e8e025012
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.
18 load_lib dwarf.exp
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 {
30     build_id $::build_id
32     tu {} 0x0000000000000001 the_type_i {
33         type_unit {} {
34             declare_labels int_type
36             the_type_i: structure_type {
37                 {name s}
38                 {byte_size 4 sdata}
39             } {
40                 member {
41                     {name i}
42                     {type :$int_type}
43                 }
44             }
45             int_type: base_type {
46                 {name int}
47                 {encoding @DW_ATE_signed}
48                 {byte_size 4 sdata}
49             }
50         }
51     }
53     tu {} 0x0000000000000002 the_type_j {
54         type_unit {} {
55             declare_labels int_type
57             the_type_j: structure_type {
58                 {name s}
59                 {byte_size 4 sdata}
60             } {
61                 member {
62                     {name j}
63                     {type :$int_type}
64                 }
65             }
66             int_type: base_type {
67                 {name int}
68                 {encoding @DW_ATE_signed}
69                 {byte_size 4 sdata}
70             }
71         }
72     }
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}] != "" } {
79     return -1
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
89     cu {} {
90         compile_unit {
91             {DW_AT_language @DW_LANG_C}
92             {DW_AT_name main.c}
93         } {
94             structure_type {
95                 {name s}
96                 {signature 0x0000000000000001 ref_sig8}
97                 {declaration 1 flag}
98             }
99             DW_TAG_subprogram {
100                 {MACRO_AT_func {main}}
101             }
102         }
103     }
105     cu {} {
106         compile_unit {
107             {DW_AT_language @DW_LANG_C}
108             {DW_AT_name     foo.c}
109         } {
110             structure_type {
111                 {name s}
112                 {signature 0x0000000000000002 ref_sig8}
113                 {declaration 1 flag}
114             }
115             DW_TAG_subprogram {
116                 {MACRO_AT_func {foo}}
117             }
118         }
119     }
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}] } {
127         return -1
128     }
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"