This serie fixes a couple of bugs in 64bit instance of winedbg handling a 64 bit target.
The third one is mostly cosmetic (don't print 16 digits for 32 bit addresses).
A+ ---
Eric Pouech (3): programs/winedbg: correctly read register values dlls/dbghelp: correctly promote to 64bit register relative offsets programs/winedbg: rework printing of pointer values
dlls/dbghelp/symbol.c | 2 +- programs/winedbg/be_i386.c | 8 +++--- programs/winedbg/be_x86_64.c | 9 ++++--- programs/winedbg/break.c | 14 +++++----- programs/winedbg/debugger.h | 6 ++--- programs/winedbg/gdbproxy.c | 9 ++++--- programs/winedbg/info.c | 17 ++++++------ programs/winedbg/memory.c | 49 +++++++---------------------------- programs/winedbg/stack.c | 11 ++++---- programs/winedbg/symbol.c | 10 +++---- programs/winedbg/tgt_active.c | 41 +++++++++++++++-------------- programs/winedbg/winedbg.c | 3 ++- 12 files changed, 78 insertions(+), 101 deletions(-)
(was incorrectly reading all registers as debugger's DWORD_PTR)
this is mainly needed: - for a 64bit debugger attached to a 32bit debuggee - when register is of different size than machine word
(regressions introduced in wine-7.0-rc1)
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/debugger.h | 4 ++-- programs/winedbg/memory.c | 4 ++-- programs/winedbg/stack.c | 11 ++++++----- programs/winedbg/symbol.c | 10 +++------- 4 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index 0cc2f8b7a6c..2ea1dc5a25f 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -404,7 +404,7 @@ extern BOOL memory_get_current_pc(ADDRESS64* address); extern BOOL memory_get_current_stack(ADDRESS64* address); extern BOOL memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee, BOOL unicode, char* buffer, int size); extern BOOL memory_get_string_indirect(struct dbg_process* pcs, void* addr, BOOL unicode, WCHAR* buffer, int size); -extern BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len); +extern BOOL memory_get_register(DWORD regno, struct dbg_lvalue* value, char* buffer, int len); extern void memory_disassemble(const struct dbg_lvalue*, const struct dbg_lvalue*, int instruction_count); extern BOOL memory_disasm_one_insn(ADDRESS64* addr); #define MAX_OFFSET_TO_STR_LEN 19 @@ -425,7 +425,7 @@ extern void source_free_files(struct dbg_process* p); extern void stack_info(int len); extern void stack_backtrace(DWORD threadID); extern BOOL stack_set_frame(int newframe); -extern BOOL stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pval); +extern BOOL stack_get_register_frame(const struct dbg_internal_var* div, struct dbg_lvalue* lvalue); extern unsigned stack_fetch_frames(const dbg_ctx_t *ctx); extern BOOL stack_get_current_symbol(SYMBOL_INFO* sym); static inline struct dbg_frame* diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index faa5ac9ddcb..d0698bff5a9 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -788,7 +788,7 @@ void memory_disassemble(const struct dbg_lvalue* xstart, memory_disasm_one_insn(&last); }
-BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len) +BOOL memory_get_register(DWORD regno, struct dbg_lvalue* lvalue, char* buffer, int len) { const struct dbg_internal_var* div;
@@ -818,7 +818,7 @@ BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len) { if (div->val == regno) { - if (!stack_get_register_frame(div, value)) + if (!stack_get_register_frame(div, lvalue)) { if (buffer) snprintf(buffer, len, "<register %s not accessible in this frame>", div->name); return FALSE; diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index 5d3504f1057..f395fd3d480 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -98,12 +98,13 @@ static BOOL stack_set_frame_internal(int newframe) return TRUE; }
-BOOL stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pval) +BOOL stack_get_register_frame(const struct dbg_internal_var* div, struct dbg_lvalue* lvalue) { struct dbg_frame* currfrm = stack_get_curr_frame(); if (currfrm == NULL) return FALSE; if (currfrm->is_ctx_valid) - *pval = (DWORD_PTR*)((char*)&currfrm->context + (DWORD_PTR)div->pval); + init_lvalue_in_debugger(lvalue, div->typeid, + (char*)&currfrm->context + (DWORD_PTR)div->pval); else { enum be_cpu_addr kind; @@ -114,13 +115,13 @@ BOOL stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pv switch (kind) { case be_cpu_addr_pc: - *pval = &currfrm->linear_pc; + init_lvalue_in_debugger(lvalue, dbg_itype_unsigned_long_int, &currfrm->linear_pc); break; case be_cpu_addr_stack: - *pval = &currfrm->linear_stack; + init_lvalue_in_debugger(lvalue, dbg_itype_unsigned_long_int, &currfrm->linear_stack); break; case be_cpu_addr_frame: - *pval = &currfrm->linear_frame; + init_lvalue_in_debugger(lvalue, dbg_itype_unsigned_long_int, &currfrm->linear_frame); break; } } diff --git a/programs/winedbg/symbol.c b/programs/winedbg/symbol.c index 9cbfc8b77de..4c4486ce5d8 100644 --- a/programs/winedbg/symbol.c +++ b/programs/winedbg/symbol.c @@ -67,24 +67,20 @@ static BOOL fill_sym_lvalue(const SYMBOL_INFO* sym, ULONG_PTR base, if (buffer) buffer[0] = '\0'; if (sym->Flags & SYMFLAG_REGISTER) { - DWORD_PTR* pval; - - if (!memory_get_register(sym->Register, &pval, buffer, sz)) + if (!memory_get_register(sym->Register, lvalue, buffer, sz)) return FALSE; - init_lvalue(lvalue, FALSE, pval); } else if (sym->Flags & SYMFLAG_REGREL) { - DWORD_PTR* pval; size_t l;
*buffer++ = '['; sz--; - if (!memory_get_register(sym->Register, &pval, buffer, sz)) + if (!memory_get_register(sym->Register, lvalue, buffer, sz)) return FALSE; l = strlen(buffer); sz -= l; buffer += l; - init_lvalue(lvalue, TRUE, (void*)(DWORD_PTR)(*pval + sym->Address)); + init_lvalue(lvalue, TRUE, (void*)(DWORD_PTR)(types_extract_as_integer(lvalue) + sym->Address)); if ((LONG64)sym->Address >= 0) snprintf(buffer, sz, "+%I64d]", sym->Address); else
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/symbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 49172701405..14d08078407 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -792,7 +792,7 @@ static void symt_fill_sym_info(struct module_pair* pair, sym_info->Register = loc.reg; if (loc.reg == CV_REG_NONE || (int)loc.reg < 0 /* error */) FIXME("suspicious register value %x\n", loc.reg); - sym_info->Address = loc.offset; + sym_info->Address = (LONG64)(LONG_PTR)loc.offset; break; case loc_absolute: sym_info->Flags |= SYMFLAG_VALUEPRESENT;
mainly, no longer using %p to print pointer values as %p represents debugger's pointer size but we do want debuggee's pointer size instead
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/be_i386.c | 8 +++++-- programs/winedbg/be_x86_64.c | 9 +++++--- programs/winedbg/break.c | 14 +++++-------- programs/winedbg/debugger.h | 2 -- programs/winedbg/gdbproxy.c | 9 +++++--- programs/winedbg/info.c | 17 ++++++++------- programs/winedbg/memory.c | 45 +++++++---------------------------------- programs/winedbg/tgt_active.c | 41 ++++++++++++++++++++----------------- programs/winedbg/winedbg.c | 3 ++- 9 files changed, 64 insertions(+), 84 deletions(-)
diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c index ab86f9ec647..840339b250d 100644 --- a/programs/winedbg/be_i386.c +++ b/programs/winedbg/be_i386.c @@ -507,7 +507,8 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee) /* FIXME: we only support the 32 bit far calls for now */ if (operand_size != 32) { - WINE_FIXME("Unsupported yet call insn (0xFF 0x%02x) with 16 bit operand-size at %p\n", ch, insn); + WINE_FIXME("Unsupported yet call insn (0xFF 0x%02x) with 16 bit operand-size at %#.*Ix\n", + ch, ADDRSIZE, (DWORD_PTR)insn); return FALSE; } switch (ch & 0xC7) /* keep Mod R/M only (skip reg) */ @@ -515,7 +516,8 @@ static BOOL be_i386_is_func_call(const void* insn, ADDRESS64* callee) case 0x04: case 0x44: case 0x84: - WINE_FIXME("Unsupported yet call insn (0xFF 0x%02x) (SIB bytes) at %p\n", ch, insn); + WINE_FIXME("Unsupported yet call insn (0xFF 0x%02x) (SIB bytes) at %#.*Ix\n", + ch, ADDRSIZE, (DWORD_PTR)insn); return FALSE; case 0x05: /* addr32 */ if ((ch & 0x38) == 0x10 || /* call */ @@ -739,7 +741,7 @@ static BOOL be_i386_remove_Xpoint(HANDLE hProcess, const struct be_process_io* p if (size != 0) return FALSE; if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return FALSE; if (ch != (unsigned char)0xCC) - WINE_FIXME("Cannot get back %02x instead of 0xCC at %p\n", ch, addr); + WINE_FIXME("Cannot get back %02x instead of 0xCC at %#.*Ix\n", ch, ADDRSIZE, (DWORD_PTR)addr); ch = (unsigned char)val; if (!pio->write(hProcess, addr, &ch, 1, &sz) || sz != 1) return FALSE; break; diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c index a01bbf86575..0fb77d0c940 100644 --- a/programs/winedbg/be_x86_64.c +++ b/programs/winedbg/be_x86_64.c @@ -502,7 +502,8 @@ static BOOL be_x86_64_is_func_call(const void* insn, ADDRESS64* callee) callee->Offset = dst; return TRUE; } - WINE_FIXME("Unsupported yet call insn (0xFF 0x%02x) at %p\n", ch, insn); + WINE_FIXME("Unsupported yet call insn (0xFF 0x%02x) at %#.*Ix\n", + ch, ADDRSIZE, (DWORD_PTR)insn); return FALSE; default: switch (f_rm(ch)) @@ -526,7 +527,8 @@ static BOOL be_x86_64_is_func_call(const void* insn, ADDRESS64* callee) return TRUE; } else - WINE_FIXME("Unsupported yet call insn (rex=0x%02x 0xFF 0x%02x) at %p\n", rex, ch, insn); + WINE_FIXME("Unsupported yet call insn (rex=0x%02x 0xFF 0x%02x) at %#.*Ix\n", + rex, ch, ADDRSIZE, (DWORD_PTR)insn); return FALSE;
default: @@ -661,7 +663,8 @@ static BOOL be_x86_64_remove_Xpoint(HANDLE hProcess, const struct be_process_io* if (size != 0) return FALSE; if (!pio->read(hProcess, addr, &ch, 1, &sz) || sz != 1) return FALSE; if (ch != (unsigned char)0xCC) - WINE_FIXME("Cannot get back %02x instead of 0xCC at %p\n", ch, addr); + WINE_FIXME("Cannot get back %02x instead of 0xCC at %#.*Ix\n", + ch, ADDRSIZE, (DWORD_PTR)addr); ch = (unsigned char)val; if (!pio->write(hProcess, addr, &ch, 1, &sz) || sz != 1) return FALSE; break; diff --git a/programs/winedbg/break.c b/programs/winedbg/break.c index 27a11a00d33..09bdea8ed40 100644 --- a/programs/winedbg/break.c +++ b/programs/winedbg/break.c @@ -348,7 +348,6 @@ void break_check_delayed_bp(void) struct dbg_lvalue lvalue; int i; struct dbg_delayed_bp* dbp = dbg_curr_process->delayed_bp; - char hexbuf[MAX_OFFSET_TO_STR_LEN];
for (i = 0; i < dbg_curr_process->num_delayed_bp; i++) { @@ -363,9 +362,8 @@ void break_check_delayed_bp(void) lvalue.addr = dbp[i].u.addr; WINE_TRACE("trying to add delayed %s-bp\n", dbp[i].is_symbol ? "S" : "A"); if (!dbp[i].is_symbol) - WINE_TRACE("\t%04x:%s\n", - dbp[i].u.addr.Segment, - memory_offset_to_string(hexbuf, dbp[i].u.addr.Offset, 0)); + WINE_TRACE("\t%04x:%#.*I64x\n", + dbp[i].u.addr.Segment, ADDRSIZE, dbp[i].u.addr.Offset); else WINE_TRACE("\t'%s' @ %d\n", dbp[i].u.symbol.name, dbp[i].u.symbol.lineno); @@ -908,15 +906,15 @@ void break_restart_execution(int count) if ((mode == EXEC_STEP_OVER || mode == EXEC_STEPI_OVER) && status == dbg_in_a_thunk) { - WINE_WARN("Not stepping into trampoline at %p (no lines)\n", - memory_to_linear_addr(&callee)); + WINE_WARN("Not stepping into trampoline at %#.*Ix (no lines)\n", + ADDRSIZE, (DWORD_PTR)memory_to_linear_addr(&callee)); mode = EXEC_STEP_OVER_TRAMPOLINE; } #endif if (mode == dbg_exec_step_into_line && status == dbg_no_line_info) { - WINE_WARN("Not stepping into function at %p (no lines)\n", - memory_to_linear_addr(&callee)); + WINE_WARN("Not stepping into function at %#.*Ix (no lines)\n", + ADDRSIZE, (DWORD_PTR)memory_to_linear_addr(&callee)); mode = dbg_exec_step_over_line; } } diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index 2ea1dc5a25f..f40cacf2b56 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -407,8 +407,6 @@ extern BOOL memory_get_string_indirect(struct dbg_process* pcs, void extern BOOL memory_get_register(DWORD regno, struct dbg_lvalue* value, char* buffer, int len); extern void memory_disassemble(const struct dbg_lvalue*, const struct dbg_lvalue*, int instruction_count); extern BOOL memory_disasm_one_insn(ADDRESS64* addr); -#define MAX_OFFSET_TO_STR_LEN 19 -extern char* memory_offset_to_string(char *str, DWORD64 offset, unsigned mode); extern void print_bare_address(const ADDRESS64* addr); extern void print_address(const ADDRESS64* addr, BOOLEAN with_line); extern void print_basic(const struct dbg_lvalue* value, char format); diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index e7f9ddaf226..38485a155d1 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -126,7 +126,8 @@ static void gdbctx_delete_xpoint(struct gdb_context *gdbctx, struct dbg_thread * struct backend_cpu *cpu = process->be_cpu;
if (!cpu->remove_Xpoint(process->handle, process->process_io, ctx, x->type, x->addr, x->value, x->size)) - ERR("%04lx:%04lx: Couldn't remove breakpoint at:%p/%x type:%d\n", process->pid, thread ? thread->tid : ~0, x->addr, x->size, x->type); + ERR("%04lx:%04lx: Couldn't remove breakpoint at:%#.*Ix/%x type:%d\n", + process->pid, thread ? thread->tid : ~0, ADDRSIZE, (DWORD_PTR)x->addr, x->size, x->type);
list_remove(&x->entry); HeapFree(GetProcessHeap(), 0, x); @@ -142,13 +143,15 @@ static void gdbctx_insert_xpoint(struct gdb_context *gdbctx, struct dbg_thread *
if (!cpu->insert_Xpoint(process->handle, process->process_io, ctx, type, addr, &value, size)) { - ERR("%04lx:%04lx: Couldn't insert breakpoint at:%p/%x type:%d\n", process->pid, thread->tid, addr, size, type); + ERR("%04lx:%04lx: Couldn't insert breakpoint at:%#.*Ix/%x type:%d\n", + process->pid, thread->tid, ADDRSIZE, (DWORD_PTR)addr, size, type); return; }
if (!(x = HeapAlloc(GetProcessHeap(), 0, sizeof(struct gdb_xpoint)))) { - ERR("%04lx:%04lx: Couldn't allocate memory for breakpoint at:%p/%x type:%d\n", process->pid, thread->tid, addr, size, type); + ERR("%04lx:%04lx: Couldn't allocate memory for breakpoint at:%#.*Ix/%x type:%d\n", + process->pid, thread->tid, ADDRSIZE, (DWORD_PTR)addr, size, type); return; }
diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c index 3ac00df911d..04b56fc6a77 100644 --- a/programs/winedbg/info.c +++ b/programs/winedbg/info.c @@ -677,13 +677,14 @@ void info_win32_frame_exceptions(DWORD tid) { EXCEPTION_REGISTRATION_RECORD frame;
- dbg_printf("%p: ", next_frame); + dbg_printf("%#.*Ix: ", ADDRSIZE, (DWORD_PTR)next_frame); if (!dbg_read_memory(next_frame, &frame, sizeof(frame))) { dbg_printf("Invalid frame address\n"); break; } - dbg_printf("prev=%p handler=%p\n", frame.Prev, frame.Handler); + dbg_printf("prev=%#.*Ix handler=%#.*Ix\n", + ADDRSIZE, (DWORD_PTR)frame.Prev, ADDRSIZE, (DWORD_PTR)frame.Handler); next_frame = frame.Prev; }
@@ -852,7 +853,6 @@ void info_win32_exception(void) { const EXCEPTION_RECORD* rec; ADDRESS64 addr; - char hexbuf[MAX_OFFSET_TO_STR_LEN];
if (!dbg_curr_thread->in_exception) { @@ -964,9 +964,10 @@ void info_win32_exception(void) dbg_printf("C++ exception(object = 0x%0*Ix, type = 0x%0*Ix)", 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]); + dbg_printf("C++ exception(object = %#.*Ix, type = %#.*Ix base = %#.*Ix)", + ADDRSIZE, rec->ExceptionInformation[1], + ADDRSIZE, rec->ExceptionInformation[2], + ADDRSIZE, rec->ExceptionInformation[3]); else dbg_printf("C++ exception with strange parameter count %ld or magic 0x%0*Ix", rec->NumberParameters, ADDRWIDTH, rec->ExceptionInformation[0]); @@ -981,9 +982,9 @@ void info_win32_exception(void) switch (addr.Mode) { case AddrModeFlat: - dbg_printf(" in %ld-bit code (%s)", + dbg_printf(" in %ld-bit code (%#.*I64x)", dbg_curr_process->be_cpu->pointer_size * 8, - memory_offset_to_string(hexbuf, addr.Offset, 0)); + ADDRSIZE, addr.Offset); break; case AddrModeReal: dbg_printf(" in vm86 code (%04x:%04x)", addr.Segment, (unsigned) addr.Offset); diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index d0698bff5a9..59c98e4b5fb 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -432,32 +432,6 @@ BOOL memory_get_string_indirect(struct dbg_process* pcs, void* addr, BOOL unicod return FALSE; }
-/* - * Convert an address offset to hex string. If mode == 32, treat offset as - * 32 bits (discard upper 32 bits), if mode == 64 use all 64 bits, if mode == 0 - * treat as either 32 or 64 bits, depending on whether we're running as - * Wine32 or Wine64. - */ -char* memory_offset_to_string(char *str, DWORD64 offset, unsigned mode) -{ - if (mode != 32 && mode != 64) - { -#ifdef _WIN64 - mode = 64; -#else - mode = 32; -#endif - } - - if (mode == 32) - sprintf(str, "0x%08x", (unsigned int) offset); - else - sprintf(str, "0x%08x%08x", (unsigned int)(offset >> 32), - (unsigned int)offset); - - return str; -} - static void dbg_print_sdecimal(dbg_lgint_t sv) { dbg_printf("%I64d", sv); @@ -538,8 +512,8 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue) case SymTagPointerType: if (!types_array_index(lvalue, 0, &sub_lvalue)) { - dbg_printf("Internal symbol error: unable to access memory location %p", - memory_to_linear_addr(&lvalue->addr)); + dbg_printf("Internal symbol error: unable to access memory location %#.*Ix", + ADDRSIZE, (DWORD_PTR)memory_to_linear_addr(&lvalue->addr)); break; } val_ptr = memory_to_linear_addr(&sub_lvalue.addr); @@ -556,16 +530,16 @@ static void print_typed_basic(const struct dbg_lvalue* lvalue) size64 == 2, buffer, sizeof(buffer))) dbg_printf(""%s"", buffer); else - dbg_printf("*** invalid address %p ***", val_ptr); + dbg_printf("*** invalid address %#.*Ix ***", ADDRSIZE, (DWORD_PTR)val_ptr); break; } } - dbg_printf("%p", val_ptr); + dbg_printf("%#.*Ix", ADDRSIZE, (DWORD_PTR)val_ptr); break; case SymTagArrayType: case SymTagUDT: if (!memory_read_value(lvalue, sizeof(val_ptr), &val_ptr)) return; - dbg_printf("%p", val_ptr); + dbg_printf("%#.*Ix", ADDRSIZE, (DWORD_PTR)val_ptr); break; case SymTagEnum: { @@ -680,20 +654,17 @@ void print_basic(const struct dbg_lvalue* lvalue, char format)
void print_bare_address(const ADDRESS64* addr) { - char hexbuf[MAX_OFFSET_TO_STR_LEN]; - switch (addr->Mode) { - case AddrModeFlat: - dbg_printf("%s", memory_offset_to_string(hexbuf, addr->Offset, 0)); + case AddrModeFlat: + dbg_printf("%#.*I64x", ADDRSIZE, addr->Offset); break; case AddrModeReal: case AddrMode1616: dbg_printf("0x%04x:0x%04x", addr->Segment, (unsigned) addr->Offset); break; case AddrMode1632: - dbg_printf("0x%04x:%s", addr->Segment, - memory_offset_to_string(hexbuf, addr->Offset, 32)); + dbg_printf("0x%04x:%u", addr->Segment, (unsigned) addr->Offset); break; default: dbg_printf("Unknown mode %x", addr->Mode); diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 8c365a1e55d..c29f29e2639 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -373,11 +373,11 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de) swprintf(u.buffer, ARRAY_SIZE(u.buffer), L"Process_%08x", dbg_curr_pid); }
- WINE_TRACE("%04lx:%04lx: create process '%s'/%p @%p (%lu<%lu>)\n", + WINE_TRACE("%04lx:%04lx: create process '%s'/%#.*Ix @%#.*Ix (%lu<%lu>)\n", de->dwProcessId, de->dwThreadId, wine_dbgstr_w(u.buffer), - de->u.CreateProcessInfo.lpImageName, - de->u.CreateProcessInfo.lpStartAddress, + ADDRSIZE, (DWORD_PTR)de->u.CreateProcessInfo.lpImageName, + ADDRSIZE, (DWORD_PTR)de->u.CreateProcessInfo.lpStartAddress, de->u.CreateProcessInfo.dwDebugInfoFileOffset, de->u.CreateProcessInfo.nDebugInfoSize); dbg_set_process_name(dbg_curr_process, u.buffer); @@ -388,8 +388,9 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de) (DWORD_PTR)de->u.CreateProcessInfo.lpBaseOfImage, 0)) dbg_printf("couldn't load main module (%lu)\n", GetLastError());
- WINE_TRACE("%04lx:%04lx: create thread I @%p\n", - de->dwProcessId, de->dwThreadId, de->u.CreateProcessInfo.lpStartAddress); + WINE_TRACE("%04lx:%04lx: create thread I @%#.*Ix\n", + de->dwProcessId, de->dwThreadId, + ADDRSIZE, (DWORD_PTR)de->u.CreateProcessInfo.lpStartAddress);
dbg_curr_thread = dbg_add_thread(dbg_curr_process, de->dwThreadId, @@ -418,8 +419,9 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de) break;
case CREATE_THREAD_DEBUG_EVENT: - WINE_TRACE("%04lx:%04lx: create thread D @%p\n", - de->dwProcessId, de->dwThreadId, de->u.CreateThread.lpStartAddress); + WINE_TRACE("%04lx:%04lx: create thread D @%#.*Ix\n", + de->dwProcessId, de->dwThreadId, + ADDRSIZE, (DWORD_PTR)de->u.CreateThread.lpStartAddress);
if (dbg_curr_process == NULL) { @@ -466,9 +468,10 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de) fetch_module_name(de->u.LoadDll.lpImageName, de->u.LoadDll.lpBaseOfDll, u.buffer, ARRAY_SIZE(u.buffer));
- WINE_TRACE("%04lx:%04lx: loads DLL %s @%p (%lu<%lu>)\n", + WINE_TRACE("%04lx:%04lx: loads DLL %s @%#.*Ix (%lu<%lu>)\n", de->dwProcessId, de->dwThreadId, - wine_dbgstr_w(u.buffer), de->u.LoadDll.lpBaseOfDll, + wine_dbgstr_w(u.buffer), + ADDRSIZE, (DWORD_PTR)de->u.LoadDll.lpBaseOfDll, de->u.LoadDll.dwDebugInfoFileOffset, de->u.LoadDll.nDebugInfoSize); dbg_load_module(dbg_curr_process->handle, de->u.LoadDll.hFile, u.buffer, @@ -478,16 +481,17 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de) break_set_xpoints(TRUE); if (DBG_IVAR(BreakOnDllLoad)) { - dbg_printf("Stopping on DLL %s loading at %p\n", - dbg_W2A(u.buffer, -1), de->u.LoadDll.lpBaseOfDll); + dbg_printf("Stopping on DLL %s loading at %#.*Ix\n", + dbg_W2A(u.buffer, -1), + ADDRSIZE, (DWORD_PTR)de->u.LoadDll.lpBaseOfDll); if (dbg_fetch_context()) cont = 0; } break;
case UNLOAD_DLL_DEBUG_EVENT: - WINE_TRACE("%04lx:%04lx: unload DLL @%p\n", + WINE_TRACE("%04lx:%04lx: unload DLL @%#.*Ix\n", de->dwProcessId, de->dwThreadId, - de->u.UnloadDll.lpBaseOfDll); + ADDRSIZE, (DWORD_PTR)de->u.UnloadDll.lpBaseOfDll); break_delete_xpoints_from_module((DWORD_PTR)de->u.UnloadDll.lpBaseOfDll); SymUnloadModule64(dbg_curr_process->handle, (DWORD_PTR)de->u.UnloadDll.lpBaseOfDll); break; @@ -526,12 +530,11 @@ static void dbg_resume_debuggee(DWORD cont) if (dbg_curr_thread->in_exception) { ADDRESS64 addr; - char hexbuf[MAX_OFFSET_TO_STR_LEN];
dbg_exception_epilog(); memory_get_current_pc(&addr); - WINE_TRACE("Exiting debugger PC=%s mode=%d count=%d\n", - memory_offset_to_string(hexbuf, addr.Offset, 0), + WINE_TRACE("Exiting debugger PC=%#.*I64x mode=%d count=%d\n", + ADDRSIZE, addr.Offset, dbg_curr_thread->exec_mode, dbg_curr_thread->exec_count); if (dbg_curr_thread) @@ -559,7 +562,7 @@ static void wait_exception(void) void dbg_wait_next_exception(DWORD cont, int count, int mode) { ADDRESS64 addr; - char hexbuf[MAX_OFFSET_TO_STR_LEN]; +
if (cont == DBG_CONTINUE) { @@ -572,8 +575,8 @@ void dbg_wait_next_exception(DWORD cont, int count, int mode) if (!dbg_curr_process) return;
memory_get_current_pc(&addr); - WINE_TRACE("Entering debugger PC=%s mode=%d count=%d\n", - memory_offset_to_string(hexbuf, addr.Offset, 0), + WINE_TRACE("Entering debugger PC=%#.*I64x mode=%d count=%d\n", + ADDRSIZE, addr.Offset, dbg_curr_thread->exec_mode, dbg_curr_thread->exec_count); } diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 95318eeb2f1..638efc6e901 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -584,7 +584,8 @@ void dbg_start_interactive(const char* filename, HANDLE hFile)
static LONG CALLBACK top_filter( EXCEPTION_POINTERS *ptr ) { - dbg_printf( "winedbg: Internal crash at %p\n", ptr->ExceptionRecord->ExceptionAddress ); + dbg_printf( "winedbg: Internal crash at %#.*Ix\n", + ADDRSIZE, (DWORD_PTR)ptr->ExceptionRecord->ExceptionAddress ); return EXCEPTION_EXECUTE_HANDLER; }