Skip to content

Commit 37d414d

Browse files
riastradhriastradh
authored andcommitted
dtrace_sdt: Don't ignore the first stack frame in sdt probes.
The aframes argument to dtrace_probe_create gives the number of stack frames that are ignored in stack(), the first frame of which is `caller'. This is for, e.g., profiler interrupts where the interrupt frame itself isn't interesting; it's the code that was interrupted that was interesting (hence profile_aframes = PROF_ARTIFICIAL_FRAMES is often nonzero, or even several frames deep). But for sdt, the direct caller is the interesting part -- when we have something like: foo() { ... bar(); ... } bar() { ... SDT_PROBE1(...); ... } We want `caller' to be the return address in bar of SDT_PROBE1(...), not the return address in foo of bar(). PR kern/59934: dtrace_sdt: caller is off by a frame
1 parent ff9c775 commit 37d414d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • external/cddl/osnet/dev/sdt

external/cddl/osnet/dev/sdt/sdt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* unloaded; in particular, probes may not span multiple kernel modules.
4040
*/
4141
#include <sys/cdefs.h>
42-
__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.24 2022/08/31 12:34:04 riastradh Exp $");
42+
__KERNEL_RCSID(0, "$NetBSD: sdt.c,v 1.25 2026/01/22 04:14:08 riastradh Exp $");
4343

4444
#include <sys/cdefs.h>
4545
#include <sys/proc.h>
@@ -250,7 +250,7 @@ sdt_create_probe(struct sdt_probe *probe)
250250
if (dtrace_probe_lookup(prov->id, mod, func, name) != DTRACE_IDNONE)
251251
return;
252252

253-
(void)dtrace_probe_create(prov->id, mod, func, name, 1, probe);
253+
(void)dtrace_probe_create(prov->id, mod, func, name, 0, probe);
254254
}
255255

256256
/*

0 commit comments

Comments
 (0)