summaryrefslogtreecommitdiffstats
path: root/tapset/context-unwind.stp
diff options
context:
space:
mode:
authorElliott Baron <ebaron@toriamos.yyz.redhat.com>2008-11-28 17:12:57 -0500
committerElliott Baron <ebaron@toriamos.yyz.redhat.com>2008-11-28 17:12:57 -0500
commit82762adc9d7e77cdce48a87a477a47fb9e14ecd9 (patch)
tree9698df6c70514f339cabb0eb72824f410db06a0e /tapset/context-unwind.stp
parent1ad820e32419c6ff9237962ec911e9c4eee79c4a (diff)
downloadsystemtap-steved-82762adc9d7e77cdce48a87a477a47fb9e14ecd9.tar.gz
systemtap-steved-82762adc9d7e77cdce48a87a477a47fb9e14ecd9.tar.xz
systemtap-steved-82762adc9d7e77cdce48a87a477a47fb9e14ecd9.zip
PR6965 - Conditionally compile symbol table. Split context.stp into 3 files.
Diffstat (limited to 'tapset/context-unwind.stp')
-rw-r--r--tapset/context-unwind.stp71
1 files changed, 71 insertions, 0 deletions
diff --git a/tapset/context-unwind.stp b/tapset/context-unwind.stp
new file mode 100644
index 00000000..c53de8f0
--- /dev/null
+++ b/tapset/context-unwind.stp
@@ -0,0 +1,71 @@
+// context-unwind tapset
+// Copyright (C) 2005, 2006, 2007 Red Hat Inc.
+// Copyright (C) 2006 Intel Corporation.
+//
+// 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_USE_DWARF_UNWINDER
+#define STP_USE_DWARF_UNWINDER 1
+#endif
+#ifndef NEED_SYMBOL_DATA
+#define NEED_SYMBOL_DATA 1
+#endif
+%}
+
+/**
+ * sfunction print_backtrace - Print stack back trace
+ *
+ * Equivalent to <command>print_stack(backtrace())</command>,
+ * except that deeper stack nesting may be supported. Return nothing.
+ */
+function print_backtrace () %{
+ if (CONTEXT->regs) {
+ _stp_stack_print(CONTEXT->regs, 1, CONTEXT->pi, MAXTRACE);
+ } else {
+ _stp_printf("Systemtap probe: %s\n", CONTEXT->probe_point);
+ }
+%}
+
+/**
+ * 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.
+ */
+function backtrace:string () %{ /* pure */
+ if (CONTEXT->regs)
+ _stp_stack_snprint (THIS->__retvalue, MAXSTRINGLEN, CONTEXT->regs, 0, CONTEXT->pi, MAXTRACE);
+ else
+ strlcpy (THIS->__retvalue, "", MAXSTRINGLEN);
+%}
+
+/**
+ * sfunction caller - Return name and address of calling function
+ *
+ * Return the address and name of the calling function.
+ * <emphasis>Works only for return probes at this time.</emphasis>
+ */
+function caller:string() %{ /* pure */
+ if (CONTEXT->pi)
+ _stp_symbol_snprint( THIS->__retvalue, MAXSTRINGLEN,
+ (unsigned long)_stp_ret_addr_r(CONTEXT->pi));
+ else
+ strlcpy(THIS->__retvalue,"unknown",MAXSTRINGLEN);
+%}
+
+/**
+ * sfunction caller_addr - Return caller address
+ *
+ * Return the address of the calling function.
+ * <emphasis> Works only for return probes at this time.</emphasis>
+ */
+function caller_addr:long () %{ /* pure */
+ if (CONTEXT->pi)
+ THIS->__retvalue = (int64_t)(long)_stp_ret_addr_r(CONTEXT->pi);
+ else
+ THIS->__retvalue = 0;
+%} \ No newline at end of file