From d2f4d7286629da6e9f1b844beefb141a4d3ef2c3 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 10 Dec 2008 20:39:45 +0100 Subject: PR6866: First pass at translating addresses to symbol names through vma. --- tapset/context-unwind.stp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tapset/context-unwind.stp') diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index 4c5ed34b..59d111ee 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -51,7 +51,8 @@ function backtrace:string () %{ /* pure */ function caller:string() %{ /* pure */ if (CONTEXT->pi) _stp_symbol_snprint( THIS->__retvalue, MAXSTRINGLEN, - (unsigned long)_stp_ret_addr_r(CONTEXT->pi)); + (unsigned long)_stp_ret_addr_r(CONTEXT->pi), + current); else strlcpy(THIS->__retvalue,"unknown",MAXSTRINGLEN); %} -- cgit From 37bb6cc0978855325f856bbd343d7dc253cf6851 Mon Sep 17 00:00:00 2001 From: ddomingo Date: Mon, 16 Mar 2009 14:21:50 +1000 Subject: fixed format of non-grabbable comments (for Tapset Reference Guide), added tapsetdescription for man page generator (in development) --- tapset/context-unwind.stp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tapset/context-unwind.stp') diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index a0836ed6..5c1253b8 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -6,7 +6,11 @@ // redistribute it and/or modify it under the terms of the GNU General // Public License (GPL); either version 2, or (at your option) any // later version. - +// +// Context functions provide additional information about where an event occurred. These functions can +//provide information such as a backtrace to where the event occured and the current register values for the +//processor. +// %{ #ifndef STP_NEED_UNWIND_DATA #define STP_NEED_UNWIND_DATA 1 -- cgit From 83b85c2b0be729352bae4ea204d814b377b32fcf Mon Sep 17 00:00:00 2001 From: ddomingo Date: Tue, 17 Mar 2009 15:13:23 +1000 Subject: minor edits --- tapset/context-unwind.stp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tapset/context-unwind.stp') diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index 5c1253b8..90d4e0f4 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -23,7 +23,7 @@ /** * sfunction print_backtrace - Print stack back trace * - * Equivalent to print_stack(backtrace()), + * Equivalent to print_stack(backtrace()), * except that deeper stack nesting may be supported. Return nothing. */ function print_backtrace () %{ @@ -37,8 +37,8 @@ function print_backtrace () %{ /** * sfunction backtrace - Hex backtrace of current stack * - * Return a string of hex addresses that are a backtrace of the - * stack. It may be truncated due to maximum string length. + * Return a string of hex addresses that are a backtrace of the + * stack. Output may be truncated as per maximum string length. */ function backtrace:string () %{ /* pure */ if (CONTEXT->regs) @@ -50,7 +50,7 @@ function backtrace:string () %{ /* pure */ /** * sfunction caller - Return name and address of calling function * - * Return the address and name of the calling function. + * Return the address and name of the calling function. * Works only for return probes at this time. */ function caller:string() %{ /* pure */ @@ -64,7 +64,7 @@ function caller:string() %{ /* pure */ /** * sfunction caller_addr - Return caller address * - * Return the address of the calling function. + * Return the address of the calling function. * Works only for return probes at this time. */ function caller_addr:long () %{ /* pure */ -- cgit From b2b336288ce9e92a21efe7dcd314f604bc97be29 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Thu, 2 Apr 2009 18:42:38 +0200 Subject: PR6580: Implement symname, symdata and modname context functions. This adds a couple of the suggested context/stack revamp functions from PR6580. In particular it replaces the symbolname() function that sneaked in with the pr6866 branch merge with the suggested symname(). * runtime/sym.c (_stp_mod_sec_lookup): Make section optional. (_stp_symbol_snprint): Provide a way to get optional module info. * tapset/context-symbols.stp: Replace symbolname() with symname(), add modname() and symdata(). (probemod): Implement pc based fallback. * tapset/context-unwind.stp (caller): Adjust for _stp_symbol_snprint change. * testsuite/systemtap.context/usymbols.exp: Use new symname. * testsuite/buildok/modname.stp: New test. * testsuite/buildok/symdata.stp: Likewise. * testsuite/buildok/symname.stp: Likewise. --- tapset/context-unwind.stp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tapset/context-unwind.stp') diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index a976f8b6..b3d19e29 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -57,7 +57,7 @@ function caller:string() %{ /* pure */ if (CONTEXT->pi) _stp_symbol_snprint( THIS->__retvalue, MAXSTRINGLEN, (unsigned long)_stp_ret_addr_r(CONTEXT->pi), - current); + current, 0); else strlcpy(THIS->__retvalue,"unknown",MAXSTRINGLEN); %} -- cgit From 47a2a2303c9b261e88a4333bf2964b4291a22a12 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 20 Apr 2009 22:43:37 +0200 Subject: Pass task from tapset, through stack and unwind functions for lookup. * runtime/stack-arm.c (__stp_stack_print): Take struct task_struct *. * runtime/stack-ia64.c (__stp_stack_print): Likewise. * runtime/stack-ppc64.c (__stp_stack_print): Likewise. * runtime/stack-s390.c (__stp_stack_print): Likewise. * runtime/stack-i386.c (__stp_stack_print): Likewise. And add check and pass to unwind() and _stp_func_print(). * runtime/stack-x86_64.c: Likewise. * runtime/stack.c *_stp_stack_print): Take and pass on task_struct. (_stp_stack_snprint): Likewise. * runtime/unwind.c (unwind): Take and use task_struct for _stp_mod_sec_lookup(). * tapset/context-unwind.stp (print_backtrace): Pass NULL to _stp_stack_print(). (backtrace): Pass NULL to _stp_stack_snprint(). --- tapset/context-unwind.stp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tapset/context-unwind.stp') diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index b3d19e29..f1e99dc8 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -28,7 +28,7 @@ */ function print_backtrace () %{ if (CONTEXT->regs) { - _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE); + _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE, NULL); } else { _stp_printf("Systemtap probe: %s\n", CONTEXT->probe_point); } @@ -42,7 +42,7 @@ function print_backtrace () %{ */ function backtrace:string () %{ /* pure */ if (CONTEXT->regs) - _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN, CONTEXT->regs, 0, CONTEXT->pi, MAXTRACE); + _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN, CONTEXT->regs, 0, CONTEXT->pi, MAXTRACE, NULL); else strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); %} -- cgit From 90562d7d561c26b25aa73082bd33eaa399688187 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Wed, 13 May 2009 12:51:38 +0200 Subject: Implement caller:string() in terms of symname() and caller_addr(). * tapset/context-unwind.stp (caller): Implement as stap function using symname(), caller_addr() and sprintf(). --- tapset/context-unwind.stp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'tapset/context-unwind.stp') diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp index f1e99dc8..d6654d25 100644 --- a/tapset/context-unwind.stp +++ b/tapset/context-unwind.stp @@ -51,16 +51,13 @@ function backtrace:string () %{ /* pure */ * sfunction caller - Return name and address of calling function * * Return the address and name of the calling function. + * This is equivalent to calling: + * sprintf("%s 0x%x", symname(caller_addr(), caller_addr())) * Works only for return probes at this time. */ -function caller:string() %{ /* pure */ - if (CONTEXT->pi) - _stp_symbol_snprint( THIS->__retvalue, MAXSTRINGLEN, - (unsigned long)_stp_ret_addr_r(CONTEXT->pi), - current, 0); - else - strlcpy(THIS->__retvalue,"unknown",MAXSTRINGLEN); -%} +function caller:string() { + return sprintf("%s 0x%x", symname(caller_addr()), caller_addr()); +} /** * sfunction caller_addr - Return caller address -- cgit