gdb: handle endbr64 instruction in amd64_analyze_prologue
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / struct-with-sig.exp
CommitLineData
15cd93d0
TV
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/>.
15load_lib dwarf.exp
16
17# This test can only be run on targets which support DWARF-2 and use gas.
18if {![dwarf2_support]} {
19 return 0
20}
21
22standard_testfile main-foo.c .S
23
24# Make some DWARF for the test.
25set asm_file [standard_output_file $srcfile2]
26Dwarf::assemble $asm_file {
27 global srcdir subdir srcfile
28
29 lassign [function_range main ${srcdir}/${subdir}/${srcfile}] \
30 main_start main_length
31
32 lassign [function_range foo ${srcdir}/${subdir}/${srcfile}] \
33 foo_start foo_length
34
35 cu {} {
36 compile_unit {
37 {DW_AT_language @DW_LANG_C}
38 {DW_AT_name main.c}
39 } {
40 structure_type {
41 {name s}
42 {signature 0x0000000000000001 ref_sig8}
43 {declaration 1 flag}
44 }
45 DW_TAG_subprogram {
46 {name "main"}
47 {low_pc $main_start addr}
48 {high_pc "$main_start + $main_length" addr}
49 }
50 }
51 }
52
53 cu {} {
54 compile_unit {
55 {DW_AT_language @DW_LANG_C}
56 {DW_AT_name foo.c}
57 } {
58 structure_type {
59 {name s}
60 {signature 0x0000000000000002 ref_sig8}
61 {declaration 1 flag}
62 }
63 DW_TAG_subprogram {
64 {name "foo"}
65 {low_pc $foo_start addr}
66 {high_pc "$foo_start + $foo_length" addr}
67 }
68 }
69 }
70
71 tu {} 0x0000000000000001 the_type_i {
72 type_unit {} {
73 declare_labels int_type
74
75 the_type_i: structure_type {
76 {name s}
77 {byte_size 4 sdata}
78 } {
79 member {
80 {name i}
81 {type :$int_type}
82 }
83 }
84 int_type: base_type {
85 {name int}
86 {encoding @DW_ATE_signed}
87 {byte_size 4 sdata}
88 }
89 }
90 }
91
92 tu {} 0x0000000000000002 the_type_j {
93 type_unit {} {
94 declare_labels int_type
95
96 the_type_j: structure_type {
97 {name s}
98 {byte_size 4 sdata}
99 } {
100 member {
101 {name j}
102 {type :$int_type}
103 }
104 }
105 int_type: base_type {
106 {name int}
107 {encoding @DW_ATE_signed}
108 {byte_size 4 sdata}
109 }
110 }
111 }
112}
113
114if { [prepare_for_testing "failed to prepare" ${testfile} \
115 [list $srcfile $asm_file] {nodebug}] } {
116 return -1
117}
118
119set struct_s_i_re \
120 [multi_line \
121 "type = struct s {" \
122 " int i;" \
123 "}"]
124set struct_s_j_re \
125 [multi_line \
126 "type = struct s {" \
127 " int j;" \
128 "}"]
129
130if ![runto_main] {
131 return -1
132}
133
134gdb_test "ptype struct s" $struct_s_i_re \
135 "struct s with int i"
136
137gdb_breakpoint "foo"
138gdb_continue_to_breakpoint "foo"
139
140gdb_test "ptype struct s" $struct_s_j_re \
141 "struct s with int j"
This page took 0.044211 seconds and 4 git commands to generate.