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.
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 {
33 {DW_AT_language @DW_LANG_C_plus_plus}
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}
48 {DW_AT_declaration 1 DW_FORM_flag_present}
50 origin: DW_TAG_subprogram {
52 {DW_AT_declaration 1 DW_FORM_flag_present}
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
60 {DW_AT_specification :$origin}
67 if {[prepare_for_testing "failed to prepare" ${testfile} \
68 [list $srcfile $asm_file] {nodebug}]} {
72 gdb_breakpoint "the_type::method" message