diff options
Diffstat (limited to 'runtime/sym.c')
-rw-r--r-- | runtime/sym.c | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/runtime/sym.c b/runtime/sym.c index 2a823ca9..1e9de765 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -1,6 +1,6 @@ /* -*- linux-c -*- * Symbolic Lookup Functions - * Copyright (C) 2005 Red Hat Inc. + * Copyright (C) 2005, 2006, 2007 Red Hat Inc. * Copyright (C) 2006 Intel Corporation. * * This file is part of systemtap, and is free software. You can @@ -142,14 +142,13 @@ static const char * _stp_kallsyms_lookup ( return NULL; } -/** Write addresses symbolically into a String - * @param str String +/** Print an address symbolically. * @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. */ -String _stp_symbol_sprint (String str, unsigned long address) +void _stp_symbol_print (unsigned long address) { char *modname; const char *name; @@ -158,36 +157,17 @@ String _stp_symbol_sprint (String str, unsigned long address) name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf); - _stp_sprintf (str, "%p", (void *)address); + _stp_printf ("%p", (void *)address); if (name) { if (modname) - _stp_sprintf (str, " : %s+%#lx/%#lx [%s]", name, offset, size, modname); + _stp_printf (" : %s+%#lx/%#lx [%s]", name, offset, size, modname); else - _stp_sprintf (str, " : %s+%#lx/%#lx", name, offset, size); + _stp_printf (" : %s+%#lx/%#lx", name, offset, size); } - return str; } - -/** Print addresses symbolically to the print 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. - */ - -#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) +void _stp_symbol_snprint (char *str, size_t len, unsigned long address) { char *modname; const char *name; @@ -195,18 +175,16 @@ const char *_stp_symbol_sprint_basic (char *str, size_t len, unsigned long addre 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, "%p", (void *)address); + name = _stp_kallsyms_lookup(address, &size, &offset, &modname, str); + if (!name) + snprintf(str, len, "%p", (void *)address); } else { - name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf); - if (name) - strlcpy(str, namebuf, len); - else - snprintf(str, len, "%p", (void *)address); + name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf); + if (name) + strlcpy(str, namebuf, len); + else + snprintf(str, len, "%p", (void *)address); } - - return str; } /** @} */ |