1 # Copyright 2020-2021 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 # Test that a concrete var importing an abstract var using
17 # DW_AT_abstract_origin inherits the DW_AT_const_value attribute.
21 # This test can only be run on targets which support DWARF-2 and use gas.
22 if {![dwarf2_support]} {
26 standard_testfile main.c .S
28 set executable ${testfile}
29 set asm_file [standard_output_file ${srcfile2}]
31 # We need to know the size of integer type in order
32 # to write some of the debugging info we'd like to generate.
33 if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
38 Dwarf::assemble $asm_file {
39 declare_labels cu_label main_label int_label
40 declare_labels aaa_label
41 set int_size [get_sizeof "int" 4]
44 cu_label: partial_unit {
46 {name "imported_unit.c"}
48 int_label: base_type {
49 {byte_size $int_size sdata}
50 {encoding @DW_ATE_signed}
54 aaa_label: DW_TAG_variable {
57 {const_value 1 DW_FORM_sdata}
60 main_label: subprogram {
74 {abstract_origin %$aaa_label}
77 {abstract_origin %$main_label}
78 {MACRO_AT_range {main}}
84 if { [prepare_for_testing "failed to prepare" ${testfile} \
85 [list $srcfile $asm_file] {nodebug}] } {
89 gdb_test "p aaa" "= 1"