Skip to contentSkip to conversation

Make sure all probes are listed in default case

PATCH Superseded [email protected] 2 participants 3 messages Jun 28, 2025 – Jul 22, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make sure all probes are listed in default case

From: Eugene Loh <[email protected]>

---
 INCOMPATIBILITIES                           |  2 +-
 cmd/dtrace.c                                | 11 +++
 test/unittest/dtrace-util/tst.ListProbes.r  | 13 ++++
 test/unittest/dtrace-util/tst.ListProbes.sh | 82 +++++++++++++++++++++
 4 files changed, 107 insertions(+), 1 deletion(-)
 create mode 100644 test/unittest/dtrace-util/tst.ListProbes.r
 create mode 100755 test/unittest/dtrace-util/tst.ListProbes.sh
INCOMPATIBILITIES +1 -1
index 035c3675b..bf55019ec 100644
@@ -8,7 +8,7 @@ Missing providers
 Difficulty: Medium
 Likelihood: High
 
-A number of providers are missing, including pid, fbt, and net.
+Some providers are missing.
 
 
 
cmd/dtrace.c +11 -0
index e0e778db0..ed517abff 100644
@@ -1443,6 +1443,17 @@ main(int argc, char *argv[])
 			list_prog(&g_cmdv[i]);
 
 		if (g_cmdc == 0) {
+			dtrace_cmd_t pseudo_cmd;
+
+			/*
+			 * If we are listing the default case "dtrace -l",
+			 * compile the string ":::" to give providers an
+			 * attempt to provide probes.
+			 */
+			pseudo_cmd.dc_spec = DTRACE_PROBESPEC_NAME;
+			pseudo_cmd.dc_arg = ":::";
+			compile_str(&pseudo_cmd);
+
 			if (dtrace_probe_iter(g_dtp, NULL, list_probe, NULL) < 0)
 				dfatal(NULL); /* dtrace_errmsg() only */
 		}
test/unittest/dtrace-util/tst.ListProbes.r new file +13 -0
new file mode 100644
index 000000000..a04669843
@@ -0,0 +1,13 @@
+cpc
+dtrace
+fbt
+io
+ip
+lockstat
+proc
+profile
+rawfbt
+rawtp
+sched
+sdt
+syscall
test/unittest/dtrace-util/tst.ListProbes.sh new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
2.43.5
Reviewed-by on v1 1/1
#1 lore raw

On 28 Jun 2025, eugene loh spake thusly:

Quoted 3 lines

From: Eugene Loh <[email protected]>

(presumably this is fixing the problem that lazily-instantiated probes like fbt now is weren't instantiating probes before trying to list them.)

I winced at this at first:

Quoted 6 lines
test/unittest/dtrace-util/tst.ListProbes.sh new file +6 -0
+    # Recognize some providers; apply sanity check on number of probes.
+    $2 == "cpc"      { mycheck($2, $1,     5,    500); next }
+    $2 == "dtrace"   { mycheck($2, $1,     3,      3); next }
+    $2 == "fbt"      { mycheck($2, $1, 30000, 300000); next }
+    $2 == "io"       { mycheck($2, $1,     2,     20); next }
+    $2 == "ip"       { mycheck($2, $1,     2,     20); next }

test/unittest/dtrace-util/tst.ListProbes.sh line 72

Quoted 10 lines
test/unittest/dtrace-util/tst.ListProbes.sh new file +10 -0
+    $2 == "lockstat" { mycheck($2, $1,     4,     40); next }
+    # nothing for pid
+    $2 == "proc"     { mycheck($2, $1,     6,     30); next }
+    $2 == "profile"  { mycheck($2, $1,     6,     30); next }
+    $2 == "rawfbt"   { mycheck($2, $1, 30000, 300000); next }
+    $2 == "rawtp"    { mycheck($2, $1,   600,   6000); next }
+    $2 == "sched"    { mycheck($2, $1,     3,     30); next }
+    $2 == "sdt"      { mycheck($2, $1,   600,   6000); next }
+    $2 == "syscall"  { mycheck($2, $1,   300,   3000); next }
+    # nothing for usdt

... but honestly if the figures are outside those bounds something is *definitely* wrong (and it'll be obvious when they really need updating).

Signature · 1 line
NULL && (void)