From abedf3db3774b54ee4ed227e3ae69e55fb0ff76c Mon Sep 17 00:00:00 2001 From: hunt Date: Thu, 26 May 2005 07:43:25 +0000 Subject: 2005-05-26 Martin Hunt * current.c (_stp_sprint_regs): Implement for i386. * sym.c (_stp_symbol_sprint): Check name before trying to print it. (_stp_symbol_print): Change to macro that calls _stp_symbol_sprint(). --- runtime/sym.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'runtime/sym.c') diff --git a/runtime/sym.c b/runtime/sym.c index 1eec0d1d..a1c04a65 100644 --- a/runtime/sym.c +++ b/runtime/sym.c @@ -36,11 +36,15 @@ String _stp_symbol_sprint (String str, unsigned long address) name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf); - _stp_sprintf (str, "0x%lx : ", address); - if (modname) - _stp_sprintf (str, "%s+%#lx/%#lx [%s]", name, offset, size, modname); - else - _stp_sprintf (str, "%s+%#lx/%#lx", name, offset, size); + _stp_sprintf (str, "0x%lx", address); + + if (name) { + if (modname) + _stp_sprintf (str, " : %s+%#lx/%#lx [%s]", name, offset, size, modname); + else + _stp_sprintf (str, " : %s+%#lx/%#lx", name, offset, size); + } + return str; } @@ -51,21 +55,7 @@ String _stp_symbol_sprint (String str, unsigned long address) * a probe because it is too time-consuming. Use at module exit time. */ -void _stp_symbol_print (unsigned long address) -{ - char *modname; - const char *name; - unsigned long offset, size; - char namebuf[KSYM_NAME_LEN+1]; - - name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf); - - _stp_printf ("0x%lx : ", address); - if (modname) - _stp_printf ("%s+%#lx/%#lx [%s]", name, offset, size, modname); - else - _stp_printf ("%s+%#lx/%#lx", name, offset, size); -} +#define _stp_symbol_print(address) _stp_symbol_sprint(_stp_stdout,address) /** @} */ #endif /* _SYM_C_ */ -- cgit