summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-04-07 12:25:53 +0200
committerMark Wielaard <mjw@redhat.com>2009-04-07 15:32:35 +0200
commitfc204b30292a3a5f1aa602171dc44d937cb2c20f (patch)
treecae1b41502dbd5e9c659c5f88c6599e9d7acf978
parent782040b3f07a908790c074d94c6253c9966c18b2 (diff)
downloadsystemtap-steved-fc204b30292a3a5f1aa602171dc44d937cb2c20f.tar.gz
systemtap-steved-fc204b30292a3a5f1aa602171dc44d937cb2c20f.tar.xz
systemtap-steved-fc204b30292a3a5f1aa602171dc44d937cb2c20f.zip
Create usymname and usymdata variant that trigger STP_NEED_VMA_TRACKER.
* tapset/context-symbols.stp (syname, symdata): Pass NULL for kernel address. * tapset/ucontext-symbols.stp: New file defining usymname and usymdata. * testsuite/systemtap.context/usymbols.exp: Use usymname, remove STP_NEED_VMA_TRACKER hack. * testsuite/buildok/usymdata.stp: New test. * testsuite/buildok/usymname.stp: Likewise.
-rw-r--r--tapset/context-symbols.stp4
-rw-r--r--tapset/ucontext-symbols.stp52
-rwxr-xr-xtestsuite/buildok/usymdata.stp8
-rwxr-xr-xtestsuite/buildok/usymname.stp8
-rw-r--r--testsuite/systemtap.context/usymbols.exp5
5 files changed, 72 insertions, 5 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/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);
+%}
diff --git a/testsuite/buildok/usymdata.stp b/testsuite/buildok/usymdata.stp
new file mode 100755
index 00000000..48c1f36f
--- /dev/null
+++ b/testsuite/buildok/usymdata.stp
@@ -0,0 +1,8 @@
+#! stap -p4
+#
+# Test the translatability for usymdata()
+#
+probe begin
+{
+ log(usymdata(0))
+}
diff --git a/testsuite/buildok/usymname.stp b/testsuite/buildok/usymname.stp
new file mode 100755
index 00000000..57e3f9c2
--- /dev/null
+++ b/testsuite/buildok/usymname.stp
@@ -0,0 +1,8 @@
+#! stap -p4
+#
+# Test the translatability for usymname()
+#
+probe begin
+{
+ log(usymname(0))
+}
diff --git a/testsuite/systemtap.context/usymbols.exp b/testsuite/systemtap.context/usymbols.exp
index 8af20126..39b3b442 100644
--- a/testsuite/systemtap.context/usymbols.exp
+++ b/testsuite/systemtap.context/usymbols.exp
@@ -35,7 +35,7 @@ set testscript {
probe syscall.rt_sigaction {
if (pid() == target() && execname() == "%s") {
handler = $act->sa_handler;
- printf("handler: %%s\n", symname(handler));
+ printf("handler: %%s\n", usymname(handler));
}
}
/* track through uprobes, so as to make sure we have the symbols */
@@ -56,8 +56,7 @@ if {[string equal "link" [file type $libpath]]} {
}
send_log "libpath: $libpath\n"
-# XXX Cheat, explicitly add STP_NEED_VMA_TRACKER
-set cmd [concat stap -DSTP_NEED_VMA_TRACKER -d $libpath -d $testexe -c $testexe -e {$script}]
+set cmd [concat stap -d $libpath -d $testexe -c $testexe -e {$script}]
send_log "cmd: $cmd\n"
catch {eval exec $cmd} res
send_log "cmd output: $res\n"