replace_typedefs: handle templates in namespaces
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / imported-unit-runto-main.exp
1 # Copyright 2020 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 if {![dwarf2_support]} {
20 return 0
21 };
22
23 standard_testfile main.c .S
24
25 set executable ${testfile}
26 set asm_file [standard_output_file ${srcfile2}]
27
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}] {
31 return -1
32 }
33
34 # Create the DWARF.
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]
39
40 global srcdir subdir srcfile
41
42 extern main
43
44 set main_range [function_range main ${srcdir}/${subdir}/${srcfile}]
45 set main_start [lindex $main_range 0]
46 set main_length [lindex $main_range 1]
47
48 cu {} {
49 cu_label: partial_unit {
50 {language @DW_LANG_C}
51 {name "imported_unit.c"}
52 } {
53 int_label: base_type {
54 {byte_size $int_size sdata}
55 {encoding @DW_ATE_signed}
56 {name int}
57 }
58
59 main_label: subprogram {
60 {name main}
61 {type :$int_label}
62 {external 1 flag}
63 }
64 }
65 }
66
67 cu {} {
68 compile_unit {
69 {language @DW_LANG_C}
70 {name "<artificial>"}
71 } {
72 subprogram {
73 {abstract_origin %$main_label}
74 {low_pc $main_start addr}
75 {high_pc "$main_start + $main_length" addr}
76 }
77 }
78 }
79 }
80
81 if { [prepare_for_testing "failed to prepare" ${testfile} \
82 [list $srcfile $asm_file] {nodebug}] } {
83 return -1
84 }
85
86 if { [ensure_gdb_index $binfile] == -1 } {
87 return -1
88 }
89
90 clean_restart ${binfile}
91
92 runto main message
This page took 0.033305 seconds and 4 git commands to generate.