1 # Copyright
(C
) 2014-2023 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
/>.
19 # This returns
-1 on failure to
compile or start
, 0 otherwise.
21 global testfile hex srcfile binfile
25 if {[dtrace_build_usdt_test_program
] == -1} {
26 untested
"failed to compile"
30 clean_restart $
{binfile
}
36 gdb_test
"print \$_probe_argc" "No probe at PC $hex" \
37 "check argument not at probe point"
39 # Test the
'info probes' command.
40 gdb_test
"info probes dtrace" \
41 "test *progress-counter *$hex +no.*test *two-locations *$hex +always.*test *two-locations *$hex +always.*" \
44 # Disabling the probe test
:two
-locations shall have no effect
,
45 # since no is
-enabled probes are defined
for it in the object
48 gdb_test
"disable probe test two-locations" \
49 "Probe test:two-locations cannot be disabled.*" \
50 "disable probe test two-locations"
52 #
On the other hand
, the probe test
:progress
-counter can be
53 # enabled and
then disabled again.
55 gdb_test
"enable probe test progress-counter" \
56 "Probe test:progress-counter enabled.*" \
57 "enable probe test progress-counter"
59 gdb_test
"disable probe test progress-counter" \
60 "Probe test:progress-counter disabled.*" \
61 "disable probe test progress-counter"
63 # Since test
:progress
-counter is disabled we can run to the second
64 # instance of the test
:two
-locations probe.
66 runto
"-probe-dtrace test:two-locations"]
67 runto
"-probe-dtrace test:two-locations"]
69 # Go
back to the breakpoint
on main
() and enable the
70 # test
:progress
-counter probe.
Set a breakpoint
on it and see
71 # that it gets reached.
77 gdb_test
"enable probe test progress-counter" \
78 "Probe test:progress-counter enabled.*" \
79 "enable probe test progress-counter"
81 gdb_test
"break -probe-dtrace test:progress-counter" \
82 ".*Breakpoint \[0-9\]+ .*" "set breakpoint in test:progress-counter"
83 gdb_continue_to_breakpoint
"test:progress-counter"
85 # Test probe arguments.
86 gdb_test
"print \$_probe_argc" " = 2" \
87 "print \$_probe_argc for probe progress-counter"
88 gdb_test
"print \$_probe_arg0" \
89 " = $hex \"application\"" \
90 "print \$_probe_arg0 for probe progress-counter"
91 gdb_test
"print \$_probe_arg1" " = 1" \
92 "print \$_probe_arg1 for probe progress-counter"
94 #
Set a breakpoint with multiple probe locations.
95 gdb_test
"break -pdtrace test:two-locations" \
96 "Breakpoint \[0-9\]+ at $hex.*2 locations.*" \
97 "set multi-location probe breakpoint (probe two-locations)"