summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreteo <eteo>2006-08-08 13:11:40 +0000
committereteo <eteo>2006-08-08 13:11:40 +0000
commit81d2346b1c1bd697307467851f55715d36d0892d (patch)
treef2a49ec9ae985f9f17a0554c403468cd25fa9a6c
parent228e305f94316abf45693ecb6cacbba4402aae19 (diff)
downloadsystemtap-steved-81d2346b1c1bd697307467851f55715d36d0892d.tar.gz
systemtap-steved-81d2346b1c1bd697307467851f55715d36d0892d.tar.xz
systemtap-steved-81d2346b1c1bd697307467851f55715d36d0892d.zip
2006-08-08 Eugene Teo <eteo@redhat.com>
* tapset/context.stp (probemod): New function. * stapfuncs.5.in: Document it. * testsuite/buildok/probemod.stp: Test it.
-rw-r--r--ChangeLog6
-rw-r--r--stapfuncs.5.in3
-rw-r--r--tapset/ChangeLog4
-rw-r--r--tapset/context.stp17
-rwxr-xr-xtestsuite/buildok/probemod.stp8
5 files changed, 38 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 729ae5b0..5f137027 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-08 Eugene Teo <eteo@redhat.com>
+
+ * tapset/context.stp (probemod): New function.
+ * stapfuncs.5.in: Document it.
+ * testsuite/buildok/probemod.stp: Test it.
+
2006-08-01 Li Guanglei <guanglei@cn.ibm.com>
PR 2422
* tapsets.cxx: calling get_module_dwarf(false) to give a
diff --git a/stapfuncs.5.in b/stapfuncs.5.in
index 941b451b..c95a9fad 100644
--- a/stapfuncs.5.in
+++ b/stapfuncs.5.in
@@ -158,6 +158,9 @@ including alias and wildcard expansion effects.
probefunc:string ()
Return the probe point's function name, if known.
.TP
+probemod:string ()
+Return the probe point's module name, if known.
+.TP
target:long ()
Return the pid of the target process.
.TP
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index efe52985..c7210a5e 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,3 +1,7 @@
+2006-08-08 Eugene Teo <eteo@redhat.com>
+
+ * context.stp (probemod): New function.
+
2006-07-18 Thang Nguyen <thang.p.nguyen@intel.com>
* context.stp: Modified probefunc() to print the function
diff --git a/tapset/context.stp b/tapset/context.stp
index 16b176af..7c59b0d6 100644
--- a/tapset/context.stp
+++ b/tapset/context.stp
@@ -116,6 +116,23 @@ function probefunc:string () %{ /* pure */
}
%}
+function probemod:string () %{ /* pure */
+ char *ptr, *start;
+
+ start = strstr(CONTEXT->probe_point, "module(\"");
+ ptr = start + 8;
+
+ if (start) {
+ int len = MAXSTRINGLEN;
+ char *dst = THIS->__retvalue;
+ while (*ptr != '"' && --len && *ptr)
+ *dst++ = *ptr++;
+ *dst = 0;
+ } else {
+ THIS->__retvalue[0] = '\0';
+ }
+%}
+
function is_return:long () %{ /* pure */
char *ptr = strrchr(CONTEXT->probe_point, '.');
if (ptr) {
diff --git a/testsuite/buildok/probemod.stp b/testsuite/buildok/probemod.stp
new file mode 100755
index 00000000..e8320c17
--- /dev/null
+++ b/testsuite/buildok/probemod.stp
@@ -0,0 +1,8 @@
+#! stap -p4
+#
+# Test the translatability for probemod()
+#
+probe begin
+{
+ log(probemod())
+}