1 # Copyright 2023-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 with a a DW_AT_specification that
17 # refers to a later DIE.
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}
38 declare_labels spec myint
40 # The new indexer has special code to compute the full
41 # name of an object that uses a specification that appears
44 {DW_AT_specification :$spec}
51 myint: DW_TAG_base_type {
52 {DW_AT_byte_size 4 DW_FORM_sdata}
53 {DW_AT_encoding @DW_ATE_signed}
60 spec: DW_TAG_variable {
63 {DW_AT_declaration 1 DW_FORM_flag_present}
70 if {[prepare_for_testing "failed to prepare" ${testfile} \
71 [list $srcfile $asm_file] {nodebug}]} {
76 gdb_test_multiple "maint print objfiles" "v has a parent" {
77 -re "^ *\\\[\[0-9\]\\\] *\\(\\(cooked_index_entry\[^\r\n\]*" {
81 -re "^ *name: *v\[\r\n\]*" {
85 -re "^ *parent: *\\(\\(cooked_index_entry \\*\\) (0|$hex)\\)" {
87 if {$expect_out(1,string) == "0"} {
96 -re "^\[^\r\n\]*\[\r\n\]+" {