Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Mar 2014 09:00:02 -0700
From:      Robert Mustacchi <rm@joyent.com>
To:        freebsd-dtrace@freebsd.org
Subject:   Re: dtracing static symbols
Message-ID:  <531F3302.8010106@joyent.com>
In-Reply-To: <7C202659-0BD9-4F93-8886-24DD7AEB495F@gsoft.com.au>
References:  <1394514256.45492.YahooMailBasic@web192604.mail.sg3.yahoo.com> <7C202659-0BD9-4F93-8886-24DD7AEB495F@gsoft.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On 03/10/2014 10:34 PM, Daniel O'Connor wrote:
> 
> 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?
> 
> 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.

> On OSX you see..
> ...
> 956613   pid46749            static                               foo return
> 956614   pid46749            static                               foo entry
> 956615   pid46749            static                               foo 0
> 956616   pid46749            static                               foo 1
> 956617   pid46749            static                               foo 4
> 956618   pid46749            static                               foo 8
> 956619   pid46749            static                               foo f
> 956620   pid46749            static                               foo 11
> 956621   pid46749            static                               foo 16
> 956622   pid46749            static                               foo 19
> 956623   pid46749            static                               foo 1d
> 956624   pid46749            static                               foo 1e
> ..
> 
> (I'm not sure what the various numbers mean)

The pid provider can instrument any instruction in a function, those are
the instruction offsets.

Robert



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?531F3302.8010106>