Add translations for various sub-directories
[binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / struct-decl.exp
blob912a3c8e8eea4577b9c67a368a08cdf238469381
1 # Copyright 2022-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 # Check that the DWARF reader works when a DW_AT_specification refers
17 # into a type hierarchy that is marked as a declaration.
19 load_lib dwarf.exp
21 # This test can only be run on targets which support DWARF-2 and use gas.
22 require dwarf2_support
24 standard_testfile main.c -debug.S
26 # Set up the DWARF for the test.
27 set asm_file [standard_output_file $srcfile2]
28 Dwarf::assemble $asm_file {
29     global srcfile
31     cu {} {
32         DW_TAG_compile_unit {
33             {DW_AT_language @DW_LANG_C_plus_plus}
34             {DW_AT_name     $srcfile}
35             {DW_AT_comp_dir /tmp}
37         } {
38             declare_labels origin
40             # The new indexer was ignoring types that were marked as
41             # declarations, even if they could contain methods --
42             # which meant that if a method referred back to them via a
43             # specification, it would get the wrong name.
44             DW_TAG_structure_type {
45                 {DW_AT_byte_size 8 DW_FORM_sdata}
46                 {DW_AT_encoding  @DW_ATE_signed}
47                 {DW_AT_name the_type}
48                 {DW_AT_declaration 1 DW_FORM_flag_present}
49             } {
50                 origin: DW_TAG_subprogram {
51                     {DW_AT_name "method"}
52                     {DW_AT_declaration 1 DW_FORM_flag_present}
53                 }
54             }
56             # The low and high PC are phony: we just need an address
57             # range that is valid in the program, so we use the main
58             # function's range.
59             DW_TAG_subprogram {
60                 {DW_AT_specification :$origin}
61                 {MACRO_AT_range main}
62             }
63         }
64     }
67 if {[prepare_for_testing "failed to prepare" ${testfile} \
68          [list $srcfile $asm_file] {nodebug}]} {
69     return -1
72 gdb_breakpoint "the_type::method" message