diff options
author | Dave Brolley <brolley@redhat.com> | 2009-04-22 11:57:40 -0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-04-22 11:57:40 -0400 |
commit | bc815e0692536da04956f038f5f79941579f8d74 (patch) | |
tree | 98b0f8cfdd90c225f5b5fede18352caee5d9a546 /tapset/ucontext-unwind.stp | |
parent | 88e8da383e47adafc9e75c4f10aecd0ce4ad959f (diff) | |
parent | 247f1e1fa09953347a4e5313ae0022f151316dae (diff) | |
download | systemtap-steved-bc815e0692536da04956f038f5f79941579f8d74.tar.gz systemtap-steved-bc815e0692536da04956f038f5f79941579f8d74.tar.xz systemtap-steved-bc815e0692536da04956f038f5f79941579f8d74.zip |
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'tapset/ucontext-unwind.stp')
-rw-r--r-- | tapset/ucontext-unwind.stp | 52 |
1 files changed, 52 insertions, 0 deletions
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); +%} |