diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-04-21 17:16:51 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-04-21 17:16:51 +0200 |
commit | c45319065d6e3ae91ae833f7afbf0edba6c87d89 (patch) | |
tree | a5e0618ee9bea4911cac01b7df5f3ddbb6260fca /tapset/ucontext-symbols.stp | |
parent | 6094e1992123454047c79ce724475c49e834d218 (diff) | |
download | systemtap-steved-c45319065d6e3ae91ae833f7afbf0edba6c87d89.tar.gz systemtap-steved-c45319065d6e3ae91ae833f7afbf0edba6c87d89.tar.xz systemtap-steved-c45319065d6e3ae91ae833f7afbf0edba6c87d89.zip |
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.
Diffstat (limited to 'tapset/ucontext-symbols.stp')
-rw-r--r-- | tapset/ucontext-symbols.stp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tapset/ucontext-symbols.stp b/tapset/ucontext-symbols.stp index 3813a8bf..2e7ad25b 100644 --- a/tapset/ucontext-symbols.stp +++ b/tapset/ucontext-symbols.stp @@ -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. + * @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, " "); + } +%} |