Open thesamesam opened 3 weeks ago
We certainly can look at it being an optional support - if debuginfo is available it would make sense to make use of it if it does not negatively impact trace processing. Anything that improves backtraces while not adding to the runtime dependencies in general is good.
There are two distinct issues here: DTrace wants backtrace info for reliable stack traces (which has to be something the kernel can understand --hopefully, in the future, sframe will do here), and DTrace's userspace wants a symbol table for symbol lookups. Even the latter is only going to work for longer-running traces where the process hasn't already died before userspace gets its hands on the trace, but even then this is troublesome for main programs which are routinely stripped. Solaris implemented an .ldynsym section for just this, but the Linux approach seems to have been quite different: a section containing a compressed ELF executable (!!) which only has symbol table sections in it. We do not yet handle this crazy thing, and in my last trials relatively few binaries were built with it at all. We do need a symtab from somewhere.
I'd be happy to add some sort of symbol server support, but I don't think Linux has any such thing either...
a section containing a compressed ELF executable
I'm pretty sure this is MiniDebugInfo (.gnu_debugdata). It looks like only Fedora ships with it by default (?) but I'd be open to us doing it in Gentoo.
One question is if we want to try lead some standardisation of making it a proper compressed section or not. But that would delay things substantially.
I'd be happy to add some sort of symbol server support, but I don't think Linux has any such thing either...
Isn't that debuginfod? What am I missing?
This is maybe a better example of the kind of thing I was talking about in https://github.com/oracle/dtrace-utils/issues/84.
With splitdebug (-ggdb3 but in /usr/lib/debug and stripped
less
),ustack()
output is not super friendly:In this case, I genuinely didn't know that
less
would ever callfsync
, so I was curious as to where from! But the backtrace isn't so helpful there.I get better output if I disable stripping and use
-fno-omit-frame-pointer
:It's not perfect, but it's more than enough for me to pin down what's going on.
Could DTrace learn to read DWARF (
elfutils
should be able to do this, including understanding splitdebug and so on) for backtraces?