Date: Thu, 07 Mar 2013 13:59:41 +0200 From: Andriy Gapon <avg@FreeBSD.org> To: freebsd-hackers@FreeBSD.org Subject: dtrace -c patch Message-ID: <5138812D.5060304@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
$ 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5138812D.5060304>