From owner-freebsd-dtrace@FreeBSD.ORG Wed Mar 12 04:52:53 2014 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 ESMTPS id 3B20018B for ; Wed, 12 Mar 2014 04:52:53 +0000 (UTC) Received: from mail-ve0-x231.google.com (mail-ve0-x231.google.com [IPv6:2607:f8b0:400c:c01::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EAE52143 for ; Wed, 12 Mar 2014 04:52:52 +0000 (UTC) Received: by mail-ve0-f177.google.com with SMTP id sa20so9470588veb.22 for ; Tue, 11 Mar 2014 21:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=dOUO2u4NjzCOFPkVLbj3Lp9pKJIDRNV/tTupOAab+VY=; b=i6Wi1CFCVND72v8eRwUuRp25Mcz9elKEO10InJXwgzyrMTxwa7MnUNa0oPzTcwUXgy IhtKz2VZbicu6xwXlDEIFUcvkhTttmG7CF0LxenkX1gM7L58HhYYcMyCI9P4J6PHhTAm Rh9n0NdC0YHcrSi3QG2dN0NW++zWsfgKcRXXkPdbO+AU/EQhgiKOb/pkFAYtW5qlhamj QkLXgshxgHhO941QCg7FijWSbT5or5EztYCfCLAnuxLKZPwXaBylpyxEMOByBNUbOFyE Ez2kPLmI/D60k2h2SKbkCI5JjszVbx45xpbTCNUdrtKfPxnTmBpfWuQbR3tgeuOEVUXI ZNqQ== MIME-Version: 1.0 X-Received: by 10.220.10.2 with SMTP id n2mr61897vcn.26.1394599971971; Tue, 11 Mar 2014 21:52:51 -0700 (PDT) Sender: markjdb@gmail.com Received: by 10.220.162.68 with HTTP; Tue, 11 Mar 2014 21:52:51 -0700 (PDT) In-Reply-To: References: <1394599542.80116.YahooMailBasic@web192602.mail.sg3.yahoo.com> Date: Wed, 12 Mar 2014 00:52:51 -0400 X-Google-Sender-Auth: 5pskDVIFaD36iCubks6taSEpft8 Message-ID: Subject: Re: dtracing static symbols From: Mark Johnston To: "Daniel O'Connor" Content-Type: text/plain; charset=ISO-8859-1 Cc: Robert Mustacchi , "freebsd-dtrace@freebsd.org" X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.17 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: Wed, 12 Mar 2014 04:52:53 -0000 On Wed, Mar 12, 2014 at 12:50 AM, Daniel O'Connor wrote: > > On 12 Mar 2014, at 15:15, Prashanth Kumar wrote: >> If you run >> # env DTRACE_DEBUG=1 dtrace -Ppid\$target -l -c ./static >> you will notice that lot of probe creation will fail, also no probes are created for instruction offsets. >> you will have to update the libproc library and fasttrap code to trace all the >> functions. > > I don't really care about the function offsets, just static functions. > > Or are you suggesting updating libproc and the fasttrap code will allow that (as well as instruction offsets)? I'd suggest updating to 9-STABLE. There have been quite a few fixes to fasttrap and libproc since 9.2. -Mark > > THanks. > >> -------------------------------------------- >> On Wed, 12/3/14, Daniel O'Connor wrote: >> >> Subject: Re: dtracing static symbols >> To: "Robert Mustacchi" >> Cc: freebsd-dtrace@freebsd.org >> Date: Wednesday, 12 March, 2014, 2:54 AM >> >> >> On 12 Mar 2014, at 2:30, Robert Mustacchi >> wrote: >>> On 03/10/2014 10:34 PM, Daniel O'Connor wrote: >>>> >>>> On 11 Mar 2014, at 15:34, Prashanth Kumar >> wrote: >>>>> If the binary being traced has static symbols >> in its symbol table, DTrace should >>>>> be able to trace the function. Can you describe >> the example where you found this >>>>> difference in FreeBSD and OSX? >>>> >>>> Unfortunately the static symbols don't show up in >> the symbol table (as shown by nm). >>>> >>>> Is there a compile or link flag which will change >> that? >>> >>> Because it's a static function the compiler may inline >> it, which may be >>> why you don't actually see an entry in nm nor that it >> can be found by >>> DTrace. You'll want to look at the disassembled output >> of your program >>> to see if it was inlined. Different compilers can and >> will do different >>> things. There generally are flags you can pass to the >> compiler to tell >>> it not to inline it, but that's compiler specific. >> >> I just realised that my test contradicted the statement I >> made earlier.. >> However I checked my test program (static.c) and it the >> functions definitely appear in the symbol table. >> [mdtest 21:13] ~ >nm static|egrep '(foo|bar)' >> 0000000000400600 T bar >> 0000000000400620 t foo >> >> I also added the noinline attribute for good measure. >> >> It seems that _nothing_ shows up for executables, only >> shared libraries, this is OK for me since my code resides in >> a library but it is a bit surprised nonetheless.. >> >>>> (I'm not sure what the various numbers mean) >>> >>> The pid provider can instrument any instruction in a >> function, those are >>> the instruction offsets. >> >> Ahh, thanks. >> >> -- >> Daniel O'Connor software and network engineer >> for Genesis Software - http://www.gsoft.com.au >> "The nice thing about standards is that there >> are so many of them to choose from." >> -- Andrew Tanenbaum >> GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 >> 7B3F CE8C >> >> >> >> >> >> >> >> > > -- > Daniel O'Connor software and network engineer > for Genesis Software - http://www.gsoft.com.au > "The nice thing about standards is that there > are so many of them to choose from." > -- Andrew Tanenbaum > GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C > > > > > >