1 # Copyright
2012-2022 Free Software Foundation
, Inc.
2 # This
program is free software
; you can redistribute it and
/or modify
3 # it under the terms of the GNU General Public License as published by
4 # the Free Software Foundation
; either version
3 of the License
, or
5 #
(at your option
) any later version.
7 # This
program is distributed in the hope that it will be useful
,
8 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
9 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
10 # GNU General Public License
for more details.
12 # You should have received a copy of the GNU General Public License
13 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
15 load_lib
"trace-support.exp"
18 set executable $testfile
19 set expfile $testfile.exp
21 # Some targets have leading underscores
on assembly symbols.
22 set additional_flags
[gdb_target_symbol_prefix_flags
]
24 if ![gdb_trace_common_supports_arch
] {
25 unsupported
"no trace-common.h support for arch"
29 if { [gdb_compile_pthreads
"$srcdir/$subdir/$srcfile" $binfile \
30 executable
[list debug $additional_flags
] ] != "" } {
31 # gdb_compile_pthreads provides an appropriate unsupported message.
35 clean_restart $
{testfile
}
41 if ![gdb_target_supports_trace
] {
42 unsupported
"target does not support trace"
46 proc step_over_tracepoint
{ trace_type
} \
47 {with_test_prefix
"step over $trace_type" \
52 # Start with a fresh gdb.
53 clean_restart $
{executable
}
54 # Make sure inferior is running in all
-stop
mode.
55 gdb_test_no_output
"set non-stop 0"
60 gdb_test
"break set_point1" "Breakpoint \[0-9\] at $hex: file.*"
61 gdb_test
"continue" "Continuing\\.\[ \r\n\]+.*Breakpoint.*" "continue to set_point1"
63 gdb_test
"${trace_type} *\$pc" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
64 gdb_test_no_output
"tstart"
67 gdb_test_no_output
"tstop"
70 #
Set breakpoint and tracepoint at the same address.
72 proc break_trace_same_addr
{ trace_type option
} \
73 {with_test_prefix
"$trace_type $option" \
78 # Start with a fresh gdb.
79 clean_restart $
{executable
}
84 gdb_test_no_output
"set breakpoint always-inserted ${option}"
86 gdb_breakpoint
"end" qualified
88 gdb_test
"break set_point1" "Breakpoint \[0-9\] at $hex: file.*"
89 gdb_test
"${trace_type} set_point1" "\(Fast t|T\)racepoint \[0-9\] at $hex: file.*"
91 gdb_test_no_output
"tstart"
93 gdb_test
"continue" "Continuing\\.\[ \r\n\]+.*Breakpoint.*" "continue to set_point1 1"
94 gdb_test
"continue" "Continuing\\.\[ \r\n\]+.*Breakpoint.*" "continue to set_point1 2"
96 gdb_test
"continue" "Continuing\\.\[ \r\n\]+.*Breakpoint.*" "continue to end"
97 gdb_test_no_output
"tstop"
99 gdb_test
"tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
100 gdb_test
"tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1"
102 gdb_test
"tfind" "Target failed to find requested trace frame\\..*"
105 foreach break_always_inserted
{ "on" "off" } {
106 break_trace_same_addr
"trace" ${break_always_inserted}
109 step_over_tracepoint
"trace"
111 if {[skip_shlib_tests
]} {
115 set libipa
[get_in_proc_agent
]
116 set remote_libipa
[gdb_load_shlib $libipa
]
118 #
Compile test case again with IPA.
119 if { [gdb_compile_pthreads
"$srcdir/$subdir/$srcfile" $binfile \
120 executable
[list debug $additional_flags shlib
=$libipa
] ] != "" } {
121 untested
"failed to compile with in-process agent library"
124 clean_restart $
{executable
}
130 gdb_reinitialize_dir $srcdir
/$subdir
131 if { [gdb_test
"info sharedlibrary" ".*${remote_libipa}.*" "IPA loaded"] != 0 } {
132 untested
"could not find IPA lib loaded"
134 foreach break_always_inserted
{ "on" "off" } {
135 break_trace_same_addr
"ftrace" ${break_always_inserted}
138 step_over_tracepoint
"ftrace"