* [PATCH] test: add -l and -lv tests for stapsdt probes
@ 2025-08-06 16:04 Kris Van Hees
2025-08-06 16:57 ` [DTrace-devel] " Nick Alcock
0 siblings, 1 reply; 2+ messages in thread
From: Kris Van Hees @ 2025-08-06 16:04 UTC (permalink / raw)
To: dtrace, dtrace-devel
The stapsdt support in DTrace provides limited support for argument data
for probes. The number of arguments passed to a probe and their native
type (signed or unsigned int of size 1, 2, 4, or 8 bytes) is discoverable.
Signed-off-by: Kris Van Hees
<kris.van.hees@oracle.com>
---
test/unittest/usdt/tst.stapsdt-notes-l.sh | 46 ++++++++++++++++++++++
test/unittest/usdt/tst.stapsdt-notes-lv.sh | 46 ++++++++++++++++++++++
2 files changed, 92 insertions(+)
create mode 100755 test/unittest/usdt/tst.stapsdt-notes-l.sh
create mode 100755 test/unittest/usdt/tst.stapsdt-notes-lv.sh
diff --git a/test/unittest/usdt/tst.stapsdt-notes-l.sh b/test/unittest/usdt/tst.stapsdt-notes-l.sh
new file mode 100755
index 000000000..663ba07b1
--- /dev/null
+++ b/test/unittest/usdt/tst.stapsdt-notes-l.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+# Licensed under the Universal Permissive License v 1.0 as shown at
+# http://oss.oracle.com/licenses/upl.
+
+# This test covers stapsdt probes fired by the STAP_PROBEn macros,
+# testing listing probes.
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+CC=/usr/bin/gcc
+CFLAGS="-I${PWD}/test/unittest/usdt"
+
+DIRNAME="$tmpdir/usdt-notes.$$.$RANDOM"
+mkdir -p $DIRNAME
+cd $DIRNAME
+
+cat > test.c <<EOF
+#include <sdt_notes.h>
+
+int
+main(int argc, char **argv)
+{
+ STAP_PROBE(test_prov, zero);
+ STAP_PROBE1(test_prov, one, argc);
+ STAP_PROBE2(test_prov, two, 2, 3);
+ STAP_PROBE4(test_prov, args, argc, argv[0], argv[1] + 4, 18);
+}
+EOF
+
+${CC} ${CFLAGS} -o test test.c
+if [ $? -ne 0 ]; then
+ echo "failed to compile test.c" >& 2
+ exit 1
+fi
+
+$dtrace -c './test arg1val' -lP test_prov\$target
+status=$?
+
+exit $status
diff --git a/test/unittest/usdt/tst.stapsdt-notes-lv.sh b/test/unittest/usdt/tst.stapsdt-notes-lv.sh
new file mode 100755
index 000000000..f7b2d8691
--- /dev/null
+++ b/test/unittest/usdt/tst.stapsdt-notes-lv.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+# Licensed under the Universal Permissive License v 1.0 as shown at
+# http://oss.oracle.com/licenses/upl.
+
+# This test covers stapsdt probes fired by the STAP_PROBEn macros,
+# testing listing probes.
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+CC=/usr/bin/gcc
+CFLAGS="-I${PWD}/test/unittest/usdt"
+
+DIRNAME="$tmpdir/usdt-notes.$$.$RANDOM"
+mkdir -p $DIRNAME
+cd $DIRNAME
+
+cat > test.c <<EOF
+#include <sdt_notes.h>
+
+int
+main(int argc, char **argv)
+{
+ STAP_PROBE(test_prov, zero);
+ STAP_PROBE1(test_prov, one, argc);
+ STAP_PROBE2(test_prov, two, argc, argv[0][0]);
+ STAP_PROBE4(test_prov, args, argc, argv[0], argv[1] + 4, 18);
+}
+EOF
+
+${CC} ${CFLAGS} -o test test.c
+if [ $? -ne 0 ]; then
+ echo "failed to compile test.c" >& 2
+ exit 1
+fi
+
+$dtrace -c './test arg1val' -lvP test_prov\$target
+status=$?
+
+exit $status
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [DTrace-devel] [PATCH] test: add -l and -lv tests for stapsdt probes
2025-08-06 16:04 [PATCH] test: add -l and -lv tests for stapsdt probes Kris Van Hees
@ 2025-08-06 16:57 ` Nick Alcock
0 siblings, 0 replies; 2+ messages in thread
From: Nick Alcock @ 2025-08-06 16:57 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace-devel, dtrace
On 6 Aug 2025, Kris Van Hees via DTrace-devel stated:
> The stapsdt support in DTrace provides limited support for argument data
> for probes. The number of arguments passed to a probe and their native
> type (signed or unsigned int of size 1, 2, 4, or 8 bytes) is discoverable.
>
> Signed-off-by: Kris Van Hees
> <kris.van.hees@oracle.com>
Bit of a linefeed there. ;)
Bit annoying there's so much repetition, but it's really not worth
optimizing that, and it's no worse than any of the others in this area.
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
--
NULL && (void)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-06 16:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 16:04 [PATCH] test: add -l and -lv tests for stapsdt probes Kris Van Hees
2025-08-06 16:57 ` [DTrace-devel] " Nick Alcock
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.