From: Julian Seward Date: Fri, 16 Feb 2007 14:10:24 +0000 (+0000) Subject: Make VG_(printf) et al conform to ANSI w.r.t. capitalisation of X-Git-Tag: svn/VALGRIND_3_3_0~368 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be97b31c6cbffbbc8053f357fb2d18fae9646f4f;p=thirdparty%2Fvalgrind.git 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. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6596 --- diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index 1477efc4a2..0166d294ab 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -902,7 +902,7 @@ Char* VG_(describe_IP)(Addr eip, Char* buf, Int n_buf) 1/10 to the file name, leaving 1/10 for all the fixed-length stuff. */ APPEND(""); - VG_(sprintf)(ibuf,"0x%llx", (ULong)eip); + VG_(sprintf)(ibuf,"0x%llX", (ULong)eip); APPEND(maybe_newline); APPEND(ibuf); if (know_objname) { @@ -940,7 +940,7 @@ Char* VG_(describe_IP)(Addr eip, Char* buf, Int n_buf) } 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); diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c index a7c6fefa6e..1474389012 100644 --- a/coregrind/m_debuglog.c +++ b/coregrind/m_debuglog.c @@ -543,13 +543,14 @@ UInt myvprintf_int64 ( void(*send)(HChar,void*), 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 @@ VG_(debugLog_vprintf) ( 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 @@ VG_(debugLog_vprintf) ( 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 VG_(debugLog) ( Int level, const HChar* modulename, } (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 );