Usage of DTRACE_PROBE macro from sdt.h in kernel modules

Shrikanth Kamath shrikanth07 at gmail.com
Tue Sep 2 20:24:50 UTC 2014


Adding a DTRACE_PROBE(name) in a kernel module does not create the SDT
probe. I added
the following to the module file before using DTRACE_PROBE.
#include "opt_kdtrace.h"
#include <sys/sdt.h>

function_foo() {
...
+       DTRACE_PROBE(name);
...
}

I figured the sdt.h does declare SDT_PROVIDER_DECLARE(set); but that
is not helping. Was expecting a sdt probe added under provider 'set'.

The SDT probe creation returns from sdt_kld_load from here

       if (linker_file_lookup_set(lf, "sdt_providers_set", &begin, &end, NULL))
                return;

I did a nm on the kernel module and did not find anything matching
"sdt_providers_set"

nm -a module.ko | grep sdt

00000000 r __set_sdt_probes_set_sym_sdt_sdt______func____LINE__.103790

         U __start_set_sdt_probes_set

         U __stop_set_sdt_probes_set

         U sdt_probe_func

         U sdt_provider_sdt

000006c0 d sdt_sdt______func____LINE__.103789

Can't seem to figure how to get the SDT probe created by using
DTRACE_PROBE macro in a kernel module.


More information about the freebsd-hackers mailing list