1 # Copyright (C) 2013-2024 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/>.
16 load_lib "trace-support.exp"
19 require dwarf2_support
21 standard_testfile .c -dbg.S
23 set asm_file [standard_output_file $srcfile2]
26 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
27 object {nodebug}] != "" } {
31 Dwarf::assemble $asm_file {
32 declare_labels uchar_label struct_s_label foo_label struct_t_label bar_label
35 compile_unit {{language @DW_LANG_C}} {
36 uchar_label: DW_TAG_base_type {
37 {name "unsigned char"}
38 {byte_size 1 DW_FORM_sdata}
39 {encoding @DW_ATE_unsigned_char}
42 struct_s_label: DW_TAG_structure_type {
44 {byte_size 3 DW_FORM_sdata}
45 {decl_file 0 DW_FORM_udata}
46 {decl_line 1 DW_FORM_udata}
51 {data_member_location {
58 {data_member_location {
65 {data_member_location {
71 struct_t_label: DW_TAG_structure_type {
73 {byte_size 3 DW_FORM_sdata}
74 {decl_file 0 DW_FORM_udata}
75 {decl_line 1 DW_FORM_udata}
80 {data_member_location {
87 {byte_size 1 DW_FORM_sdata}
88 {bit_size 1 DW_FORM_sdata}
89 {bit_offset 7 DW_FORM_sdata}
90 {data_member_location {
97 {byte_size 1 DW_FORM_sdata}
98 {bit_size 1 DW_FORM_sdata}
99 {bit_offset 6 DW_FORM_sdata}
100 {data_member_location {
107 {byte_size 1 DW_FORM_sdata}
108 {bit_size 1 DW_FORM_sdata}
109 {bit_offset 5 DW_FORM_sdata}
110 {data_member_location {
117 {byte_size 1 DW_FORM_sdata}
118 {bit_size 1 DW_FORM_sdata}
119 {bit_offset 4 DW_FORM_sdata}
120 {data_member_location {
127 {byte_size 1 DW_FORM_sdata}
128 {bit_size 1 DW_FORM_sdata}
129 {bit_offset 3 DW_FORM_sdata}
130 {data_member_location {
137 {byte_size 1 DW_FORM_sdata}
138 {bit_size 1 DW_FORM_sdata}
139 {bit_offset 2 DW_FORM_sdata}
140 {data_member_location {
147 {byte_size 1 DW_FORM_sdata}
148 {bit_size 1 DW_FORM_sdata}
149 {bit_offset 1 DW_FORM_sdata}
150 {data_member_location {
157 {byte_size 1 DW_FORM_sdata}
158 {bit_size 1 DW_FORM_sdata}
159 {bit_offset 0 DW_FORM_sdata}
160 {data_member_location {
167 {data_member_location {
176 {low_pc foo_start_lbl addr}
177 {high_pc foo_end_lbl addr}
179 DW_TAG_formal_parameter {
180 {type :$struct_s_label}
190 DW_TAG_formal_parameter {
191 {type :$struct_s_label}
204 DW_TAG_formal_parameter {
205 {type :$struct_s_label}
221 {low_pc bar_start_lbl addr}
222 {high_pc bar_end_lbl addr}
224 DW_TAG_formal_parameter {
225 {type :$struct_t_label}
241 DW_TAG_formal_parameter {
242 {type :$struct_t_label}
261 DW_TAG_formal_parameter {
262 {type :$struct_t_label}
284 if { [gdb_compile ${asm_file} ${binfile}2.o object {nodebug}] != "" } {
288 if { [gdb_compile [list ${binfile}1.o ${binfile}2.o] ${binfile} \
289 executable {}] != "" } {
293 clean_restart ${testfile}
299 if ![gdb_target_supports_trace] {
300 unsupported "target does not support trace"
304 gdb_breakpoint "end" qualified
306 with_test_prefix "tracing foo" {
307 gdb_test "trace *foo_start_lbl" ".*"
308 gdb_test_no_output "tstart"
309 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
310 gdb_test_no_output "tstop"
312 gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
313 gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = 0, c = <unavailable>}"
314 gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0}"
315 gdb_test "p/d z" "\\\$${decimal} = {a = <unavailable>, b = 0, c = 0}"
317 gdb_test "tfind none" "No longer looking at any trace frame.*"
320 with_test_prefix "tracing bar" {
321 gdb_test "trace *bar_start_lbl" ".*"
322 gdb_test_no_output "tstart"
323 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
324 gdb_test_no_output "tstop"
326 set endian [get_endianness]
328 gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
329 if { $endian == "little" } {
330 gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}"
331 gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = <unavailable>, f = 0, g = 0, h = 0, i = 0, j = 0}"
332 gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = <unavailable>, j = 0}"
334 gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = <unavailable>, j = 0}"
335 gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = 0, c = 0, d = 0, e = 0, f = <unavailable>, g = 0, h = 0, i = 0, j = 0}"
336 gdb_test "p/d z" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0}"
339 gdb_test "tfind none" "No longer looking at any trace frame.*"