dtrace -c patch
Andriy Gapon
avg at FreeBSD.org
Thu Mar 7 11:59:46 UTC 2013
$ dtrace -n 'blah blah' -c 'touch /'
dtrace: failed to control pid 16473: process exited with status 0
I think that we need the following change:
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
@@ -1115,7 +1115,7 @@ alloc:
#if defined(sun)
dtp->dt_prcmode = DT_PROC_STOP_PREINIT;
#else
- dtp->dt_prcmode = DT_PROC_STOP_MAIN;
+ dtp->dt_prcmode = DT_PROC_STOP_POSTINIT;
#endif
dtp->dt_linkmode = DT_LINK_KERNEL;
dtp->dt_linktype = DT_LTYP_ELF;
Rationale:
- we don't use DT_PROC_STOP_PREINIT like solaris does, because for some reason
that I haven't investigated we the following line ifdef-ed out in dt_proc_attach:
dt_proc_rdwatch(dpr, RD_PREINIT, "RD_PREINIT");
- 'main' symbol can't always be reliably resolved:
$ readelf -a -W /usr/bin/touch | fgrep main
$
So, it seems that "postinit" is where we can reliable catch a process.
What do you think?
--
Andriy Gapon
More information about the freebsd-hackers
mailing list