This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

dwarf unwinder (only works on i386/x86_64)


Hi,

I fixed up a couple of small things and enabled the dwarf unwinder for
in-kernel unwinding (merge commit 7c2136cf), this also fixes bug #5748
for which there is a testcase in testsuite/systemtap.context/context.exp
(backtrace.tcl) that now has all calling functions in the trace (for a
specific test module inserted). There can be some improvements to the
code. The unwinder sometimes goes on after falling off the stack, when
it should really use the fallback stack unwinder that was the default
before. But in general the stack traces are more complete than before.
There should be more tests written though.

Currently the dwarf unwinder is only enabled for i386 and x86_64 in
runtime/runtime.h:

/* dwarf unwinder only tested so far on i386 and x86_64. */
#if (defined(__i386__) || defined(__x86_64__))
#ifndef STP_USE_DWARF_UNWINDER
#define STP_USE_DWARF_UNWINDER
#endif
#endif

This is because the unwinder needs register setup initialization which
is currently only defined for i386 and x86_64 in runtime/unwind/[i386|
x86_64].h. To support other architectures one needs to add a new header
file defining an appropriate struct unwind_frame_info that can be
initialized through a function arch_unw_init_frame_info() that takes a
struct pt_regs and define a function arch_unw_user_mode() that given a
struct unwind_frame_info can detect it reached the end of the kernel
stack/start of user space stack (these don't actually work very well in
the i386/x86_64 cases btw because the dwarf unwinder cannot currently
unwind through the assembly level functions that setup the kernel stack
on kernel entry - this is a general issue with unwinding through
assembly functions which don't have cfi information that Roland is
looking into).

Then in the architecture specific runtime/stack-[arch].c file you can
use these the enable the dwarf unwinder in your __stp_stack_print()
function #ifdef STP_USE_DWARF_UNWINDER and otherwise fallback to some
_stp_stack_print_fallback function that does the original heuristic
stack walking. At least that is how i386 and x86_64 set things up.

I am working on using the dwarf unwinder also for user space
backtracing. First using the debug_frame tables that we also are using
for the kernel case, but maybe switching to the eh_frame tables (it
isn't clear which one is really the most accurate at the moment, we
might need to consult both, but I am trying to avoid doing that for
now).

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]