summaryrefslogtreecommitdiffstats
path: root/tapset/context-symbols.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-symbols.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-symbols.stp')
-rw-r--r--tapset/context-symbols.stp61
1 files changed, 56 insertions, 5 deletions
diff --git a/tapset/context-symbols.stp b/tapset/context-symbols.stp
index a3aae408..783f1b7b 100644
--- a/tapset/context-symbols.stp
+++ b/tapset/context-symbols.stp
@@ -66,7 +66,7 @@ function probefunc:string () %{ /* pure */
#else
((unsigned long)REG_IP(CONTEXT->regs) >= (unsigned long)PAGE_OFFSET)) {
#endif
- _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, REG_IP(CONTEXT->regs));
+ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, REG_IP(CONTEXT->regs), current, 0);
if (THIS->__retvalue[0] == '.') /* powerpc symbol has a dot*/
strlcpy(THIS->__retvalue,THIS->__retvalue + 1,MAXSTRINGLEN);
} else {
@@ -89,8 +89,59 @@ function probemod:string () %{ /* pure */
while (*ptr != '"' && --len && *ptr)
*dst++ = *ptr++;
*dst = 0;
- } else {
- /* XXX: need a PC- and symbol-table-based fallback. */
- THIS->__retvalue[0] = '\0';
- }
+ } else if (CONTEXT->regs) {
+ struct _stp_module *m;
+ m = _stp_mod_sec_lookup (REG_IP(CONTEXT->regs), current, NULL);
+ if (m && m->name)
+ strlcpy (THIS->__retvalue, m->name, MAXSTRINGLEN);
+ else
+ strlcpy (THIS->__retvalue, "<unknown>", MAXSTRINGLEN);
+ } else
+ strlcpy (THIS->__retvalue, "<unknown>", MAXSTRINGLEN);
+%}
+
+/**
+ * sfunction modname - Return the kernel module name loaded at the address.
+ * @addr: The address.
+ *
+ * Description: Returns the module name associated with the given
+ * address if known. If not known it will return the string "<unknown>".
+ * If the address was not in a kernel module, but in the kernel itself,
+ * then the string "kernel" will be returned.
+ */
+function modname:string (addr: long) %{ /* pure */
+ struct _stp_module *m;
+ m = _stp_mod_sec_lookup (THIS->addr, current, NULL);
+ if (m && m->name)
+ strlcpy (THIS->__retvalue, m->name, MAXSTRINGLEN);
+ else
+ strlcpy (THIS->__retvalue, "<unknown>", MAXSTRINGLEN);
+%}
+
+/**
+ * sfunction symname - Return the symbol associated with the given address.
+ * @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 symname:string (addr: long) %{ /* pure */
+ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr,
+ NULL, 0);
+%}
+
+/**
+ * sfunction symdata - Return the symbol and module offset for the address.
+ * @addr: The address to translate.
+ *
+ * Description: Returns the (function) symbol name associated with the
+ * given address if known, plus the module name (between brackets) and
+ * the offset inside the module, 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 symdata:string (addr: long) %{ /* pure */
+ _stp_symbol_snprint(THIS->__retvalue, MAXSTRINGLEN, THIS->addr,
+ NULL, 1);
%}