From d5a2bd44d30b45b6829eb27d70ffb6ceaa70c5bd Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Thu, 17 Dec 2009 16:18:34 +0100 Subject: support for a brief backtrace format This only prints symbol+offset, or an address if the symbol isn't known. * runtime/runtime.h (SYM_VERBOSE_NO, SYM_VERBOSE_FULL, SYM_VERBOSE_BRIEF): new constants * runtime/stack.c (_stp_stack_print): support brief format * runtime/sym.c (_stp_func_print): ditto * tapset/ucontext-unwind.stp (print_ubacktrace_brief): new function * testsuite/systemtap.context/fib.c: new test program * testsuite/systemtap.context/fib.stp: new test * testsuite/systemtap.context/fib.exp: new test --- tapset/ucontext-unwind.stp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tapset/ucontext-unwind.stp') diff --git a/tapset/ucontext-unwind.stp b/tapset/ucontext-unwind.stp index e0d883b8..399ce0c5 100644 --- a/tapset/ucontext-unwind.stp +++ b/tapset/ucontext-unwind.stp @@ -34,6 +34,24 @@ function print_ubacktrace () %{ /* unprivileged */ } %} +/** + * sfunction print_ubacktrace_brief- Print stack back trace for current task. EXPERIMENTAL! + * + * Equivalent to print_ubacktrace(), but output for each symbol is + * shorter (just name and offset), and the function address is + * printed if it can't be mapped to a name. + */ + +function print_ubacktrace_brief () %{ /* unprivileged */ + assert_is_myproc(); + if (CONTEXT->regs) { + _stp_stack_print(CONTEXT->regs, SYM_VERBOSE_BRIEF, CONTEXT->pi, + MAXTRACE, current, CONTEXT->ri); + } else { + _stp_printf("Systemtap probe: %s\n", CONTEXT->probe_point); + } +%} + /** * sfunction ubacktrace - Hex backtrace of current task stack. EXPERIMENTAL! * -- cgit