What is wrong with dtrace's stack()?

Mark Johnston markj at freebsd.org
Wed Oct 24 17:23:07 UTC 2018


On Wed, Oct 24, 2018 at 01:14:10PM -0400, Ryan Stone wrote:
> ia32_pause() is an inline function.  How does dtrace map instruction
> pointers to symbol names?

It uses a kernel linker API whose implementation searches the symbol
tables of the kernel and loaded KLDs.

> Is it getting that mapping from some CTF
> data, and is that CTF data aware of inline functions?

No, and no.  CTF does include a function table, but that's just for
encoding function parameter and return types.  Functions that get
inlined into every caller (as I'd expect with ia32_pause()) shouldn't be
showing up in stack traces.  There is no ia32_pause() symbol in my
kernel; presumably the observed behaviour is related to some non-default
compiler flags being used, but I haven't carefully read through the
whole thread to see.

> If so, I'd argue that behaviour is counter-intuitive and unhelpful, as
> this example here shows.


More information about the freebsd-hackers mailing list