Eric Pouech : winedbg: Put back the %d format for printing integral values even for

Alexandre Julliard julliard at wine.codeweavers.com
Tue Sep 26 05:30:17 CDT 2006


Module: wine
Branch: master
Commit: e3f8799a4226d5a27ba92ada7e4012aaa6135258
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=e3f8799a4226d5a27ba92ada7e4012aaa6135258

Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date:   Mon Sep 25 22:45:39 2006 +0200

winedbg: Put back the %d format for printing integral values even for
64bit internal values as the default format in winebdg command imposes.

---

 programs/winedbg/memory.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c
index cab1327..cea30e9 100644
--- a/programs/winedbg/memory.c
+++ b/programs/winedbg/memory.c
@@ -299,6 +299,20 @@ #endif
     return str;
 }
 
+static void dbg_print_longlong(LONGLONG sv, BOOL is_signed)
+{
+    char      tmp[24], *ptr = tmp + sizeof(tmp) - 1;
+    ULONGLONG uv, div;
+    *ptr = '\0';
+    if (is_signed && sv < 0)    uv = -sv;
+    else                        { uv = sv; is_signed = FALSE; }
+    for (div = 10; uv; div *= 10, uv /= 10)
+        *--ptr = '0' + (uv % 10);
+    if (ptr == tmp + sizeof(tmp) - 1) *--ptr = '0';
+    if (is_signed) *--ptr = '-';
+    dbg_printf("%s", ptr);
+}
+
 static void print_typed_basic(const struct dbg_lvalue* lvalue)
 {
     LONGLONG            val_int;
@@ -326,12 +340,12 @@ static void print_typed_basic(const stru
         case btInt:
         case btLong:
             if (!be_cpu->fetch_integer(lvalue, size, TRUE, &val_int)) return;
-            dbg_printf("%s", wine_dbgstr_longlong(val_int));
+            dbg_print_longlong(val_int, TRUE);
             break;
         case btUInt:
         case btULong:
             if (!be_cpu->fetch_integer(lvalue, size, FALSE, &val_int)) return;
-            dbg_printf("%s", wine_dbgstr_longlong(val_int));
+            dbg_print_longlong(val_int, FALSE);
             break;
         case btFloat:
             if (!be_cpu->fetch_float(lvalue, size, &val_real)) return;
@@ -438,7 +452,7 @@ static void print_typed_basic(const stru
                 count -= min(count, 256);
                 fcp->Start += 256;
             }
-            if (!ok) dbg_printf("%s", wine_dbgstr_longlong(val_int));
+            if (!ok) dbg_print_longlong(val_int, TRUE);
         }
         break;
     default:




More information about the wine-cvs mailing list