]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / imported-unit-runto-main.exp
1 # Copyright 2020-2024 Free Software Foundation, Inc.
2
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.
7 #
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.
12 #
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/>.
15
16 load_lib dwarf.exp
17
18 # This test can only be run on targets which support DWARF-2 and use gas.
19 require dwarf2_support
20
21 standard_testfile main.c .S
22
23 set executable ${testfile}
24 set asm_file [standard_output_file ${srcfile2}]
25
26 # We need to know the size of integer types in order to write some of the
27 # debugging info we'd like to generate.
28 if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
29 return -1
30 }
31
32 # Create the DWARF.
33 Dwarf::assemble $asm_file {
34 declare_labels cu_label main_label int_label
35 declare_labels aaa_label
36 set int_size [get_sizeof "int" 4]
37
38 cu {} {
39 cu_label: partial_unit {
40 {language @DW_LANG_C}
41 {name "imported_unit.c"}
42 } {
43 int_label: base_type {
44 {byte_size $int_size sdata}
45 {encoding @DW_ATE_signed}
46 {name int}
47 }
48
49 main_label: subprogram {
50 {name main}
51 {type :$int_label}
52 {external 1 flag}
53 }
54 }
55 }
56
57 cu {} {
58 compile_unit {
59 {language @DW_LANG_C}
60 {name "<artificial>"}
61 } {
62 subprogram {
63 {abstract_origin %$main_label}
64 {MACRO_AT_range {main}}
65 }
66 }
67 }
68 }
69
70 if { [prepare_for_testing "failed to prepare" ${testfile} \
71 [list $srcfile $asm_file] {nodebug}] } {
72 return -1
73 }
74
75 if { [ensure_gdb_index $binfile] == -1 } {
76 untested "error adding gdb index"
77 return -1
78 }
79
80 clean_restart ${binfile}
81
82 runto main