From owner-freebsd-dtrace@FreeBSD.ORG Wed Mar 12 04:48:42 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 763AAFE9 for ; Wed, 12 Mar 2014 04:48:42 +0000 (UTC) Received: from nm24-vm6.bullet.mail.sg3.yahoo.com (nm24-vm6.bullet.mail.sg3.yahoo.com [106.10.151.85]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DEDC58F for ; Wed, 12 Mar 2014 04:48:36 +0000 (UTC) Received: from [106.10.166.63] by nm24.bullet.mail.sg3.yahoo.com with NNFMP; 12 Mar 2014 04:45:42 -0000 Received: from [106.10.151.252] by tm20.bullet.mail.sg3.yahoo.com with NNFMP; 12 Mar 2014 04:45:42 -0000 Received: from [127.0.0.1] by omp1001.mail.sg3.yahoo.com with NNFMP; 12 Mar 2014 04:45:42 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 587833.19024.bm@omp1001.mail.sg3.yahoo.com Received: (qmail 82773 invoked by uid 60001); 12 Mar 2014 04:45:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.in; s=s1024; t=1394599542; bh=0J3vmxF1jtvG2pKBCFx+78JVKSccZFh9bQl7SlmaJ9Q=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=GvRyucTi5GJcdSHu5dJRWAH+iyZoF/u0A9SRpZYvo0azkggtfy8wd7AfH+d8mP/A6kiov2qatVjIwYMeHPpIp7qOE6CRAMpgSC2P+gj6MbusScCJOMQZZyK0NBG4NWB03zcSnwKxRWpFnR5x21uJKd+p9fVdGBSH5TdmWHxBw1Y= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=xbD6ckrjrfP/NWiOTq+MoR2fb7HKQBwm64+Hv4DONYyqnP2c+9ZKLxktKfT8Is0F5ihsnKvat6ddBvzsdj4+2/3+JXRuIKhIvEP2quNQwjJBATecJuDBQgJvF9H72uue91pVgGEdzPHvgSCC0Y0ye4TeA6iFiQhYy5yh7WIj0/E=; X-YMail-OSG: 1VD1xg4VM1mzOzrtpT4_Yq1YWENstGCeJlYatXCYG6K1CqP mMk_eJ46ahBPwjtKHURQ5322q130y3MCWt5GjrD8pPU7vTRuxijF01UM9XLn .xjcK_anvzKHqZnb5r6FBBiowJ7U7YudW6TCR0ROtapCP1_Xl8wczefqycXa RNr6bRkJiMlHg03qWcEGD.GNxeorA_i6Vmscpf09BXAgILSJ.Hvg7UFCAcwu ypeONPb9s_Dua10WUxbyGUUTIyqjC.aa6yvIGx_MnC01d2qNEJ_W9vlgrZ.z b68n5Pwr5p_5l3x9XEAdyzcboNJ0vl9wY2N2iKJlmoxU_BdDv7bUs9LExk9z Y9ueKdGdv4mKc7zRWwCHRaOfznC.stP1_aAetJi__ONs6Yzjbjgos9Y9waZ7 PpPcfE5cSHds1rF8EUu3rIwcxE.Qn7e_H39dSZtHlWZ8tPnMw6kwt1azJhyn Bzz5GvVfA80Tk.goiNm7bTz4GTJ5pzEqX45O70ka0UQen4aPD9tMldMBw90G GSpWnDOhQNgiwj2FxqYJAyucwt9WqDJSgPihWI35rsqU1jyj0yOlZfpJ5d8P 6ktkTrT5JX2Wl2.Dr7VXFhwrxCKQO3RveMtbDRi6TCl0r.A-- Received: from [2.50.30.175] by web192602.mail.sg3.yahoo.com via HTTP; Wed, 12 Mar 2014 12:45:42 SGT X-Rocket-MIMEInfo: 002.001, SWYgeW91IHJ1biANCiMgZW52IERUUkFDRV9ERUJVRz0xIGR0cmFjZSAtUHBpZFwkdGFyZ2V0IC1sICAtYyAuL3N0YXRpYw0KeW91IHdpbGwgbm90aWNlIHRoYXQgbG90IG9mIHByb2JlIGNyZWF0aW9uIHdpbGwgZmFpbCwgYWxzbyBubyBwcm9iZXMgYXJlIGNyZWF0ZWQgZm9yIGluc3RydWN0aW9uIG9mZnNldHMuDQogICAgeW91IHdpbGwgaGF2ZSB0byB1cGRhdGUgdGhlIGxpYnByb2MgbGlicmFyeSBhbmQgZmFzdHRyYXAgY29kZSB0byB0cmFjZSBhbGwgdGhlIA0KZnVuY3Rpb25zLiANCi0tLS0tLS0tLS0tLS0BMAEBAQE- X-Mailer: YahooMailClassic/451 YahooMailWebService/0.8.177.636 Message-ID: <1394599542.80116.YahooMailBasic@web192602.mail.sg3.yahoo.com> Date: Wed, 12 Mar 2014 12:45:42 +0800 (SGT) From: Prashanth Kumar Subject: Re: dtracing static symbols To: Robert Mustacchi , Daniel O'Connor In-Reply-To: <4DCD0848-F635-4CAE-B109-9941395B6AB8@gsoft.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: 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:48:42 -0000 If you run=20 # env DTRACE_DEBUG=3D1 dtrace -Ppid\$target -l -c ./static you will notice that lot of probe creation will fail, also no probes are cr= eated for instruction offsets. you will have to update the libproc library and fasttrap code to trace = all the=20 functions.=20 -------------------------------------------- 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 =20 =20 On 12 Mar 2014, at 2:30, Robert Mustacchi wrote: > On 03/10/2014 10:34 PM, Daniel O'Connor wrote: >>=20 >> 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? >>=20 >> Unfortunately the static symbols don't show up in the symbol table (as shown by nm). >>=20 >> Is there a compile or link flag which will change that? >=20 > 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. =20 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 =20 I also added the noinline attribute for good measure. =20 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.. =20 >> (I'm not sure what the various numbers mean) >=20 > The pid provider can instrument any instruction in a function, those are > the instruction offsets. =20 Ahh, thanks. =20 -- 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." =A0 -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C =20 =20 =20 =20 =20 =20