gdb: handle endbr64 instruction in amd64_analyze_prologue
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / imported-unit-abstract-const-value.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 # Test that a concrete var importing an abstract var using
17 # DW_AT_abstract_origin inherits the DW_AT_const_value attribute.
18
19 load_lib dwarf.exp
20
21 # This test can only be run on targets which support DWARF-2 and use gas.
22 if {![dwarf2_support]} {
23 return 0
24 };
25
26 standard_testfile main.c .S
27
28 set executable ${testfile}
29 set asm_file [standard_output_file ${srcfile2}]
30
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}] {
34 return -1
35 }
36
37 # Create the DWARF.
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]
42
43 global srcdir subdir srcfile
44
45 extern main
46
47 set main_range [function_range main ${srcdir}/${subdir}/${srcfile}]
48 set main_start [lindex $main_range 0]
49 set main_length [lindex $main_range 1]
50
51 cu {} {
52 cu_label: partial_unit {
53 {language @DW_LANG_C}
54 {name "imported_unit.c"}
55 } {
56 int_label: base_type {
57 {byte_size $int_size sdata}
58 {encoding @DW_ATE_signed}
59 {name int}
60 }
61
62 aaa_label: DW_TAG_variable {
63 {name aaa}
64 {type :$int_label}
65 {const_value 1 DW_FORM_sdata}
66 }
67
68 main_label: subprogram {
69 {name main}
70 {type :$int_label}
71 {external 1 flag}
72 }
73 }
74 }
75
76 cu {} {
77 compile_unit {
78 {language @DW_LANG_C}
79 {name "<artificial>"}
80 } {
81 DW_TAG_variable {
82 {abstract_origin %$aaa_label}
83 }
84 subprogram {
85 {abstract_origin %$main_label}
86 {low_pc $main_start addr}
87 {high_pc "$main_start + $main_length" addr}
88 }
89 }
90 }
91 }
92
93 if { [prepare_for_testing "failed to prepare" ${testfile} \
94 [list $srcfile $asm_file] {nodebug}] } {
95 return -1
96 }
97
98 gdb_test "p aaa" "= 1"
This page took 0.033219 seconds and 4 git commands to generate.