1 # Copyright (C) 2013-2019 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 if {![dwarf2_support]} {
25 set asm_file [standard_output_file "${testfile}-dbg.s"]
28 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
29 object {nodebug}] != "" } {
33 Dwarf::assemble $asm_file {
34 declare_labels uchar_label struct_s_label foo_label struct_t_label bar_label
37 compile_unit {{language @DW_LANG_C}} {
38 uchar_label: DW_TAG_base_type {
39 {name "unsigned char"}
40 {byte_size 1 DW_FORM_sdata}
41 {encoding @DW_ATE_unsigned_char}
44 struct_s_label: DW_TAG_structure_type {
46 {byte_size 3 DW_FORM_sdata}
47 {decl_file 1 DW_FORM_sdata}
48 {decl_line 1 DW_FORM_sdata}
53 {data_member_location {
60 {data_member_location {
67 {data_member_location {
73 struct_t_label: DW_TAG_structure_type {
75 {byte_size 3 DW_FORM_sdata}
76 {decl_file 1 DW_FORM_sdata}
77 {decl_line 1 DW_FORM_sdata}
82 {data_member_location {
89 {byte_size 1 DW_FORM_sdata}
90 {bit_size 1 DW_FORM_sdata}
91 {bit_offset 7 DW_FORM_sdata}
92 {data_member_location {
99 {byte_size 1 DW_FORM_sdata}
100 {bit_size 1 DW_FORM_sdata}
101 {bit_offset 6 DW_FORM_sdata}
102 {data_member_location {
109 {byte_size 1 DW_FORM_sdata}
110 {bit_size 1 DW_FORM_sdata}
111 {bit_offset 5 DW_FORM_sdata}
112 {data_member_location {
119 {byte_size 1 DW_FORM_sdata}
120 {bit_size 1 DW_FORM_sdata}
121 {bit_offset 4 DW_FORM_sdata}
122 {data_member_location {
129 {byte_size 1 DW_FORM_sdata}
130 {bit_size 1 DW_FORM_sdata}
131 {bit_offset 3 DW_FORM_sdata}
132 {data_member_location {
139 {byte_size 1 DW_FORM_sdata}
140 {bit_size 1 DW_FORM_sdata}
141 {bit_offset 2 DW_FORM_sdata}
142 {data_member_location {
149 {byte_size 1 DW_FORM_sdata}
150 {bit_size 1 DW_FORM_sdata}
151 {bit_offset 1 DW_FORM_sdata}
152 {data_member_location {
159 {byte_size 1 DW_FORM_sdata}
160 {bit_size 1 DW_FORM_sdata}
161 {bit_offset 0 DW_FORM_sdata}
162 {data_member_location {
169 {data_member_location {
178 {low_pc foo_start_lbl addr}
179 {high_pc foo_end_lbl addr}
181 DW_TAG_formal_parameter {
182 {type :$struct_s_label}
192 DW_TAG_formal_parameter {
193 {type :$struct_s_label}
206 DW_TAG_formal_parameter {
207 {type :$struct_s_label}
223 {low_pc bar_start_lbl addr}
224 {high_pc bar_end_lbl addr}
226 DW_TAG_formal_parameter {
227 {type :$struct_t_label}
243 DW_TAG_formal_parameter {
244 {type :$struct_t_label}
263 DW_TAG_formal_parameter {
264 {type :$struct_t_label}
286 if { [gdb_compile ${asm_file} ${binfile}2.o object {nodebug}] != "" } {
290 if { [gdb_compile [list ${binfile}1.o ${binfile}2.o] ${binfile} \
291 executable {}] != "" } {
295 clean_restart ${testfile}
301 if ![gdb_target_supports_trace] {
302 unsupported "target does not support trace"
306 gdb_breakpoint "end" qualified
308 with_test_prefix "tracing foo" {
309 gdb_test "trace *foo_start_lbl" ".*"
310 gdb_test_no_output "tstart"
311 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
312 gdb_test_no_output "tstop"
314 gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
315 gdb_test "p/d x" "\\\$${decimal} = {a = 0, b = 0, c = <unavailable>}"
316 gdb_test "p/d y" "\\\$${decimal} = {a = 0, b = <unavailable>, c = 0}"
317 gdb_test "p/d z" "\\\$${decimal} = {a = <unavailable>, b = 0, c = 0}"
319 gdb_test "tfind none" "No longer looking at any trace frame.*"
322 with_test_prefix "tracing bar" {
323 gdb_test "trace *bar_start_lbl" ".*"
324 gdb_test_no_output "tstart"
325 gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
326 gdb_test_no_output "tstop"
328 set endian [get_endianness]
330 gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
331 if { $endian == "little" } {
332 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}"
333 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}"
334 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}"
336 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}"
337 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}"
338 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}"
341 gdb_test "tfind none" "No longer looking at any trace frame.*"