From 81d2346b1c1bd697307467851f55715d36d0892d Mon Sep 17 00:00:00 2001 From: eteo Date: Tue, 8 Aug 2006 13:11:40 +0000 Subject: 2006-08-08 Eugene Teo * tapset/context.stp (probemod): New function. * stapfuncs.5.in: Document it. * testsuite/buildok/probemod.stp: Test it. --- ChangeLog | 6 ++++++ stapfuncs.5.in | 3 +++ tapset/ChangeLog | 4 ++++ tapset/context.stp | 17 +++++++++++++++++ testsuite/buildok/probemod.stp | 8 ++++++++ 5 files changed, 38 insertions(+) create mode 100755 testsuite/buildok/probemod.stp diff --git a/ChangeLog b/ChangeLog index 729ae5b0..5f137027 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-08-08 Eugene Teo + + * tapset/context.stp (probemod): New function. + * stapfuncs.5.in: Document it. + * testsuite/buildok/probemod.stp: Test it. + 2006-08-01 Li Guanglei 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 + + * context.stp (probemod): New function. + 2006-07-18 Thang Nguyen * 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()) +} -- cgit