lkml.org 
[lkml]   [2008]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectAdd support for userspace stacktraces in tracing/iter_ctrl [v2]
    Date

    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 ++


    \
     
     \ /
      Last update: 2008-11-02 22:21    [W:7.521 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site