public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH] Do not convert "__" to "-" for stapsdt provider names
Date: Thu, 20 Nov 2025 13:53:11 -0500	[thread overview]
Message-ID: <20251120185311.28904-1-eugene.loh@oracle.com> (raw)

From: Eugene Loh <eugene.loh@oracle.com>

DTrace converts "__" to "-" for USDT probe names, but not for functions,
modules, or providers.  We document this behavior.

We provide the same conversion for stapsdt probe names, but we also
convert stapsdt provider names and in commit 22932a9875
("selftests/usdt: add is-enabled stapsdt tests using semaphores") we
test that conversion.

SystemTap performs the conversion for the probe name but not for the
provider name.

Remove the conversion for stapsdt provider names.

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
 libdtrace/dt_pid.c                            |  1 -
 .../usdt/tst.stapsdt-notes-isenabled.r        | 24 ++++----
 .../usdt/tst.stapsdt-notes-isenabled.r.p      |  4 ++
 .../usdt/tst.stapsdt-notes-isenabled.sh       | 61 +++++++++++--------
 4 files changed, 52 insertions(+), 38 deletions(-)
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-isenabled.r.p

diff --git a/libdtrace/dt_pid.c b/libdtrace/dt_pid.c
index 703be112e..39714bdb2 100644
--- a/libdtrace/dt_pid.c
+++ b/libdtrace/dt_pid.c
@@ -1360,7 +1360,6 @@ dt_stapsdt_parse(dtrace_hdl_t *dtp, dt_proc_t *dpr, dtrace_probedesc_t *pdp,
 		if (strlen(prv) >= nhdr.n_descsz)
 			continue;
 		strncpy(prvname, prv, sizeof(prvname));
-		(void) strhyphenate(prvname);
 		prb = prv + strlen(prv) + 1;
 		if (strlen(prb) >= nhdr.n_descsz)
 			continue;
diff --git a/test/unittest/usdt/tst.stapsdt-notes-isenabled.r b/test/unittest/usdt/tst.stapsdt-notes-isenabled.r
index b088b285f..19924aa6b 100644
--- a/test/unittest/usdt/tst.stapsdt-notes-isenabled.r
+++ b/test/unittest/usdt/tst.stapsdt-notes-isenabled.r
@@ -1,13 +1,13 @@
-test:main:zero-probe
-test:main:one-probe:1
-test:main:two-probe:2:3
-test:main:three-probe:4:5:7
-test:main:four-probe:7:8:9:10
-test:main:five-probe:11:12:13:14:15
-test:main:six-probe:16:17:18:19:20:21
-test:main:seven-probe:22:23:24:25:26:27:28
-test:main:eight-probe:29:30:31:32:33:34:35:36
-test:main:nine-probe:37:38:39:40:41:42:43:44:45
-test:main:eleven-probe:56:57:58:59:60:61:62:63:64:65
-test:main:twelve-probe:67:68:69:70:71:72:73:74:75:76
+test__prov$pid:test:main:zero-probe
+test__prov$pid:test:main:one-probe:1
+test__prov$pid:test:main:two-probe:2:3
+test__prov$pid:test:main:three-probe:4:5:7
+test__prov$pid:test:main:four-probe:7:8:9:10
+test__prov$pid:test:main:five-probe:11:12:13:14:15
+test__prov$pid:test:main:six-probe:16:17:18:19:20:21
+test__prov$pid:test:main:seven-probe:22:23:24:25:26:27:28
+test__prov$pid:test:main:eight-probe:29:30:31:32:33:34:35:36
+test__prov$pid:test:main:nine-probe:37:38:39:40:41:42:43:44:45
+test__prov$pid:test:main:eleven-probe:56:57:58:59:60:61:62:63:64:65
+test__prov$pid:test:main:twelve-probe:67:68:69:70:71:72:73:74:75:76
 
diff --git a/test/unittest/usdt/tst.stapsdt-notes-isenabled.r.p b/test/unittest/usdt/tst.stapsdt-notes-isenabled.r.p
new file mode 100755
index 000000000..234d1fa55
--- /dev/null
+++ b/test/unittest/usdt/tst.stapsdt-notes-isenabled.r.p
@@ -0,0 +1,4 @@
+#!/usr/bin/gawk -f
+
+# Replace pid in provider name with "$pid" for standardized output.
+{ sub(/^test__prov[0-9][0-9]*:/, "test__prov$pid:"); print; }
diff --git a/test/unittest/usdt/tst.stapsdt-notes-isenabled.sh b/test/unittest/usdt/tst.stapsdt-notes-isenabled.sh
index 322bf53aa..a839d5722 100755
--- a/test/unittest/usdt/tst.stapsdt-notes-isenabled.sh
+++ b/test/unittest/usdt/tst.stapsdt-notes-isenabled.sh
@@ -83,67 +83,78 @@ if [ $? -ne 0 ]; then
 fi
 
 $dtrace -c ./test -qs /dev/stdin <<EOF
-test-prov\$target:::zero-probe
+test__prov\$target:::zero-probe
 {
-	printf("%s:%s:%s\n", probemod, probefunc, probename);
+	printf("%s:%s:%s:%s\n", probeprov, probemod, probefunc, probename);
 }
 
-test-prov\$target:::one-probe
+test__prov\$target:::one-probe
 {
-	printf("%s:%s:%s:%li\n", probemod, probefunc, probename, arg0);
+	printf("%s:%s:%s:%s:%li\n", probeprov, probemod, probefunc, probename,
+	       arg0);
 }
 
-test-prov\$target:::two-probe
+test__prov\$target:::two-probe
 {
-	printf("%s:%s:%s:%li:%li\n", probemod, probefunc, probename, arg0, arg1);
+	printf("%s:%s:%s:%s:%li:%li\n",
+	       probeprov, probemod, probefunc, probename,
+	       arg0, arg1);
 }
 
-test-prov\$target:::three-probe
+test__prov\$target:::three-probe
 {
-	printf("%s:%s:%s:%li:%li:%li\n", probemod, probefunc, probename, arg0, arg1,
-	       arg2);
+	printf("%s:%s:%s:%s:%li:%li:%li\n",
+	       probeprov, probemod, probefunc, probename,
+	       arg0, arg1, arg2);
 }
 
-test-prov\$target:::four-probe
+test__prov\$target:::four-probe
 {
-	printf("%s:%s:%s:%li:%li:%li:%li\n", probemod, probefunc, probename, arg0, arg1,
-	       arg2, arg3);
+	printf("%s:%s:%s:%s:%li:%li:%li:%li\n",
+	       probeprov, probemod, probefunc, probename,
+	       arg0, arg1, arg2, arg3);
 }
 
-test-prov\$target:::five-probe
+test__prov\$target:::five-probe
 {
-	printf("%s:%s:%s:%li:%li:%li:%li:%li\n", probemod, probefunc, probename,
+	printf("%s:%s:%s:%s:%li:%li:%li:%li:%li\n",
+	       probeprov, probemod, probefunc, probename,
 	       arg0, arg1, arg2, arg3, arg4);
 }
 
-test-prov\$target:::six-probe
+test__prov\$target:::six-probe
 {
-	printf("%s:%s:%s:%li:%li:%li:%li:%li:%li\n", probemod, probefunc, probename,
+	printf("%s:%s:%s:%s:%li:%li:%li:%li:%li:%li\n",
+	       probeprov, probemod, probefunc, probename,
 	       arg0, arg1, arg2, arg3, arg4, arg5);
 }
 
-test-prov\$target:::seven-probe
+test__prov\$target:::seven-probe
 {
-	printf("%s:%s:%s:%li:%li:%li:%li:%li:%li:%li\n", probemod, probefunc, probename,
+	printf("%s:%s:%s:%s:%li:%li:%li:%li:%li:%li:%li\n",
+	       probeprov, probemod, probefunc, probename,
 	       arg0, arg1, arg2, arg3, arg4, arg5, arg6);
 }
 
-test-prov\$target:::eight-probe
+test__prov\$target:::eight-probe
 {
-	printf("%s:%s:%s:%li:%li:%li:%li:%li:%li:%li:%li\n", probemod, probefunc, probename,
+	printf("%s:%s:%s:%s:%li:%li:%li:%li:%li:%li:%li:%li\n",
+	       probeprov, probemod, probefunc, probename,
 	       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
 }
 
-test-prov\$target:::nine-probe
+test__prov\$target:::nine-probe
 {
-	printf("%s:%s:%s:%li:%li:%li:%li:%li:%li:%li:%li:%li\n", probemod, probefunc, probename,
+	printf("%s:%s:%s:%s:%li:%li:%li:%li:%li:%li:%li:%li:%li\n",
+	       probeprov, probemod, probefunc, probename,
 	       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
 }
 
-test-prov\$target:::eleven-probe,
-test-prov\$target:::twelve-probe
+test__prov\$target:::eleven-probe,
+test__prov\$target:::twelve-probe
 {
-	printf("%s:%s:%s:%li:%li:%li:%li:%li:%li:%li:%li:%li:%li\n", probemod, probefunc, probename,
+	printf("%s:%s:%s:%s:%li:%li:%li:%li:%li:%li:%li:%li:%li:%li\n",
+	       probeprov, probemod, probefunc, probename,
 	       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
 }
 EOF
-- 
2.47.3


             reply	other threads:[~2025-11-20 18:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-20 18:53 eugene.loh [this message]
2025-11-20 20:38 ` [PATCH] Do not convert "__" to "-" for stapsdt provider names Kris Van Hees

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251120185311.28904-1-eugene.loh@oracle.com \
    --to=eugene.loh@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox