+2006-05-24 Josh Stone <joshua.i.stone@intel.com>
+
+ PR 2677
+ * sym.c (_stp_symbol_sprint_basic): New function that returns
+ just the symbol name, and doesn't bother with String.
+
2006-05-24 Li Guanglei <guanglei@cn.ibm.com>
* lket/b2a/Makefile.am, lket/b2a/Makefile.in,
lket/b2a/README, lket/b2a/lket_b2a.c,
/* -*- linux-c -*-
* Symbolic Lookup Functions
* Copyright (C) 2005 Red Hat Inc.
+ * Copyright (C) 2006 Intel Corporation.
*
* 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
#define _stp_symbol_print(address) _stp_symbol_sprint(_stp_stdout,address)
+
+/** Write addresses symbolically into a char buffer
+ * @param str Destination buffer
+ * @param len Length of destination buffer
+ * @param address The address to lookup.
+ * @note Symbolic lookups should not normally be done within
+ * a probe because it is too time-consuming. Use at module exit time.
+ */
+
+const char *_stp_symbol_sprint_basic (char *str, size_t len, unsigned long address)
+{
+ char *modname;
+ const char *name;
+ unsigned long offset, size;
+ char namebuf[KSYM_NAME_LEN+1];
+
+ if (len > KSYM_NAME_LEN) {
+ name = _stp_kallsyms_lookup(address, &size, &offset, &modname, str);
+ if (!name)
+ snprintf(str, len, "0x%lx", address);
+ } else {
+ name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf);
+ if (name)
+ strlcpy(str, namebuf, len);
+ else
+ snprintf(str, len, "0x%lx", address);
+ }
+
+ return str;
+}
+
/** @} */
#endif /* _SYM_C_ */
+2006-05-24 Josh Stone <joshua.i.stone@intel.com>
+
+ PR 2677
+ * context.stp (probefunc): Use _stp_symbol_sprint_basic
+
2006-05-19 Li Guanglei <guanglei@cn.ibm.com>
Patch from Mao Bibo (bibo.mao@intel.com)
// context tapset
// Copyright (C) 2005, 2006 Red Hat Inc.
+// Copyright (C) 2006 Intel Corporation.
//
// 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
%}
function probefunc:string () %{ /* pure */
- char *dst, *ptr, *start;
- String str;
- int len = MAXSTRINGLEN;
+ char *ptr, *start;
start = strstr(CONTEXT->probe_point, "function(\"");
ptr = start + 10;
start = strstr(CONTEXT->probe_point, "inline(\"");
ptr = start + 8;
}
+
if (start) {
- dst = THIS->__retvalue;
+ int len = MAXSTRINGLEN;
+ char *dst = THIS->__retvalue;
while (*ptr != '@' && --len > 0 && *ptr)
*dst++ = *ptr++;
*dst = 0;
+
} else if (CONTEXT->regs) {
- str = _stp_string_init (0);
- _stp_symbol_sprint(str, REG_IP(CONTEXT->regs));
- start = strstr(_stp_string_ptr(str), " : ");
- if (start) {
- dst = THIS->__retvalue;
- ptr = start+3;
- while (*ptr != '+' && --len > 0 && *ptr)
- *dst++ = *ptr++;
- *dst = 0;
- }
- else {
- strlcpy(THIS->__retvalue, _stp_string_ptr(str),MAXSTRINGLEN);
- }
+ _stp_symbol_sprint_basic(THIS->__retvalue, MAXSTRINGLEN,
+ REG_IP(CONTEXT->regs));
+
} else {
- THIS->__retvalue[0] = '\0';
- }
+ THIS->__retvalue[0] = '\0';
+ }
%}
function is_return:long () %{ /* pure */