(BTW dbghelp is already doing the right thing)
--- tools/winedump/msc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index 2c3d406347e..b7b7eb435ff 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -1161,7 +1161,7 @@ BOOL codeview_dump_types_from_block(const void* table, unsigned long len)
codeview_dump_one_type(curr_type, type); curr_type++; - ptr += (type->generic.len + 2 + 3) & ~3; + ptr += type->generic.len + 2; }
return TRUE;
--- include/wine/mscvpdb.h | 15 +++++++++++++++ tools/winedump/msc.c | 8 ++++++++ 2 files changed, 23 insertions(+)
diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index c9ab4abb166..1ede937abc4 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -1958,6 +1958,20 @@ union codeview_symbol unsigned short varflags; char name[1]; } file_static_v3; + + struct + { + unsigned short int len; + unsigned short int id; + struct p_string pname; + } unamespace_v2; + + struct + { + unsigned short int len; + unsigned short int id; + unsigned char name[1]; + } unamespace_v3; };
enum BinaryAnnotationOpcode @@ -2031,6 +2045,7 @@ enum BinaryAnnotationOpcode #define S_GTHREAD32_ST 0x100f #define S_FRAMEPROC 0x1012 #define S_COMPILE2_ST 0x1013 +#define S_UNAMESPACE_ST 0x1029
#define S_OBJNAME 0x1101 #define S_THUNK32 0x1102 diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index b7b7eb435ff..12d1a9e62ab 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -1839,6 +1839,14 @@ BOOL codeview_dump_symbols(const void* root, unsigned long size) get_varflags(sym->file_static_v3.varflags)); break;
+ case S_UNAMESPACE_ST: + printf("UNameSpace V2 '%s'\n", p_string(&sym->unamespace_v2.pname)); + break; + + case S_UNAMESPACE: + printf("UNameSpace V3 '%s'\n", sym->unamespace_v3.name); + break; + default: printf("\n\t\t>>> Unsupported symbol-id %x sz=%d\n", sym->generic.id, sym->generic.len + 2); dump_data((const void*)sym, sym->generic.len + 2, " ");
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/symbol.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index ffb0e53fdeb..991aa9bd165 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -750,13 +750,16 @@ static void symt_fill_sym_info(struct module_pair* pair, sym_info->Flags |= SYMFLAG_LOCAL; switch (data->u.value.n1.n2.vt) { - case VT_I4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.lVal; break; - case VT_I2: sym_info->Value = (ULONG)(LONG_PTR)data->u.value.n1.n2.n3.iVal; break; - case VT_I1: sym_info->Value = (ULONG)(LONG_PTR)data->u.value.n1.n2.n3.cVal; break; - case VT_UI4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.ulVal; break; - case VT_UI2: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.uiVal; break; - case VT_UI1: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.bVal; break; - case VT_I1 | VT_BYREF: sym_info->Value = (ULONG64)(DWORD_PTR)data->u.value.n1.n2.n3.byref; break; + case VT_I8: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.llVal; break; + case VT_I4: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.lVal; break; + case VT_I2: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.iVal; break; + case VT_I1: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.cVal; break; + case VT_UINT:sym_info->Value = data->u.value.n1.n2.n3.uintVal; break; + case VT_UI8: sym_info->Value = data->u.value.n1.n2.n3.ullVal; break; + case VT_UI4: sym_info->Value = data->u.value.n1.n2.n3.ulVal; break; + case VT_UI2: sym_info->Value = data->u.value.n1.n2.n3.uiVal; break; + case VT_UI1: sym_info->Value = data->u.value.n1.n2.n3.bVal; break; + case VT_I1 | VT_BYREF: sym_info->Value = (DWORD_PTR)data->u.value.n1.n2.n3.byref; break; case VT_EMPTY: sym_info->Value = 0; break; default: FIXME("Unsupported variant type (%u)\n", data->u.value.n1.n2.vt);
On 10/12/21 7:10 PM, Eric Pouech wrote:
case VT_I8: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.llVal; break;
case VT_I4: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.lVal; break;
case VT_I2: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.iVal; break;
case VT_I1: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.cVal; break;
case VT_UINT:sym_info->Value = data->u.value.n1.n2.n3.uintVal; break;
case VT_UI8: sym_info->Value = data->u.value.n1.n2.n3.ullVal; break;
case VT_UI4: sym_info->Value = data->u.value.n1.n2.n3.ulVal; break;
case VT_UI2: sym_info->Value = data->u.value.n1.n2.n3.uiVal; break;
case VT_UI1: sym_info->Value = data->u.value.n1.n2.n3.bVal; break;
case VT_I1 | VT_BYREF: sym_info->Value = (DWORD_PTR)data->u.value.n1.n2.n3.byref; break; case VT_EMPTY: sym_info->Value = 0; break;
Is it possible to use V_VT()/V_*() macros for that?
Le 12/10/2021 à 18:16, Nikolay Sivov a écrit :
On 10/12/21 7:10 PM, Eric Pouech wrote:
case VT_I8: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.llVal; break;
case VT_I4: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.lVal; break;
case VT_I2: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.iVal; break;
case VT_I1: sym_info->Value = (LONG64)data->u.value.n1.n2.n3.cVal; break;
case VT_UINT:sym_info->Value = data->u.value.n1.n2.n3.uintVal; break;
case VT_UI8: sym_info->Value = data->u.value.n1.n2.n3.ullVal; break;
case VT_UI4: sym_info->Value = data->u.value.n1.n2.n3.ulVal; break;
case VT_UI2: sym_info->Value = data->u.value.n1.n2.n3.uiVal; break;
case VT_UI1: sym_info->Value = data->u.value.n1.n2.n3.bVal; break;
case VT_I1 | VT_BYREF: sym_info->Value = (DWORD_PTR)data->u.value.n1.n2.n3.byref; break; case VT_EMPTY: sym_info->Value = 0; break;
Is it possible to use V_VT()/V_*() macros for that?
sure but that would be a larger patch, need to fix also the parts where the value is set into the variant
I'll resend this one tomorrow
A+
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dbghelp_private.h | 2 ++ dlls/dbghelp/dwarf.c | 5 +---- dlls/dbghelp/module.c | 7 +++++++ dlls/dbghelp/msc.c | 5 +---- dlls/dbghelp/symbol.c | 30 ++++++------------------------ dlls/dbghelp/type.c | 20 +++----------------- 6 files changed, 20 insertions(+), 49 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 14c4336e205..fda6714c332 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -629,6 +629,8 @@ extern const WCHAR S_WineLoaderW[] DECLSPEC_HIDDEN; extern const WCHAR S_SlashW[] DECLSPEC_HIDDEN; extern const struct loader_ops no_loader_ops DECLSPEC_HIDDEN;
+extern BOOL module_init_pair(struct module_pair* pair, HANDLE hProcess, + DWORD64 addr) DECLSPEC_HIDDEN; extern struct module* module_find_by_addr(const struct process* pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN; diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index c15b59b57c3..50f47548810 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -3652,10 +3652,7 @@ BOOL dwarf2_virtual_unwind(struct cpu_stack_walk *csw, ULONG_PTR ip, struct module_pair pair; struct frame_info info;
- if (!(pair.pcs = process_find_by_handle(csw->hProcess)) || - !(pair.requested = module_find_by_addr(pair.pcs, ip, DMT_UNKNOWN)) || - !module_get_debug(&pair)) - return FALSE; + if (!module_init_pair(&pair, csw->hProcess, ip)) return FALSE; if (!dwarf2_fetch_frame_info(pair.effective, csw->cpu, ip, &info)) return FALSE;
/* if at very beginning of function, return and use default unwinder */ diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 254bbb297d7..488ed1a3bd6 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -262,6 +262,13 @@ struct module* module_new(struct process* pcs, const WCHAR* name, return module; }
+BOOL module_init_pair(struct module_pair* pair, HANDLE hProcess, DWORD64 addr) +{ + if (!(pair->pcs = process_find_by_handle(hProcess))) return FALSE; + pair->requested = module_find_by_addr(pair->pcs, addr, DMT_UNKNOWN); + return module_get_debug(pair); +} + /*********************************************************************** * module_find_by_nameW * diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index c3e243879b2..bf6266af9ce 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -3200,10 +3200,7 @@ BOOL pdb_virtual_unwind(struct cpu_stack_walk *csw, DWORD_PTR ip, char* strbase; BOOL ret = TRUE;
- if (!(pair.pcs = process_find_by_handle(csw->hProcess)) || - !(pair.requested = module_find_by_addr(pair.pcs, ip, DMT_UNKNOWN)) || - !module_get_debug(&pair)) - return FALSE; + if (!module_init_pair(&pair, csw->hProcess, ip)) return FALSE; if (!pair.effective->format_info[DFI_PDB]) return FALSE; pdb_info = pair.effective->format_info[DFI_PDB]->u.pdb_info; TRACE("searching %lx => %lx\n", ip, ip - (DWORD_PTR)pair.effective->module.BaseOfImage); diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 991aa9bd165..f565fcf8437 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -1363,10 +1363,7 @@ BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, struct module_pair pair; struct symt_ht* sym;
- pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, Address, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; + if (!module_init_pair(&pair, hProcess, Address)) return FALSE; if ((sym = symt_find_nearest(pair.effective, Address)) == NULL) return FALSE;
symt_fill_sym_info(&pair, NULL, &sym->symt, Symbol); @@ -1717,10 +1714,7 @@ static BOOL get_line_from_addr(HANDLE hProcess, DWORD64 addr, struct symt_ht* symt; struct symt_function* func;
- pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, addr, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; + if (!module_init_pair(&pair, hProcess, addr)) return FALSE; if ((symt = symt_find_nearest(pair.effective, addr)) == NULL) return FALSE;
if (symt->symt.tag != SymTagFunction) return FALSE; @@ -1862,10 +1856,7 @@ static BOOL symt_get_func_line_prev(HANDLE hProcess, struct internal_line_t* int struct line_info* li; struct line_info* srcli;
- pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, addr, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; + if (!module_init_pair(&pair, hProcess, addr)) return FALSE;
if (key == NULL) return FALSE;
@@ -1944,10 +1935,7 @@ static BOOL symt_get_func_line_next(HANDLE hProcess, struct internal_line_t* int struct line_info* srcli;
if (key == NULL) return FALSE; - pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, addr, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; + if (!module_init_pair(&pair, hProcess, addr)) return FALSE;
/* search current source file */ for (srcli = key; !srcli->is_source_file; srcli--); @@ -2344,10 +2332,7 @@ BOOL WINAPI SymAddSymbol(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR name,
TRACE("(%p %s %s %u)\n", hProcess, wine_dbgstr_a(name), wine_dbgstr_longlong(addr), size);
- pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; + if (!module_init_pair(&pair, hProcess, BaseOfDll)) return FALSE;
return symt_new_custom(pair.effective, name, addr, size) != NULL; } @@ -2400,11 +2385,8 @@ BOOL WINAPI SymEnumLines(HANDLE hProcess, ULONG64 base, PCSTR compiland, if (!cb) return FALSE; if (!(dbghelp_options & SYMOPT_LOAD_LINES)) return TRUE;
- pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; + if (!module_init_pair(&pair, hProcess, base)) return FALSE; if (compiland) FIXME("Unsupported yet (filtering on compiland %s)\n", compiland); - pair.requested = module_find_by_addr(pair.pcs, base, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; if (!(srcmask = file_regex(srcfile))) return FALSE;
sci.SizeOfStruct = sizeof(sci); diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index d41e13ef79e..0891c98df85 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -483,9 +483,7 @@ BOOL WINAPI SymEnumTypes(HANDLE hProcess, ULONG64 BaseOfDll, hProcess, wine_dbgstr_longlong(BaseOfDll), EnumSymbolsCallback, UserContext);
- if (!(pair.pcs = process_find_by_handle(hProcess))) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; + if (!module_init_pair(&pair, hProcess, BaseOfDll)) return FALSE;
sym_info->SizeOfStruct = sizeof(SYMBOL_INFO); sym_info->MaxNameLen = sizeof(buffer) - sizeof(SYMBOL_INFO); @@ -1007,16 +1005,7 @@ BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, DWORD64 ModBase, { struct module_pair pair;
- pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - - pair.requested = module_find_by_addr(pair.pcs, ModBase, DMT_UNKNOWN); - if (!module_get_debug(&pair)) - { - FIXME("Someone didn't properly set ModBase (%s)\n", wine_dbgstr_longlong(ModBase)); - return FALSE; - } - + if (!module_init_pair(&pair, hProcess, ModBase)) return FALSE; return symt_get_info(pair.effective, symt_index2ptr(pair.effective, TypeId), GetType, pInfo); }
@@ -1031,10 +1020,7 @@ BOOL WINAPI SymGetTypeFromName(HANDLE hProcess, ULONG64 BaseOfDll, struct symt* type; DWORD64 size;
- pair.pcs = process_find_by_handle(hProcess); - if (!pair.pcs) return FALSE; - pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN); - if (!module_get_debug(&pair)) return FALSE; + if (!module_init_pair(&pair, hProcess, BaseOfDll)) return FALSE; type = symt_find_type_by_name(pair.effective, SymTagNull, Name); if (!type) return FALSE; Symbol->Index = Symbol->TypeIndex = symt_ptr2index(pair.effective, type);
(regression introduced in 0ea9fe999c1ed3a8b645476d97d2e0221be17bb5)
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/be_arm64.c | 14 +++++++------- programs/winedbg/be_x86_64.c | 17 ++++++++--------- 2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/programs/winedbg/be_arm64.c b/programs/winedbg/be_arm64.c index d22f254013b..9ceb9291d54 100644 --- a/programs/winedbg/be_arm64.c +++ b/programs/winedbg/be_arm64.c @@ -80,19 +80,19 @@ static void be_arm64_print_context(HANDLE hThread, const dbg_ctx_t *ctx, int all if (!((ctx->ctx.Cpsr >> 26) & (1 << (sizeof(condflags) - i)))) buf[i] = '-';
- dbg_printf(" Pc:%016lx Sp:%016lx Lr:%016lx Cpsr:%08x(%s)\n", + dbg_printf(" Pc:%016I64x Sp:%016I64x Lr:%016I64x Cpsr:%08x(%s)\n", ctx->ctx.Pc, ctx->ctx.Sp, ctx->ctx.u.s.Lr, ctx->ctx.Cpsr, buf); - dbg_printf(" x0: %016lx x1: %016lx x2: %016lx x3: %016lx x4: %016lx\n", + dbg_printf(" x0: %016I64x x1: %016I64x x2: %016I64x x3: %016I64x x4: %016I64x\n", ctx->ctx.u.s.X0, ctx->ctx.u.s.X1, ctx->ctx.u.s.X2, ctx->ctx.u.s.X3, ctx->ctx.u.s.X4); - dbg_printf(" x5: %016lx x6: %016lx x7: %016lx x8: %016lx x9: %016lx\n", + dbg_printf(" x5: %016I64x x6: %016I64x x7: %016I64x x8: %016I64x x9: %016I64x\n", ctx->ctx.u.s.X5, ctx->ctx.u.s.X6, ctx->ctx.u.s.X7, ctx->ctx.u.s.X8, ctx->ctx.u.s.X9); - dbg_printf(" x10:%016lx x11:%016lx x12:%016lx x13:%016lx x14:%016lx\n", + dbg_printf(" x10:%016I64x x11:%016I64x x12:%016I64x x13:%016I64x x14:%016I64x\n", ctx->ctx.u.s.X10, ctx->ctx.u.s.X11, ctx->ctx.u.s.X12, ctx->ctx.u.s.X13, ctx->ctx.u.s.X14); - dbg_printf(" x15:%016lx ip0:%016lx ip1:%016lx x18:%016lx x19:%016lx\n", + dbg_printf(" x15:%016I64x ip0:%016I64x ip1:%016I64x x18:%016I64x x19:%016I64x\n", ctx->ctx.u.s.X15, ctx->ctx.u.s.X16, ctx->ctx.u.s.X17, ctx->ctx.u.s.X18, ctx->ctx.u.s.X19); - dbg_printf(" x20:%016lx x21:%016lx x22:%016lx x23:%016lx x24:%016lx\n", + dbg_printf(" x20:%016I64x x21:%016I64x x22:%016I64x x23:%016I64x x24:%016I64x\n", ctx->ctx.u.s.X20, ctx->ctx.u.s.X21, ctx->ctx.u.s.X22, ctx->ctx.u.s.X23, ctx->ctx.u.s.X24); - dbg_printf(" x25:%016lx x26:%016lx x27:%016lx x28:%016lx Fp:%016lx\n", + dbg_printf(" x25:%016I64x x26:%016I64x x27:%016I64x x28:%016I64x Fp:%016I64x\n", ctx->ctx.u.s.X25, ctx->ctx.u.s.X26, ctx->ctx.u.s.X27, ctx->ctx.u.s.X28, ctx->ctx.u.s.Fp);
if (all_regs) dbg_printf( "Floating point ARM64 dump not implemented\n" ); diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c index 74481645081..c2839cf4097 100644 --- a/programs/winedbg/be_x86_64.c +++ b/programs/winedbg/be_x86_64.c @@ -89,13 +89,13 @@ static void be_x86_64_print_context(HANDLE hThread, const dbg_ctx_t *pctx, buf[i] = ' ';
dbg_printf("Register dump:\n"); - dbg_printf(" rip:%016lx rsp:%016lx rbp:%016lx eflags:%08x (%s)\n", + dbg_printf(" rip:%016I64x rsp:%016I64x rbp:%016I64x eflags:%08x (%s)\n", ctx->Rip, ctx->Rsp, ctx->Rbp, ctx->EFlags, buf); - dbg_printf(" rax:%016lx rbx:%016lx rcx:%016lx rdx:%016lx\n", + dbg_printf(" rax:%016I64x rbx:%016I64x rcx:%016I64x rdx:%016I64x\n", ctx->Rax, ctx->Rbx, ctx->Rcx, ctx->Rdx); - dbg_printf(" rsi:%016lx rdi:%016lx r8:%016lx r9:%016lx r10:%016lx\n", + dbg_printf(" rsi:%016I64x rdi:%016I64x r8:%016I64x r9:%016I64x r10:%016I64x\n", ctx->Rsi, ctx->Rdi, ctx->R8, ctx->R9, ctx->R10 ); - dbg_printf(" r11:%016lx r12:%016lx r13:%016lx r14:%016lx r15:%016lx\n", + dbg_printf(" r11:%016I64x r12:%016I64x r13:%016I64x r14:%016I64x r15:%016I64x\n", ctx->R11, ctx->R12, ctx->R13, ctx->R14, ctx->R15 );
if (!all_regs) return; @@ -104,9 +104,9 @@ static void be_x86_64_print_context(HANDLE hThread, const dbg_ctx_t *pctx, ctx->SegCs, ctx->SegDs, ctx->SegEs, ctx->SegFs, ctx->SegGs, ctx->SegSs );
dbg_printf("Debug:\n"); - dbg_printf(" dr0:%016lx dr1:%016lx dr2:%016lx dr3:%016lx\n", + dbg_printf(" dr0:%016I64x dr1:%016I64x dr2:%016I64x dr3:%016I64x\n", ctx->Dr0, ctx->Dr1, ctx->Dr2, ctx->Dr3 ); - dbg_printf(" dr6:%016lx dr7:%016lx\n", ctx->Dr6, ctx->Dr7 ); + dbg_printf(" dr6:%016I64x dr7:%016I64x\n", ctx->Dr6, ctx->Dr7 );
dbg_printf("Floating point:\n"); dbg_printf(" flcw:%04x ", LOWORD(ctx->u.FltSave.ControlWord)); @@ -150,8 +150,7 @@ static void be_x86_64_print_context(HANDLE hThread, const dbg_ctx_t *pctx, { M128A reg = ctx->u.FltSave.FloatRegisters[i]; if (i == 4) dbg_printf("\n"); - dbg_printf(" ST%u:%08x%08x%08x%08x ", i, - (DWORD)(reg.High >> 32), (DWORD)reg.High, (DWORD)(reg.Low >> 32), (DWORD)reg.Low ); + dbg_printf(" ST%u:%016I64x%16I64x ", i, reg.High, reg.Low ); } dbg_printf("\n");
@@ -162,7 +161,7 @@ static void be_x86_64_print_context(HANDLE hThread, const dbg_ctx_t *pctx,
for (i = 0; i < 16; i++) { - dbg_printf( " %sxmm%u: uint=%016lx%016lx", (i > 9) ? "" : " ", i, + dbg_printf( " %sxmm%u: uint=%016I64x%016I64x", (i > 9) ? "" : " ", i, ctx->u.FltSave.XmmRegisters[i].High, ctx->u.FltSave.XmmRegisters[i].Low ); dbg_printf( " double={%g; %g}", *(double *)&ctx->u.FltSave.XmmRegisters[i].Low, *(double *)&ctx->u.FltSave.XmmRegisters[i].High );
all internal computation are made with DWORD_PTR and LONG_PTR, so use corresponding internal type for the result
regression introduced in 0ea9fe999c1ed3a8b645476d97d2e0221be17bb5
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/expr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/programs/winedbg/expr.c b/programs/winedbg/expr.c index e58d394be35..f03ab25c003 100644 --- a/programs/winedbg/expr.c +++ b/programs/winedbg/expr.c @@ -476,7 +476,7 @@ struct dbg_lvalue expr_eval(struct expr* exp) exp2 = expr_eval(exp->un.binop.exp2); if (exp1.type.id == dbg_itype_none || exp2.type.id == dbg_itype_none) RaiseException(DEBUG_STATUS_BAD_TYPE, 0, 0, NULL); - rtn.type.id = dbg_itype_signed_int; + rtn.type.id = dbg_itype_signed_long_int; rtn.type.module = 0; rtn.addr.Offset = (ULONG_PTR)&exp->un.binop.result; type1 = exp1.type; @@ -609,7 +609,7 @@ struct dbg_lvalue expr_eval(struct expr* exp) exp1 = expr_eval(exp->un.unop.exp1); if (exp1.type.id == dbg_itype_none) RaiseException(DEBUG_STATUS_BAD_TYPE, 0, 0, NULL); rtn.addr.Offset = (ULONG_PTR)&exp->un.unop.result; - rtn.type.id = dbg_itype_signed_int; + rtn.type.id = dbg_itype_signed_long_int; rtn.type.module = 0; switch (exp->un.unop.unop_type) {
regression introduced in 0ea9fe999c1ed3a8b645476d97d2e0221be17bb5
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/debug.l | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l index b841048360f..875688f774f 100644 --- a/programs/winedbg/debug.l +++ b/programs/winedbg/debug.l @@ -154,11 +154,11 @@ STRING "[^\n"]+" "[" { return *yytext; } "]" { return *yytext; }
-"0x"{HEXDIGIT}+ { sscanf(yytext, "%lx", &dbg_lval.integer); return tNUM; } -{DIGIT}+ { sscanf(yytext, "%ld", &dbg_lval.integer); return tNUM; } +"0x"{HEXDIGIT}+ { sscanf(yytext, "%Ix", &dbg_lval.integer); return tNUM; } +{DIGIT}+ { sscanf(yytext, "%Id", &dbg_lval.integer); return tNUM; } "'\''" { dbg_lval.integer = '''; return tNUM;} -"'\0"{OCTDIGIT}*"'" { sscanf(yytext + 3, "%lo", &dbg_lval.integer); return tNUM;} -"'\x"{HEXDIGIT}+"'" { sscanf(yytext + 3, "%lx", &dbg_lval.integer); return tNUM;} +"'\0"{OCTDIGIT}*"'" { sscanf(yytext + 3, "%Io", &dbg_lval.integer); return tNUM;} +"'\x"{HEXDIGIT}+"'" { sscanf(yytext + 3, "%Ix", &dbg_lval.integer); return tNUM;} "'\"[a-z]"'" { dbg_lval.integer = yytext[2] - 'a'; return tNUM;} "'"."'" { dbg_lval.integer = yytext[1]; return tNUM;}
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/db_disasm64.c | 5 +---- programs/winedbg/info.c | 2 +- programs/winedbg/memory.c | 6 ++---- programs/winedbg/stack.c | 6 +++--- 4 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/programs/winedbg/db_disasm64.c b/programs/winedbg/db_disasm64.c index 07faed0d146..3c0d55ee218 100644 --- a/programs/winedbg/db_disasm64.c +++ b/programs/winedbg/db_disasm64.c @@ -1603,10 +1603,7 @@ 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); - if (imm64 >> 32) - db_printf("$0x%x%08x", (DWORD)(imm64 >> 32), (DWORD)imm64); - else - db_printf("$%#x", (DWORD)imm64); + db_printf("$%#I64x", imm64); break;
case O: diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c index dc0e6591f1f..477438d83e3 100644 --- a/programs/winedbg/info.c +++ b/programs/winedbg/info.c @@ -284,7 +284,7 @@ void info_win32_module(DWORD64 base) HeapFree(GetProcessHeap(), 0, im.modules);
if (base && !num_printed) - dbg_printf("'0x%x%08x' is not a valid module address\n", (DWORD)(base >> 32), (DWORD)base); + dbg_printf("'0x%0*I64x' is not a valid module address\n", ADDRWIDTH, base); }
struct class_walker diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index 3d6534a973f..6cd90b236eb 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -336,10 +336,8 @@ static void dbg_print_hex(DWORD size, ULONGLONG sv) { if (!sv) dbg_printf("0"); - else if (size > 4 && (sv >> 32)) - dbg_printf("0x%x%08x", (DWORD)(sv >> 32), (DWORD)sv); else - dbg_printf("0x%x", (DWORD)sv); + dbg_printf("%#I64x", sv); }
static void print_typed_basic(const struct dbg_lvalue* lvalue) @@ -595,7 +593,7 @@ void print_address(const ADDRESS64* addr, BOOLEAN with_line) si->MaxNameLen = 256; if (!SymFromAddr(dbg_curr_process->handle, (DWORD_PTR)lin, &disp64, si)) return; dbg_printf(" %s", si->Name); - if (disp64) dbg_printf("+0x%lx", (DWORD_PTR)disp64); + if (disp64) dbg_printf("+0x%I64x", disp64); if (with_line) { IMAGEHLP_LINE64 il; diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index 1aa681bf7a6..396caf11edd 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -286,7 +286,7 @@ static void stack_print_addr_and_args(int nf) DWORD disp;
dbg_printf(" %s", si->Name); - if (disp64) dbg_printf("+0x%lx", (DWORD_PTR)disp64); + if (disp64) dbg_printf("+0x%I64x", disp64);
SymSetContext(dbg_curr_process->handle, &ihsf, NULL); se.first = TRUE; @@ -301,8 +301,8 @@ static void stack_print_addr_and_args(int nf) dbg_printf(" [%s:%u]", il.FileName, il.LineNumber); dbg_printf(" in %s", im.ModuleName); } - else dbg_printf(" in %s (+0x%lx)", - im.ModuleName, (DWORD_PTR)(ihsf.InstructionOffset - im.BaseOfImage)); + else dbg_printf(" in %s (+0x%I64x)", + im.ModuleName, ihsf.InstructionOffset - im.BaseOfImage); }
/******************************************************************
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- 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;