Eric Pouech : winedbg: Use proper width when printing addresses with leading 0.

Alexandre Julliard julliard at winehq.org
Tue Oct 12 16:12:49 CDT 2021


Module: wine
Branch: master
Commit: 01ddc2f8e4e9e11655d6752b829316c033298abb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=01ddc2f8e4e9e11655d6752b829316c033298abb

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Tue Oct 12 18:11:04 2021 +0200

winedbg: Use proper width when printing addresses with leading 0.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/winedbg/info.c   | 16 ++++++++--------
 programs/winedbg/symbol.c |  4 ++--
 programs/winedbg/types.c  |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c
index 477438d83e3..b7f45086c5c 100644
--- a/programs/winedbg/info.c
+++ b/programs/winedbg/info.c
@@ -791,8 +791,8 @@ void info_win32_virtual(DWORD pid)
             type = "";
             prot[0] = '\0';
         }
-        dbg_printf("%08lx %08lx %s %s %s\n",
-                   (DWORD_PTR)addr, (DWORD_PTR)addr + mbi.RegionSize - 1, state, type, prot);
+        dbg_printf("%0*lx %0*lx %s %s %s\n",
+                   ADDRWIDTH, (DWORD_PTR)addr, ADDRWIDTH, (DWORD_PTR)addr + mbi.RegionSize - 1, state, type, prot);
         if (addr + mbi.RegionSize < addr) /* wrap around ? */
             break;
         addr += mbi.RegionSize;
@@ -893,10 +893,10 @@ void info_win32_exception(void)
         break;
     case EXCEPTION_ACCESS_VIOLATION:
         if (rec->NumberParameters == 2)
-            dbg_printf("page fault on %s access to 0x%08lx",
+            dbg_printf("page fault on %s access to 0x%0*lx",
                        rec->ExceptionInformation[0] == EXCEPTION_WRITE_FAULT ? "write" :
                        rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT ? "execute" : "read",
-                       rec->ExceptionInformation[1]);
+                       ADDRWIDTH, rec->ExceptionInformation[1]);
         else
             dbg_printf("page fault");
         break;
@@ -961,15 +961,15 @@ void info_win32_exception(void)
         break;
     case EXCEPTION_WINE_CXX_EXCEPTION:
         if(rec->NumberParameters == 3 && rec->ExceptionInformation[0] == EXCEPTION_WINE_CXX_FRAME_MAGIC)
-            dbg_printf("C++ exception(object = 0x%08lx, type = 0x%08lx)",
-                       rec->ExceptionInformation[1], rec->ExceptionInformation[2]);
+            dbg_printf("C++ exception(object = 0x%0*lx, type = 0x%0*lx)",
+                       ADDRWIDTH, rec->ExceptionInformation[1], ADDRWIDTH, rec->ExceptionInformation[2]);
         else if(rec->NumberParameters == 4 && rec->ExceptionInformation[0] == EXCEPTION_WINE_CXX_FRAME_MAGIC)
             dbg_printf("C++ exception(object = %p, type = %p, base = %p)",
                        (void*)rec->ExceptionInformation[1], (void*)rec->ExceptionInformation[2],
                        (void*)rec->ExceptionInformation[3]);
         else
-            dbg_printf("C++ exception with strange parameter count %d or magic 0x%08lx",
-                       rec->NumberParameters, rec->ExceptionInformation[0]);
+            dbg_printf("C++ exception with strange parameter count %d or magic 0x%0*lx",
+                       rec->NumberParameters, ADDRWIDTH, rec->ExceptionInformation[0]);
         break;
     default:
         dbg_printf("0x%08x", rec->ExceptionCode);
diff --git a/programs/winedbg/symbol.c b/programs/winedbg/symbol.c
index b0ef59e49f0..7067b886f44 100644
--- a/programs/winedbg/symbol.c
+++ b/programs/winedbg/symbol.c
@@ -755,7 +755,7 @@ BOOL symbol_info_locals(void)
     addr.Mode = AddrModeFlat;
     addr.Offset = ihsf.InstructionOffset;
     print_address(&addr, FALSE);
-    dbg_printf(": (%08lx)\n", (DWORD_PTR)ihsf.FrameOffset);
+    dbg_printf(": (%0*lx)\n", ADDRWIDTH, (DWORD_PTR)ihsf.FrameOffset);
     SymEnumSymbols(dbg_curr_process->handle, 0, NULL, info_locals_cb, (void*)(DWORD_PTR)ihsf.FrameOffset);
 
     return TRUE;
@@ -778,7 +778,7 @@ static BOOL CALLBACK symbols_info_cb(PSYMBOL_INFO sym, ULONG size, PVOID ctx)
             mi.ModuleName[len - 5] = '\0';
     }
 
-    dbg_printf("%08lx: %s!%s", (ULONG_PTR)sym->Address, mi.ModuleName, sym->Name);
+    dbg_printf("%0*lx: %s!%s", ADDRWIDTH, (ULONG_PTR)sym->Address, mi.ModuleName, sym->Name);
     type.id = sym->TypeIndex;
     type.module = sym->ModBase;
 
diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c
index 1fd40932557..5751ce095cc 100644
--- a/programs/winedbg/types.c
+++ b/programs/winedbg/types.c
@@ -571,7 +571,7 @@ static BOOL CALLBACK print_types_cb(PSYMBOL_INFO sym, ULONG size, void* ctx)
     struct dbg_type     type;
     type.module = sym->ModBase;
     type.id = sym->TypeIndex;
-    dbg_printf("Mod: %08lx ID: %08x\n", type.module, type.id);
+    dbg_printf("Mod: %0*lx ID: %08x\n", ADDRWIDTH, type.module, type.id);
     types_print_type(&type, TRUE);
     dbg_printf("\n");
     return TRUE;




More information about the wine-cvs mailing list