public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Add support for userspace stacktraces in tracing/iter_ctrl [v2]
@ 2008-11-02 21:18 Török Edwin
  2008-11-02 21:18 ` [PATCH] Add support for userspace stacktraces in tracing/iter_ctrl Török Edwin
  0 siblings, 1 reply; 25+ messages in thread
From: Török Edwin @ 2008-11-02 21:18 UTC (permalink / raw)
  To: mingo; +Cc: srostedt, a.p.zijlstra, sandmann, linux-kernel, edwintorok


This patch series adds support for userstack tracing to ftrace.
I've tested it on x86_64.

Example usage:
mount -t debugfs nodev /sys/kernel/debug
cd /sys/kernel/debug/tracing
echo userstacktrace >iter_ctrl
echo sym-userobj >iter_ctrl
echo sched_switch >current_tracer
echo 1 >tracing_enabled
cat trace_pipe >/tmp/trace&
.... run application ...
echo 0 >tracing_enabled
cat /tmp/trace

		a.out-1623  [000] 40874.465068: /root/a.out[+0x480] <-/root/a.out[+0
+x494] <- /root/a.out[+0x4a8] <- /lib/libc-2.7.so[+0x1e1a6]

If you just want the addresses don't use sym-userobj, but you should resolve the
address to an object before the process exits, otherwise you can't know which
object it belonged to, due to Address Space Layout Randomization (for libraries
at least).

To get meaningful results you'll need your app and
libs compiled with frame-pointers. This usually means rebuilding libc with
frame-pointers (your own app should have frame pointers by default, unless you
used -fomit-frame-pointer).

Another approach would be to use dwarf unwind info that works without frame
pointers (as userspace does it). There was a kernel/unwind.c around 2.6.19, but
it got removed, so I didn't look further at this possibility.

 arch/x86/kernel/stacktrace.c |   57 +++++++++++++++++
 Documentation/ftrace.txt   |   16 ++++
 kernel/trace/trace.c       |  142 +++++++++++++++++++++++++++++++++++++++++++
 kernel/trace/trace.h       |   10 +++
 include/linux/stacktrace.h   |    8 ++

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2008-11-06 15:37 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-02 21:18 Add support for userspace stacktraces in tracing/iter_ctrl [v2] Török Edwin
2008-11-02 21:18 ` [PATCH] Add support for userspace stacktraces in tracing/iter_ctrl Török Edwin
2008-11-02 21:18   ` [PATCH] Identify which executable object the userspace address belongs to. Store thread group leader id, and use it to lookup the address in the process's map. We could have looked up the address on thread's map, but the thread might not exist by the time we are called. The process might not exist either, but if you are reading trace_pipe, that is unlikely Török Edwin
2008-11-02 21:25     ` Al Viro
2008-11-02 21:28       ` Török Edwin
2008-11-02 21:40         ` Al Viro
2008-11-03  7:32           ` Ingo Molnar
2008-11-04 18:26             ` Christoph Hellwig
2008-11-04 18:37               ` Török Edwin
2008-11-04 19:09                 ` Christoph Hellwig
2008-11-04 19:10                   ` Török Edwin
2008-11-06  9:55               ` Ingo Molnar
2008-11-06 12:26                 ` Christoph Hellwig
2008-11-06 15:32                   ` Ingo Molnar
2008-11-06 15:36                     ` Christoph Hellwig
2008-11-03  7:47     ` Ingo Molnar
2008-11-03  8:16       ` Török Edwin
2008-11-03  8:21         ` Ingo Molnar
2008-11-03  8:29         ` Ingo Molnar
2008-11-03 13:57           ` Török Edwin
2008-11-03 14:04             ` Ingo Molnar
2008-11-03 19:26           ` Mathieu Desnoyers
2008-11-03 19:56     ` Peter Zijlstra
2008-11-03 19:58       ` Arnaldo Carvalho de Melo
2008-11-03 20:01         ` Török Edwin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox