From: Mark Wielaard <mjw@redhat.com>
To: systemtap@sourceware.org
Subject: Re: dwarf unwinder (only works on i386/x86_64) - now with eh_frame and debug_frame fallback
Date: Thu, 21 May 2009 08:03:00 -0000 [thread overview]
Message-ID: <1242893011.3655.47.camel@hermans.wildebeest.org> (raw)
In-Reply-To: <1240347505.19523.41.camel@hermans.wildebeest.org>
Hi,
Yesterday I pushed some commits to make the dwarf unwinder use both
debug_frame and eh_frame tables. At first I had wanted to just used
debug_frame tables for the kernel and eh_frame for user space, but
depending on the gcc version, architecture (and apparently GNU/Linux
distro defaults), either table can be missing or only have partial
coverage (see gcc options -fexceptions, -fnon-call-exceptions,
-funwind-tables and -fasynchronous-unwind-tables). So currently we
default to the debug_frame table, and if that fails to unwind for a
particular location we fall back and retry using the eh_frame table.
This make the uprobes_ustack.exp testcase (and hopefully user stack
traces in general) work against gcc 4.4 (which is the default compiler
for fedora 11). Please do test and let me know of any situations where
things don't seem to work (especially if the uprobes_ustack.exp testcase
fails). Currently the dwarf unwinder is only enabled on i386 and x86_64.
It would be interesting to see if it can easily be enabled on other
architectures.
The "ugly" code in these patches is in adjustStartAddress() in
runtime/unwind.c. This really should go into _stp_module_relocate or
read_pointer. One tricky issue here is that we read the eh_frame section
during translation time and then load it in kernel space at module init
time. eh_frame tables can use pointer encodings that are absolute or
pc_relative (actually data relative), so we need to readjust for the new
load location of the eh_frame.
Some optimizations that could be done:
- Use the eh_frame_hdr binary search table
(needs careful auditing of adjustStartAddress -> read_pointer).
- Try to read eh_frame in-place from user space
(risks tricky page fault issues if not available)
- Merge debug_frame and eh_frame at runtime and build our own
binary search hdr.
But for now I won't be working on those, unless the backtraces become a
bottleneck for actual code using them.
Next steps to make stacktraces better are:
- Add more tests (in particular ones that test prelinking
and missing or split-file debuginfo).
- Make vma-tracker more robust (_stp_tf_mmap_cb)
Wenji send me some notes on things it seems to miss. If we cannot
track a location to a _stp_module we cannot unwind.
- Track vdso for process symbols/backtraces. PR10080.
- Simplify unwind interface. Architecture dependent code has too
much duplication. Need to just handle address, not function symbol
printing.
- Nicer fallback to in-kernel unwinder/backtrace, in particular
for backtracing from non-pt_regs probe context. PR6961.
- unwind through kretprobes. PR6436/PR9999.
- Better tapset functions for handling stacks. PR6580.
I'll be away for a couple of days, but will be back early next week.
Cheers,
Mark
next prev parent reply other threads:[~2009-05-21 8:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-17 14:06 dwarf unwinder (only works on i386/x86_64) Mark Wielaard
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 ` Mark Wielaard [this message]
2009-05-21 18:44 ` dwarf unwinder (only works on i386/x86_64) - now with eh_frame and debug_frame fallback 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=1242893011.3655.47.camel@hermans.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).