From ad4f749fc45d8411b26e4093e9e8353b8971a482 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 19 Apr 2009 23:39:12 +0200 Subject: Pass task to _stp_func_print and _stp_kallsyms_lookup. * runtime/sym.c (_stp_func_print): Take task, pass to _stp_kallsyms_lookup. * runtime/stack.c (print_stack_address): Pass NULL. * runtime/stack-i386.c (_stp_stack_print_fallback): Pass NULL. (__stp_stack_print): Pass NULL or current. * runtime/stack-x86_64.c (_stp_stack_print_fallback): Pass NULL. (__stp_stack_print): Pass current. --- runtime/sym.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/sym.c') diff --git a/runtime/sym.c b/runtime/sym.c index f6f97ac2..fe9b800c 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -330,7 +330,8 @@ static void _stp_symbol_print(unsigned long address) } /* Like _stp_symbol_print, except only print if the address is a valid function address */ -static int _stp_func_print(unsigned long address, int verbose, int exact) +static int _stp_func_print(unsigned long address, int verbose, int exact, + struct task_struct *task) { const char *modname; const char *name; @@ -342,7 +343,7 @@ static int _stp_func_print(unsigned long address, int verbose, int exact) else exstr = " (inexact)"; - name = _stp_kallsyms_lookup(address, &size, &offset, &modname, NULL, NULL); + name = _stp_kallsyms_lookup(address, &size, &offset, &modname, NULL, task); if (name) { if (verbose) { -- cgit From c45319065d6e3ae91ae833f7afbf0edba6c87d89 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 21 Apr 2009 17:16:51 +0200 Subject: Add ubacktrace(), print_ustack() and print_ubacktrace(). * runtime/sym.c (_stp_usymbol_print): New function. * tapset/ucontext-unwind.stp (print_ubacktrace): New tapset function. (ubacktrace): Likewise. * tapset/ucontext-symbols.stp (print_ustack): Likewise. * testsuite/buildok/ustack.stp: New test for above three functions. --- runtime/sym.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'runtime/sym.c') diff --git a/runtime/sym.c b/runtime/sym.c index fe9b800c..013edd0c 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -329,6 +329,32 @@ static void _stp_symbol_print(unsigned long address) } } +/** Print an user space address from a specific task symbolically. + * @param address The address to lookup. + * @param task The address to lookup. + * @note Symbolic lookups should not normally be done within + * a probe because it is too time-consuming. Use at module exit time. + */ + +static void _stp_usymbol_print(unsigned long address, struct task_struct *task) +{ + const char *modname; + const char *name; + unsigned long offset, size; + + name = _stp_kallsyms_lookup(address, &size, &offset, &modname, NULL, + task); + + _stp_printf("%p", (int64_t) address); + + if (name) { + if (modname && *modname) + _stp_printf(" : %s+%#lx/%#lx [%s]", name, offset, size, modname); + else + _stp_printf(" : %s+%#lx/%#lx", name, offset, size); + } +} + /* Like _stp_symbol_print, except only print if the address is a valid function address */ static int _stp_func_print(unsigned long address, int verbose, int exact, struct task_struct *task) -- cgit