summaryrefslogtreecommitdiffstats
path: root/tapset
diff options
context:
space:
mode:
authorDave Brolley <brolley@redhat.com>2009-04-08 12:03:08 -0400
committerDave Brolley <brolley@redhat.com>2009-04-08 12:03:08 -0400
commit2f7ba4b8416eae26971da68fdc14aa8560a7939c (patch)
treed5b4383e43bc108d9f76d30addfd857b6bf8dc62 /tapset
parent83d18bfb001f334309163e54d6c5bd28a1829035 (diff)
parent3dd58c2ac312fc16aa38124987081adbd6697629 (diff)
downloadsystemtap-steved-2f7ba4b8416eae26971da68fdc14aa8560a7939c.tar.gz
systemtap-steved-2f7ba4b8416eae26971da68fdc14aa8560a7939c.tar.xz
systemtap-steved-2f7ba4b8416eae26971da68fdc14aa8560a7939c.zip
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'tapset')
-rw-r--r--tapset/context-symbols.stp4
-rw-r--r--tapset/context.stp25
-rw-r--r--tapset/ucontext-symbols.stp52
3 files changed, 79 insertions, 2 deletions
diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp
index 66d9fea2..783f1b7b 100644
--- a/tapset/context-symbols.stp
+++ b/tapset/context-symbols.stp
@@ -128,7 +128,7 @@ function modname:string (addr: long) %{ /* pure */
*/
function symname:string (addr: long) %{ /* pure */
_stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr,
- current, 0);
+ NULL, 0);
%}
/**
@@ -143,5 +143,5 @@ function symname:string (addr: long) %{ /* pure */
*/
function symdata:string (addr: long) %{ /* pure */
_stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr,
- current, 1);
+ NULL, 1);
%}
diff --git a/tapset/context.stp b/tapset/context.stp
index 9f4be0e6..36d68c8d 100644
--- a/tapset/context.stp
+++ b/tapset/context.stp
@@ -11,6 +11,11 @@
//provide information such as a backtrace to where the event occured and the current register values for the
//processor.
// </tapsetdescription>
+
+%{
+#include <asm/processor.h>
+%}
+
/**
* sfunction print_regs - Print a register dump.
*/
@@ -227,3 +232,23 @@ function stack_unused:long () %{ /* pure */
THIS->__retvalue = (long)&a & (THREAD_SIZE-1);
%}
+/**
+ * sfunction uaddr - User space address of current running task.
+ *
+ * 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.
+ */
+function uaddr:long () %{ /* pure */
+ int64_t addr = 0;
+ if (current->mm)
+ {
+ struct pt_regs *uregs;
+ uregs = task_pt_regs(current);
+ if (uregs)
+ addr = (int64_t) REG_IP(uregs);
+ }
+ THIS->__retvalue = addr;
+%}
+
diff --git a/tapset/ucontext-symbols.stp b/tapset/ucontext-symbols.stp
new file mode 100644
index 00000000..3813a8bf
--- /dev/null
+++ b/tapset/ucontext-symbols.stp
@@ -0,0 +1,52 @@
+// User context symbols 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.
+
+// <tapsetdescription>
+// User context symbol functions provide additional information about
+// addresses from an application. These functions can provide
+// information about the user space map (library) that the event occured or
+// the function symbol of an address.
+// </tapsetdescription>
+
+%{
+#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 usymname - Return the symbol of an address in the current task.
+ * @addr: The address to translate.
+ *
+ * Description: Returns the (function) symbol name associated with the
+ * given address if known. If not known it will return the hex string
+ * representation of addr.
+ */
+function usymname:string (addr: long) %{ /* pure */
+ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr,
+ current, 0);
+%}
+
+/**
+ * sfunction usymdata - Return the symbol and module offset of an address.
+ * @addr: The address to translate.
+ *
+ * Description: Returns the (function) symbol name associated with the
+ * given address in the current task if known, plus the module name
+ * (between brackets) and the offset inside the module (shared library),
+ * plus the size of the symbol function. If any element is not known it
+ * will be ommitted and if the symbol name is unknown it will return the
+ * hex string for the given address.
+ */
+function usymdata:string (addr: long) %{ /* pure */
+ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr,
+ current, 1);
+%}