From owner-freebsd-dtrace@FreeBSD.ORG Thu Oct 17 07:15:49 2013 Return-Path: Delivered-To: freebsd-dtrace@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9555DB4A; Thu, 17 Oct 2013 07:15:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 813F7286B; Thu, 17 Oct 2013 07:15:47 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA02541; Thu, 17 Oct 2013 10:15:46 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1VWho9-0000HY-S1; Thu, 17 Oct 2013 10:15:45 +0300 Message-ID: <525F8E64.4020105@FreeBSD.org> Date: Thu, 17 Oct 2013 10:14:44 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: Mark Johnston , John-Mark Gurney Subject: Re: dtrace -c doesn't work? References: <20131015233219.GZ56872@funkthat.com> <20131017033400.GA31544@charmander> In-Reply-To: <20131017033400.GA31544@charmander> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , freebsd-dtrace@FreeBSD.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Oct 2013 07:15:49 -0000 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'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. -- Andriy Gapon