Date: Wed, 12 Mar 2014 15:20:17 +1030 From: "Daniel O'Connor" <doconnor@gsoft.com.au> To: Prashanth Kumar <pra_udupi@yahoo.co.in> Cc: Robert Mustacchi <rm@joyent.com>, freebsd-dtrace@freebsd.org Subject: Re: dtracing static symbols Message-ID: <DAFA24CE-0318-4455-9EE3-C8617BBE7D0B@gsoft.com.au> In-Reply-To: <1394599542.80116.YahooMailBasic@web192602.mail.sg3.yahoo.com> References: <1394599542.80116.YahooMailBasic@web192602.mail.sg3.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_32394B83-8C01-47BD-B503-BE1BCB65F7C7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 On 12 Mar 2014, at 15:15, Prashanth Kumar <pra_udupi@yahoo.co.in> wrote: > 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 created for instruction offsets. > you will have to update the libproc library and fasttrap code to = trace all the=20 > functions.=20 I don't really care about the function offsets, just static functions.=20= Or are you suggesting updating libproc and the fasttrap code will allow = that (as well as instruction offsets)? THanks. > -------------------------------------------- > On Wed, 12/3/14, Daniel O'Connor <doconnor@gsoft.com.au> wrote: >=20 > Subject: Re: dtracing static symbols > To: "Robert Mustacchi" <rm@joyent.com> > Cc: freebsd-dtrace@freebsd.org > Date: Wednesday, 12 March, 2014, 2:54 AM >=20 >=20 > On 12 Mar 2014, at 2:30, Robert Mustacchi <rm@joyent.com> > wrote: >> On 03/10/2014 10:34 PM, Daniel O'Connor wrote: >>>=20 >>> On 11 Mar 2014, at 15:34, Prashanth Kumar <pra_udupi@yahoo.co.in> > 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." > -- Andrew Tanenbaum > GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 > 7B3F CE8C >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=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." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C --Apple-Mail=_32394B83-8C01-47BD-B503-BE1BCB65F7C7 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 iD8DBQFTH+eJ5ZPcIHs/zowRAgd5AJ9uSBR0jNitu1oozlz3ibCi6FQ5awCfe/Hy 1Y7etC62aJM3DRnZD9uHkW4= =xdSy -----END PGP SIGNATURE----- --Apple-Mail=_32394B83-8C01-47BD-B503-BE1BCB65F7C7--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DAFA24CE-0318-4455-9EE3-C8617BBE7D0B>