1 # Copyright
2015-2023 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"
17 require allow_shlib_tests
20 set executable $testfile
21 set expfile $testfile.exp
23 # Some targets have leading underscores
on assembly symbols.
24 set options
[list debug
[gdb_target_symbol_prefix_flags
]]
26 # Check that the target supports
trace.
27 require gdb_trace_common_supports_arch
28 if { [gdb_compile
"$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
29 untested
"failed to compile"
33 clean_restart $
{testfile
}
39 if ![gdb_target_supports_trace
] {
40 unsupported
"target does not support trace"
44 #
Compile the test case with the in
-process agent library.
45 set libipa
[get_in_proc_agent
]
46 gdb_load_shlib $libipa
48 lappend options shlib
=$libipa
50 if { [gdb_compile
"$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
51 untested
"failed to compile with in-process agent library"
55 # This test makes sure that disabling and enabling tracepoints works
56 # correctly. TRACEPOINT_CMD is the command used to
set tracepoints
57 #
(e.g.
trace or ftrace
).
59 proc test_tracepoint_enable_disable
{ tracepoint_cmd
} {
60 with_test_prefix
"test_tracepoint_enable_disable $tracepoint_cmd" {
62 clean_restart $
{executable
}
70 gdb_test
"$tracepoint_cmd point_a" "(Tracepoint|Fast tracepoint) 2.*"
71 gdb_test
"$tracepoint_cmd point_b" "(Tracepoint|Fast tracepoint) 3.*"
72 gdb_breakpoint
"break_here"
73 gdb_test_no_output
"tstart"
75 # Test that tracepoints start enabled
76 with_test_prefix
"start" {
77 gdb_continue
"break_here"
79 gdb_test
"tstatus" "Collected $expected trace frames.*"
82 # Test that disabling works
83 with_test_prefix
"disable #1" {
84 gdb_test_no_output
"disable 2"
85 gdb_continue
"break_here"
87 gdb_test
"tstatus" "Collected $expected trace frames.*"
90 with_test_prefix
"disable #2" {
91 gdb_test_no_output
"disable 3"
92 gdb_continue
"break_here"
93 gdb_test
"tstatus" "Collected $expected trace frames.*"
96 # Test that disabling an already disabled tracepoint works
97 with_test_prefix
"disable #3" {
98 gdb_test_no_output
"disable 2"
99 gdb_continue
"break_here"
100 gdb_test
"tstatus" "Collected $expected trace frames.*"
103 # Test that enabling works
104 with_test_prefix
"enable #1" {
105 gdb_test_no_output
"enable 2"
106 gdb_continue
"break_here"
108 gdb_test
"tstatus" "Collected $expected trace frames.*"
111 with_test_prefix
"enable #2" {
112 gdb_test_no_output
"enable 3"
113 gdb_continue
"break_here"
115 gdb_test
"tstatus" "Collected $expected trace frames.*"
118 # Test that enabling an already enabled tracepoint works
119 with_test_prefix
"enable #3" {
120 gdb_test_no_output
"enable 3"
121 gdb_continue
"break_here"
123 gdb_test
"tstatus" "Collected $expected trace frames.*"
128 test_tracepoint_enable_disable
trace
129 test_tracepoint_enable_disable ftrace