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/>.
18 # This test can only be run on targets which support DWARF-2 and use gas.
19 if {![dwarf2_support]} {
23 standard_testfile main.c .S
25 set executable ${testfile}
26 set asm_file [standard_output_file ${srcfile2}]
28 # We need to know the size of integer types in order to write some of the
29 # debugging info we'd like to generate.
30 if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
35 Dwarf::assemble $asm_file {
36 declare_labels cu_label main_label int_label
37 declare_labels aaa_label
38 set int_size [get_sizeof "int" 4]
41 cu_label: partial_unit {
43 {name "imported_unit.c"}
45 int_label: base_type {
46 {byte_size $int_size sdata}
47 {encoding @DW_ATE_signed}
51 main_label: subprogram {
65 {abstract_origin %$main_label}
66 {MACRO_AT_range {main}}
72 if { [prepare_for_testing "failed to prepare" ${testfile} \
73 [list $srcfile $asm_file] {nodebug}] } {
77 if { [ensure_gdb_index $binfile] == -1 } {
81 clean_restart ${binfile}