summaryrefslogtreecommitdiffstats
path: root/tapset/context.stp
diff options
context:
space:
mode:
authorJim Keniston <jkenisto@us.ibm.com>2009-04-15 16:02:58 -0700
committerJim Keniston <jkenisto@us.ibm.com>2009-04-15 16:02:58 -0700
commit900686f5e209099d493a15f4e36a5030dc0aa8be (patch)
tree405757c92915c516cd0ff28e217a000843573f3f /tapset/context.stp
parent2020af07c2a7f58538874ce652b52a6883f7ada0 (diff)
parent7c2136cfc88d68cfc5eb490444dc25c7dc1c0632 (diff)
downloadsystemtap-steved-900686f5e209099d493a15f4e36a5030dc0aa8be.tar.gz
systemtap-steved-900686f5e209099d493a15f4e36a5030dc0aa8be.tar.xz
systemtap-steved-900686f5e209099d493a15f4e36a5030dc0aa8be.zip
Merge branch 'master' of ssh://kenistoj@sources.redhat.com/git/systemtap
Diffstat (limited to 'tapset/context.stp')
-rw-r--r--tapset/context.stp25
1 files changed, 25 insertions, 0 deletions
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;
+%}
+