This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
_stp_vsnprintf() broken
- From: Quentin Barnes <qbarnes at urbana dot css dot mot dot com>
- To: systemtap at sources dot redhat dot com
- Date: Sat, 12 May 2007 12:46:43 -0500
- Subject: _stp_vsnprintf() broken
In my ARM port, I noticed "_stp_printf("%p ", pc);" calls were
outputting trashed pointer values rotated and truncated. I tracked
the problem down to _stp_vsnprintf(). The case for 'p' was doing
a va_arg(args, int64_t). That will 'work' on 32-bit architectures
as long as they are little-endian and have the same alignment for
32-bit and 64-bit types. ARM is 32-bit and (usually) little-endian,
but has differing alignment requirements, so it broke.
Here's a trivial patch against 0505 that should fix it for all
platforms:
Index: runtime/vsprintf.c
===================================================================
--- runtime/vsprintf.c (revision 156)
+++ runtime/vsprintf.c (working copy)
@@ -319,7 +319,7 @@ int _stp_vsnprintf(char *buf, size_t siz
}
str = number(str, end,
- (unsigned long) va_arg(args, int64_t),
+ (unsigned long) va_arg(args, void *),
16, field_width, field_width, flags);
continue;