Date: Thu, 17 Oct 2013 11:40:03 -0400 From: Mark Johnston <markj@freebsd.org> To: Andriy Gapon <avg@FreeBSD.org> Cc: John-Mark Gurney <jmg@funkthat.com>, Konstantin Belousov <kib@FreeBSD.org>, freebsd-dtrace@FreeBSD.org Subject: Re: dtrace -c doesn't work? Message-ID: <20131017154003.GA2926@charmander.sandvine.com> In-Reply-To: <525F8E64.4020105@FreeBSD.org> References: <20131015233219.GZ56872@funkthat.com> <20131017033400.GA31544@charmander> <525F8E64.4020105@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Oct 17, 2013 at 10:14:44AM +0300, Andriy Gapon wrote: > on 17/10/2013 06:34 Mark Johnston said the following: > > My guess is that the /bin/echo on your system is stripped. dtrace(1) on > > FreeBSD will set a breakpoint on main() in the victim process and > > register the script with the kernel when that breakpoint fires. If > > libproc can't find the address of main(), the breakpoint won't fire, and > > your script won't run. If /bin/echo isn't stripped, your example works > > properly on my laptop. Adding '-x evaltime=postinit' to the dtrace(1) > > flags should also allow the script to run properly. > > > > avg@ tried to fix this a little while ago by changing dtrace to > > instead put a breakpoint on r_debug_state in rtld (r248644). This works > > for your example, but breaks USDT since that breakpoint apparently fires > > before ELF ctors run, and thus before dtrace_dof_init() can run (which is > > needed for USDT to work). > > That's exactly what happened. > My idea of fixing that was to move r_debug_state call to after preinit_main. > But Kostik told me that that was a terrible idea. Unfortunately I can't recall > right now why. I suppose this would make it impossible to use gdb to step through init functions? > I've been meaning to restore my knowledge and memory of the code > and discuss the issue again. > > > I'm not sure what the best way to fix this is. Perhaps we could add a > > second breakpoint to rtld for use by dtrace, or maybe there's some way > > to set a breakpoint on the DOF init code. > > Kostik also suggested this. You mean adding a second breakpoint function to rtld? Perhaps something like r_debug_state_postinit(), called after objlist_call_init(). -Mark
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131017154003.GA2926>
