diff options
Diffstat (limited to 'tapset')
-rw-r--r-- | tapset/context-symbols.stp | 4 | ||||
-rw-r--r-- | tapset/context-unwind.stp | 4 | ||||
-rw-r--r-- | tapset/context.stp | 6 | ||||
-rw-r--r-- | tapset/ucontext-symbols.stp | 27 | ||||
-rw-r--r-- | tapset/ucontext-unwind.stp | 52 |
5 files changed, 85 insertions, 8 deletions
diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp index 783f1b7b..e4406d9b 100644 --- a/tapset/context-symbols.stp +++ b/tapset/context-symbols.stp @@ -16,10 +16,10 @@ #define STP_NEED_SYMBOL_DATA 1 #endif %} -// weirdness with print_stack, argument appears in build as undescribed + /** * sfunction print_stack - Print out stack from string. - * @stk: String with list of hexidecimal addresses. (FIXME) + * @stk: String with list of hexidecimal addresses. * * Perform a symbolic lookup of the addresses in the given string, * which is assumed to be the result of a prior call to 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); %} diff --git a/tapset/context.stp b/tapset/context.stp index 36d68c8d..6fad3740 100644 --- a/tapset/context.stp +++ b/tapset/context.stp @@ -233,12 +233,14 @@ function stack_unused:long () %{ /* pure */ %} /** - * sfunction uaddr - User space address of current running task. + * sfunction uaddr - User space address of current running task. EXPERIMENTAL. * * Description: Returns the address in userspace that the current * task was at when the probe occured. When the current running task * isn't a user space thread, or the address cannot be found, zero - * is returned. + * is returned. Can be used to see where the current task is combined + * with usymname() or symdata(). Often the task will be in the VDSO + * where it entered the kernel. FIXME - need VDSO tracking support #10080. */ function uaddr:long () %{ /* pure */ int64_t addr = 0; diff --git a/tapset/ucontext-symbols.stp b/tapset/ucontext-symbols.stp index 3813a8bf..5502f5cd 100644 --- a/tapset/ucontext-symbols.stp +++ b/tapset/ucontext-symbols.stp @@ -23,7 +23,7 @@ %} /** - * sfunction usymname - Return the symbol of an address in the current task. + * sfunction usymname - Return the symbol of an address in the current task. EXPERIMENTAL! * @addr: The address to translate. * * Description: Returns the (function) symbol name associated with the @@ -36,7 +36,7 @@ function usymname:string (addr: long) %{ /* pure */ %} /** - * sfunction usymdata - Return the symbol and module offset of an address. + * sfunction usymdata - Return the symbol and module offset of an address. EXPERIMENTAL! * @addr: The address to translate. * * Description: Returns the (function) symbol name associated with the @@ -50,3 +50,26 @@ function usymdata:string (addr: long) %{ /* pure */ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr, current, 1); %} + +/** + * sfunction print_ustack - Print out stack for the current task from string. EXPERIMENTAL! + * @stk: String with list of hexidecimal addresses for the current task. + * + * Perform a symbolic lookup of the addresses in the given string, + * which is assumed to be the result of a prior call to + * <command>ubacktrace()</command> for the current task. + * + * Print one line per address, including the address, the + * name of the function containing the address, and an estimate of + * its position within that function. Return nothing. + */ +function print_ustack(stk:string) %{ + char *ptr = THIS->stk; + char *tok = strsep(&ptr, " "); + while (tok && *tok) { + _stp_print_char(' '); + _stp_usymbol_print (simple_strtol(tok, NULL, 16), current); + _stp_print_char('\n'); + tok = strsep(&ptr, " "); + } +%} diff --git a/tapset/ucontext-unwind.stp b/tapset/ucontext-unwind.stp new file mode 100644 index 00000000..0801f1c9 --- /dev/null +++ b/tapset/ucontext-unwind.stp @@ -0,0 +1,52 @@ +// User context unwind tapset +// Copyright (C) 2009 Red Hat Inc. +// +// This file is part of systemtap, and is free software. You can +// 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. + +%{ +#ifndef STP_NEED_UNWIND_DATA +#define STP_NEED_UNWIND_DATA 1 +#endif +#ifndef STP_NEED_SYMBOL_DATA +#define STP_NEED_SYMBOL_DATA 1 +#endif +#ifndef STP_NEED_VMA_TRACKER +#define STP_NEED_VMA_TRACKER 1 +#endif +%} + +/** + * sfunction print_ubacktrace - Print stack back trace for current task. EXPERIMENTAL! + * + * Equivalent to <command>print_ustack(ubacktrace())</command>, + * except that deeper stack nesting may be supported. Return nothing. + */ +function print_ubacktrace () %{ + if (CONTEXT->regs) { + _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE, + current); + } else { + _stp_printf("Systemtap probe: %s\n", CONTEXT->probe_point); + } +%} + +/** + * sfunction ubacktrace - Hex backtrace of current task stack. EXPERIMENTAL! + * + * Return a string of hex addresses that are a backtrace of the + * stack of the current task. Output may be truncated as per maximum + * string length. Returns empty string when current probe point cannot + * determine user backtrace. + */ + +function ubacktrace:string () %{ /* pure */ + if (CONTEXT->regs) + _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN, + CONTEXT->regs, 0, CONTEXT->pi, MAXTRACE, + current); + else + strlcpy (THIS->__retvalue, "", MAXSTRINGLEN); +%} |