public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mjw@redhat.com>
To: systemtap@sourceware.org
Subject: dwarf unwinder (only works on i386/x86_64)
Date: Fri, 17 Apr 2009 14:06:00 -0000	[thread overview]
Message-ID: <1239977157.2336.33.camel@fedora.wildebeest.org> (raw)

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

             reply	other threads:[~2009-04-17 14:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17 14:06 Mark Wielaard [this message]
2009-04-21 20:58 ` dwarf unwinder (only works on i386/x86_64) - now with user space unwinding Mark Wielaard
2009-05-21  8:03   ` dwarf unwinder (only works on i386/x86_64) - now with eh_frame and debug_frame fallback Mark Wielaard
2009-05-21 18:44     ` Roland McGrath
2009-05-21 22:57       ` Mark Wielaard
2009-05-22  1:19         ` Roland McGrath
2009-04-28 18:02 ` [Query] Re: dwarf unwinder (only works on i386/x86_64) Prerna Saxena
2009-04-28 18:19   ` Roland McGrath
2009-04-28 19:52     ` Mark Wielaard
2009-04-28 20:15       ` Roland McGrath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1239977157.2336.33.camel@fedora.wildebeest.org \
    --to=mjw@redhat.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).