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 --- testsuite/systemtap.context/fib.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 testsuite/systemtap.context/fib.c (limited to 'testsuite/systemtap.context/fib.c') diff --git a/testsuite/systemtap.context/fib.c b/testsuite/systemtap.context/fib.c new file mode 100644 index 00000000..61fee0a7 --- /dev/null +++ b/testsuite/systemtap.context/fib.c @@ -0,0 +1,31 @@ +#include +#include + +long fib(int x) +{ + if (x == 0 || x == 1) + return 1; + else + return fib(x - 1) + fib(x - 2); +} + +int main(int argc, char **argv) +{ + int x = 0; + long result = 0; + + if (argc != 2) + { + printf("0\n"); + return 1; + } + x = atoi(argv[1]); + if (x < 0) + { + printf("0\n"); + return 1; + } + result = fib(x); + printf("%ld\n", result); + return 0; +} -- cgit