|
From: <sv...@va...> - 2007-02-16 14:10:26
|
Author: sewardj
Date: 2007-02-16 14:10:24 +0000 (Fri, 16 Feb 2007)
New Revision: 6596
Log:
Make VG_(printf) et al conform to ANSI w.r.t. capitalisation of
hex numbers: %x produces lowercase hex, and %X produces uppercase.
Unfortunately this probably changes the output in dozens of places.
Modified:
trunk/coregrind/m_debuginfo/debuginfo.c
trunk/coregrind/m_debuglog.c
Modified: trunk/coregrind/m_debuginfo/debuginfo.c
===================================================================
--- trunk/coregrind/m_debuginfo/debuginfo.c 2007-02-16 13:57:07 UTC (rev 6595)
+++ trunk/coregrind/m_debuginfo/debuginfo.c 2007-02-16 14:10:24 UTC (rev 6596)
@@ -902,7 +902,7 @@
1/10 to the file name, leaving 1/10 for all the fixed-length
stuff. */
APPEND("<frame>");
- VG_(sprintf)(ibuf,"<ip>0x%llx</ip>", (ULong)eip);
+ VG_(sprintf)(ibuf,"<ip>0x%llX</ip>", (ULong)eip);
APPEND(maybe_newline);
APPEND(ibuf);
if (know_objname) {
@@ -940,7 +940,7 @@
} else {
/* Print for humans to read */
- VG_(sprintf)(ibuf,"0x%llx: ", (ULong)eip);
+ VG_(sprintf)(ibuf,"0x%llX: ", (ULong)eip);
APPEND(ibuf);
if (know_fnname) {
APPEND(buf_fn);
Modified: trunk/coregrind/m_debuglog.c
===================================================================
--- trunk/coregrind/m_debuglog.c 2007-02-16 13:57:07 UTC (rev 6595)
+++ trunk/coregrind/m_debuglog.c 2007-02-16 14:10:24 UTC (rev 6596)
@@ -543,13 +543,14 @@
Int flags,
Int base,
Int width,
+ Bool capitalised,
ULong p )
{
HChar buf[40];
Int ind = 0;
Int i, nc = 0;
Bool neg = False;
- HChar* digits = "0123456789ABCDEF";
+ HChar* digits = capitalised ? "0123456789ABCDEF" : "0123456789abcdef";
UInt ret = 0;
if (base < 2 || base > 16)
@@ -620,7 +621,7 @@
Int flags;
Int width;
Int n_ls = 0;
- Bool is_long;
+ Bool is_long, caps;
/* We assume that vargs has already been initialised by the
caller, using va_start, and that the caller will similarly
@@ -686,33 +687,35 @@
case 'd': /* %d */
flags |= VG_MSG_SIGNED;
if (is_long)
- ret += myvprintf_int64(send, send_arg2, flags, 10, width,
+ ret += myvprintf_int64(send, send_arg2, flags, 10, width, False,
(ULong)(va_arg (vargs, Long)));
else
- ret += myvprintf_int64(send, send_arg2, flags, 10, width,
+ ret += myvprintf_int64(send, send_arg2, flags, 10, width, False,
(ULong)(va_arg (vargs, Int)));
break;
case 'u': /* %u */
if (is_long)
- ret += myvprintf_int64(send, send_arg2, flags, 10, width,
+ ret += myvprintf_int64(send, send_arg2, flags, 10, width, False,
(ULong)(va_arg (vargs, ULong)));
else
- ret += myvprintf_int64(send, send_arg2, flags, 10, width,
+ ret += myvprintf_int64(send, send_arg2, flags, 10, width, False,
(ULong)(va_arg (vargs, UInt)));
break;
case 'p': /* %p */
ret += 2;
send('0',send_arg2);
send('x',send_arg2);
- ret += myvprintf_int64(send, send_arg2, flags, 16, width,
+ ret += myvprintf_int64(send, send_arg2, flags, 16, width, True,
(ULong)((UWord)va_arg (vargs, void *)));
break;
case 'x': /* %x */
+ case 'X': /* %X */
+ caps = toBool(format[i] == 'X');
if (is_long)
- ret += myvprintf_int64(send, send_arg2, flags, 16, width,
+ ret += myvprintf_int64(send, send_arg2, flags, 16, width, caps,
(ULong)(va_arg (vargs, ULong)));
else
- ret += myvprintf_int64(send, send_arg2, flags, 16, width,
+ ret += myvprintf_int64(send, send_arg2, flags, 16, width, caps,
(ULong)(va_arg (vargs, UInt)));
break;
case 'c': /* %c */
@@ -843,9 +846,9 @@
}
(void)myvprintf_str ( add_to_buf, &buf, 0, 2, "--", False );
- (void)myvprintf_int64 ( add_to_buf, &buf, 0, 10, 1, (ULong)pid );
+ (void)myvprintf_int64 ( add_to_buf, &buf, 0, 10, 1, False, (ULong)pid );
(void)myvprintf_str ( add_to_buf, &buf, 0, 1, ":", False );
- (void)myvprintf_int64 ( add_to_buf, &buf, 0, 10, 1, (ULong)level );
+ (void)myvprintf_int64 ( add_to_buf, &buf, 0, 10, 1, False, (ULong)level );
(void)myvprintf_str ( add_to_buf, &buf, 0, 1, ":", False );
(void)myvprintf_str ( add_to_buf, &buf, 0, 8, (HChar*)modulename, False );
(void)myvprintf_str ( add_to_buf, &buf, 0, indent, "", False );
|