From: Michael Gilbert Date: Tue, 13 Sep 2022 00:46:21 +0000 (+0100) Subject: winedbg format strings use the wrong type on armhf X-Git-Tag: archive/raspbian/7.0_repack-10+rpi1~2^2^2^2~16 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d1d4071c67d5543a12b582b3da39370ccee77301;p=wine.git winedbg format strings use the wrong type on armhf Gbp-Pq: Topic armhf Gbp-Pq: Name format-strings.patch --- diff --git a/programs/winedbg/break.c b/programs/winedbg/break.c index 27a11a0..2e65283 100644 --- a/programs/winedbg/break.c +++ b/programs/winedbg/break.c @@ -319,7 +319,11 @@ void break_add_break_from_lineno(const char *filename, int lineno, BOOL swbp) il.SizeOfStruct = sizeof(il); if (!SymGetLineFromAddr64(dbg_curr_process->handle, linear, &disp, &il)) { +#ifdef __arm__ + dbg_printf("Unable to add breakpoint (unknown address %Ild)\n", linear); +#else dbg_printf("Unable to add breakpoint (unknown address %Ix)\n", linear); +#endif return; } filename = il.FileName; @@ -402,7 +406,11 @@ static void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write) { case 4: case 2: case 1: break; default: +#ifdef __arm__ + dbg_printf("Unsupported length (%I64lld) for watch-points, defaulting to 4\n", l); +#else dbg_printf("Unsupported length (%I64x) for watch-points, defaulting to 4\n", l); +#endif break; } } @@ -751,7 +759,11 @@ BOOL break_should_continue(ADDRESS64* addr, DWORD code) case be_xpoint_watch_write: dbg_printf("Stopped on watchpoint %d at ", dbg_curr_thread->stopped_xpoint); print_address(addr, TRUE); +#ifdef __arm__ + dbg_printf(" new value %I64lld\n", +#else dbg_printf(" new value %I64x\n", +#endif dbg_curr_process->bp[dbg_curr_thread->stopped_xpoint].w.oldval); } return FALSE; diff --git a/programs/winedbg/db_disasm64.c b/programs/winedbg/db_disasm64.c index 3c0d55e..fdc0248 100644 --- a/programs/winedbg/db_disasm64.c +++ b/programs/winedbg/db_disasm64.c @@ -1603,7 +1603,11 @@ db_disasm(db_addr_t loc, boolean_t altfmt) case Ilq: len = db_lengths[rex & REX_W ? QUAD : LONG]; get_value_inc(imm64, loc, len, FALSE); +#ifdef __arm__ + db_printf("$%I64lld", imm64); +#else db_printf("$%#I64x", imm64); +#endif break; case O: diff --git a/programs/winedbg/expr.c b/programs/winedbg/expr.c index 5d9ef30..aed60ea 100644 --- a/programs/winedbg/expr.c +++ b/programs/winedbg/expr.c @@ -661,10 +661,18 @@ BOOL expr_print(const struct expr* exp) dbg_printf("$%s", exp->un.intvar.name); break; case EXPR_TYPE_U_CONST: +#ifdef __arm__ + dbg_printf("%I64llu", exp->un.u_const.value); +#else dbg_printf("%I64u", exp->un.u_const.value); +#endif break; case EXPR_TYPE_S_CONST: +#ifdef __arm__ + dbg_printf("%I64lld", exp->un.s_const.value); +#else dbg_printf("%I64d", exp->un.s_const.value); +#endif break; case EXPR_TYPE_STRING: dbg_printf("\"%s\"", exp->un.string.str); diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c index 07b2a5a..6921720 100644 --- a/programs/winedbg/info.c +++ b/programs/winedbg/info.c @@ -168,7 +168,11 @@ struct info_modules static void module_print_info(const struct info_module *module, BOOL is_embedded) { +#ifdef __arm__ + dbg_printf("%x_%x_%I64lld-%x_%x_%I64lld\t%-16s%s\n", +#else dbg_printf("%*.*I64x-%*.*I64x\t%-16s%s\n", +#endif ADDRWIDTH, ADDRWIDTH, module->mi.BaseOfImage, ADDRWIDTH, ADDRWIDTH, module->mi.BaseOfImage + module->mi.ImageSize, is_embedded ? "\\" : get_symtype_str(&module->mi), module->name); @@ -284,7 +288,11 @@ void info_win32_module(DWORD64 base) HeapFree(GetProcessHeap(), 0, im.modules); if (base && !num_printed) +#ifdef __arm__ + dbg_printf("'%x 0x%I64lld' is not a valid module address\n", ADDRWIDTH, base); +#else dbg_printf("'0x%0*I64x' is not a valid module address\n", ADDRWIDTH, base); +#endif } struct class_walker @@ -392,7 +400,11 @@ static void info_window(HWND hWnd, int indent) if (!GetWindowTextA(hWnd, wndName, sizeof(wndName))) strcpy(wndName, "-- Empty --"); +#ifdef __arm__ + dbg_printf("%x %s %Ild %x %s %-17.17s %08x %x %Ild %08x %.14s\n", +#else dbg_printf("%*s%08Ix%*s %-17.17s %08x %0*Ix %08x %.14s\n", +#endif indent, "", (DWORD_PTR)hWnd, 12 - indent, "", clsName, GetWindowLongW(hWnd, GWL_STYLE), ADDRWIDTH, (ULONG_PTR)GetWindowLongPtrW(hWnd, GWLP_WNDPROC), @@ -434,7 +446,11 @@ void info_win32_window(HWND hWnd, BOOL detailed) /* FIXME missing fields: hmemTaskQ, hrgnUpdate, dce, flags, pProp, scroll */ dbg_printf("next=%p child=%p parent=%p owner=%p class='%s'\n" +#ifdef __arm__ + "inst=%p active=%p idmenu=%Ild\n" +#else "inst=%p active=%p idmenu=%08Ix\n" +#endif "style=0x%08x exstyle=0x%08x wndproc=%p text='%s'\n" "client=%d,%d-%d,%d window=%d,%d-%d,%d sysmenu=%p\n", GetWindow(hWnd, GW_HWNDNEXT), @@ -791,7 +807,11 @@ void info_win32_virtual(DWORD pid) type = ""; prot[0] = '\0'; } +#ifdef __arm__ + dbg_printf("%x %Ild %x %Ild %s %s %s\n", +#else dbg_printf("%0*Ix %0*Ix %s %s %s\n", +#endif ADDRWIDTH, (DWORD_PTR)addr, ADDRWIDTH, (DWORD_PTR)addr + mbi.RegionSize - 1, state, type, prot); if (addr + mbi.RegionSize < addr) /* wrap around ? */ break; @@ -893,7 +913,11 @@ void info_win32_exception(void) break; case EXCEPTION_ACCESS_VIOLATION: if (rec->NumberParameters == 2) +#ifdef __arm__ + dbg_printf("page fault on %s access to %x 0x%Ild", +#else dbg_printf("page fault on %s access to 0x%0*Ix", +#endif rec->ExceptionInformation[0] == EXCEPTION_WRITE_FAULT ? "write" : rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT ? "execute" : "read", ADDRWIDTH, rec->ExceptionInformation[1]); @@ -961,14 +985,22 @@ void info_win32_exception(void) break; case EXCEPTION_WINE_CXX_EXCEPTION: if(rec->NumberParameters == 3 && rec->ExceptionInformation[0] == EXCEPTION_WINE_CXX_FRAME_MAGIC) +#ifdef __arm__ + dbg_printf("C++ exception(object = %x 0x%Ild, type = %x 0x%Ild)", +#else dbg_printf("C++ exception(object = 0x%0*Ix, type = 0x%0*Ix)", +#endif 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 +#ifdef __arm__ + dbg_printf("C++ exception with strange parameter count %d or magic %x 0x%0Ild", +#else dbg_printf("C++ exception with strange parameter count %d or magic 0x%0*Ix", +#endif rec->NumberParameters, ADDRWIDTH, rec->ExceptionInformation[0]); break; default: diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index 0c8e1ee..41894eb 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -250,11 +250,19 @@ void memory_examine(const struct dbg_lvalue *lvalue, int count, char format) case 'a': if (sizeof(DWORD_PTR) == 4) { +#ifdef __arm__ + DO_DUMP(DWORD_PTR, 4, " %Ild"); +#else DO_DUMP(DWORD_PTR, 4, " %8.8Ix"); +#endif } else { +#ifdef __arm__ + DO_DUMP(DWORD_PTR, 2, " %Ild"); +#else DO_DUMP(DWORD_PTR, 2, " %16.16Ix"); +#endif } break; case 'c': DO_DUMP2(char, 32, " %c", (_v < 0x20) ? ' ' : _v); break; @@ -460,7 +468,11 @@ char* memory_offset_to_string(char *str, DWORD64 offset, unsigned mode) static void dbg_print_sdecimal(dbg_lgint_t sv) { +#ifdef __arm__ + dbg_printf("%I64lld", sv); +#else dbg_printf("%I64d", sv); +#endif } static void dbg_print_hex(DWORD size, dbg_lgint_t sv) @@ -469,7 +481,11 @@ static void dbg_print_hex(DWORD size, dbg_lgint_t sv) dbg_printf("0"); else /* clear unneeded high bits, esp. sign extension */ +#ifdef __arm__ + dbg_printf("%I64lld", sv & (~(dbg_lguint_t)0 >> (8 * (sizeof(dbg_lgint_t) - size)))); +#else dbg_printf("%#I64x", sv & (~(dbg_lguint_t)0 >> (8 * (sizeof(dbg_lgint_t) - size)))); +#endif } static void print_typed_basic(const struct dbg_lvalue* lvalue) @@ -723,7 +739,11 @@ void print_address(const ADDRESS64* addr, BOOLEAN with_line) if (SymFromAddr(dbg_curr_process->handle, lin, &disp64, si) && disp64 < si->Size) { dbg_printf(" %s", si->Name); +#ifdef __arm__ + if (disp64) dbg_printf("+0x%I64lld", disp64); +#else if (disp64) dbg_printf("+0x%I64x", disp64); +#endif } else { @@ -731,7 +751,11 @@ void print_address(const ADDRESS64* addr, BOOLEAN with_line) if (!SymGetModuleInfo(dbg_curr_process->handle, lin, &im)) return; dbg_printf(" %s", im.ModuleName); if (lin > im.BaseOfImage) +#ifdef __arm__ + dbg_printf("+0x%Ild", lin - im.BaseOfImage); +#else dbg_printf("+0x%Ix", lin - im.BaseOfImage); +#endif } if (with_line) { diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index c8352d8..50bef28 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -276,7 +276,11 @@ static void stack_print_addr_and_args(void) DWORD disp; dbg_printf(" %s", si->Name); +#ifdef __arm__ + if (disp64) dbg_printf("+0x%I64lld", disp64); +#else if (disp64) dbg_printf("+0x%I64x", disp64); +#endif stack_set_local_scope(); se.first = TRUE; @@ -291,7 +295,11 @@ static void stack_print_addr_and_args(void) dbg_printf(" [%s:%u]", il.FileName, il.LineNumber); dbg_printf(" in %s", im.ModuleName); } +#ifdef __arm__ + else dbg_printf(" in %s (+0x%Ild)", im.ModuleName, frm->linear_pc - im.BaseOfImage); +#else else dbg_printf(" in %s (+0x%Ix)", im.ModuleName, frm->linear_pc - im.BaseOfImage); +#endif } /****************************************************************** diff --git a/programs/winedbg/symbol.c b/programs/winedbg/symbol.c index 08e0317..9d0df52 100644 --- a/programs/winedbg/symbol.c +++ b/programs/winedbg/symbol.c @@ -749,7 +749,11 @@ BOOL symbol_info_locals(void) addr.Mode = AddrModeFlat; addr.Offset = frm->linear_pc; print_address(&addr, FALSE); +#ifdef __arm__ + dbg_printf(": %x (%Ild)\n", ADDRWIDTH, frm->linear_frame); +#else dbg_printf(": (%0*Ix)\n", ADDRWIDTH, frm->linear_frame); +#endif SymEnumSymbols(dbg_curr_process->handle, 0, NULL, info_locals_cb, (void*)frm->linear_frame); return TRUE; @@ -771,7 +775,11 @@ static BOOL CALLBACK symbols_info_cb(PSYMBOL_INFO sym, ULONG size, PVOID ctx) mi.ModuleName[len - 5] = '\0'; } +#ifdef __arm__ + dbg_printf("%x %I64lld: %s!%s", ADDRWIDTH, sym->Address, mi.ModuleName, sym->Name); +#else dbg_printf("%0*I64x: %s!%s", ADDRWIDTH, sym->Address, mi.ModuleName, sym->Name); +#endif type.id = sym->TypeIndex; type.module = sym->ModBase; diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 1383f02..1d3995e 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -555,7 +555,11 @@ 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; +#ifdef __arm__ + dbg_printf("Mod: %x %Ild ID: %08x\n", ADDRWIDTH, type.module, type.id); +#else dbg_printf("Mod: %0*Ix ID: %08x\n", ADDRWIDTH, type.module, type.id); +#endif types_print_type(&type, TRUE); dbg_printf("\n"); return TRUE;