From owner-freebsd-dtrace@FreeBSD.ORG Tue Mar 11 21:24:55 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 54F715D3 for ; Tue, 11 Mar 2014 21:24:55 +0000 (UTC) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B9A7939F for ; Tue, 11 Mar 2014 21:24:54 +0000 (UTC) Received: from ur.dons.net.au (ppp118-210-56-74.lns20.adl2.internode.on.net [118.210.56.74]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id s2BLOMac083181 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 12 Mar 2014 07:54:28 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Subject: Re: dtracing static symbols Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\)) Content-Type: multipart/signed; boundary="Apple-Mail=_BB85BE5D-8D31-4A80-94D5-1CD619D02118"; protocol="application/pgp-signature"; micalg=pgp-sha1 From: "Daniel O'Connor" In-Reply-To: <531F3302.8010106@joyent.com> Date: Wed, 12 Mar 2014 07:54:22 +1030 Message-Id: <4DCD0848-F635-4CAE-B109-9941395B6AB8@gsoft.com.au> References: <1394514256.45492.YahooMailBasic@web192604.mail.sg3.yahoo.com> <7C202659-0BD9-4F93-8886-24DD7AEB495F@gsoft.com.au> <531F3302.8010106@joyent.com> To: Robert Mustacchi X-Mailer: Apple Mail (2.1874) X-Spam-Score: 0.163 () BAYES_00,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 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: Tue, 11 Mar 2014 21:24:55 -0000 --Apple-Mail=_BB85BE5D-8D31-4A80-94D5-1CD619D02118 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 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. 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) >=20 > 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 --Apple-Mail=_BB85BE5D-8D31-4A80-94D5-1CD619D02118 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iD8DBQFTH38G5ZPcIHs/zowRAvGvAKCBvfjbhb/YiYMzlXOXmGaMI4K0MQCeOdSB qQv3Ka8ftX2+ddVfeE+qZpQ= =tKS3 -----END PGP SIGNATURE----- --Apple-Mail=_BB85BE5D-8D31-4A80-94D5-1CD619D02118--