fixes BZ #42030
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- programs/winedbg/winedbg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 4cd2979dce3..45a7edfb309 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -675,7 +675,7 @@ int main(int argc, char** argv) /* parse options */ while (argc > 0 && argv[0][0] == '-') { - if (!strcmp(argv[0], "--command")) + if (!strcmp(argv[0], "--command") && argc > 1) { argc--; argv++; hFile = parser_generate_command_file(argv[0], NULL); @@ -687,7 +687,7 @@ int main(int argc, char** argv) argc--; argv++; continue; } - if (!strcmp(argv[0], "--file")) + if (!strcmp(argv[0], "--file") && argc > 1) { argc--; argv++; hFile = CreateFileA(argv[0], GENERIC_READ|DELETE, 0,
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- tools/winedump/msc.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index b566018ac89..0fbcc3dba80 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -1935,6 +1935,7 @@ BOOL codeview_dump_symbols(const void* root, unsigned long start, unsigned long sym->sepcode_v3.pParent, sym->sepcode_v3.pEnd, sym->sepcode_v3.sect, sym->sepcode_v3.off, sym->sepcode_v3.length, sym->sepcode_v3.sectParent, sym->sepcode_v3.offParent); + push_symbol_dumper(&sd, sym, sym->sepcode_v3.pEnd); break;
case S_ANNOTATION:
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- include/wine/mscvpdb.h | 10 ++++++++++ tools/winedump/msc.c | 6 ++++++ 2 files changed, 16 insertions(+)
diff --git a/include/wine/mscvpdb.h b/include/wine/mscvpdb.h index b0021ed3c25..5a09b9653a3 100644 --- a/include/wine/mscvpdb.h +++ b/include/wine/mscvpdb.h @@ -2024,6 +2024,16 @@ union codeview_symbol unsigned short int csz; /* number of bytes in following array */ char rgsz[1]; /* array of null terminated strings (bounded by csz) */ } annotation_v3; + + struct + { + unsigned short int len; + unsigned short int id; + unsigned int invocations; + __int64 dynCount; + unsigned numInstrs; + unsigned staInstLive; + } pogoinfo_v3; };
enum BinaryAnnotationOpcode diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c index 0fbcc3dba80..f0856b2a6a2 100644 --- a/tools/winedump/msc.c +++ b/tools/winedump/msc.c @@ -1949,6 +1949,12 @@ BOOL codeview_dump_symbols(const void* root, unsigned long start, unsigned long } break;
+ case S_POGODATA: + printf("PogoData V3 inv:%d dynCnt:%lld inst:%d staInst:%d\n", + sym->pogoinfo_v3.invocations, (long long)sym->pogoinfo_v3.dynCount, + sym->pogoinfo_v3.numInstrs, sym->pogoinfo_v3.staInstLive); + 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, " ");
they shouldn't fail if passed address is inside a module, even if it doesn't point to a function
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dbghelp.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c index 844ef00b8e9..c0b8837fbbf 100644 --- a/dlls/dbghelp/dbghelp.c +++ b/dlls/dbghelp/dbghelp.c @@ -607,18 +607,14 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame, PIMAGEHLP_CONTEXT Context) { struct process* pcs; - BOOL same;
- if (!(pcs = process_find_by_handle(hProcess))) return FALSE; - same = pcs->ctx_frame.ReturnOffset == StackFrame->ReturnOffset && - pcs->ctx_frame.FrameOffset == StackFrame->FrameOffset && - pcs->ctx_frame.StackOffset == StackFrame->StackOffset; - - if (!SymSetScopeFromAddr(hProcess, StackFrame->InstructionOffset)) - return FALSE; + TRACE("(%p %p %p)\n", hProcess, StackFrame, Context);
- pcs->ctx_frame = *StackFrame; - if (same) + if (!(pcs = process_find_by_handle(hProcess))) return FALSE; + if (pcs->ctx_frame.ReturnOffset == StackFrame->ReturnOffset && + pcs->ctx_frame.FrameOffset == StackFrame->FrameOffset && + pcs->ctx_frame.StackOffset == StackFrame->StackOffset && + pcs->ctx_frame.InstructionOffset == StackFrame->InstructionOffset) { TRACE("Setting same frame {rtn=%I64x frm=%I64x stk=%I64x}\n", pcs->ctx_frame.ReturnOffset, @@ -628,7 +624,11 @@ BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame, return FALSE; }
+ if (!SymSetScopeFromAddr(hProcess, StackFrame->InstructionOffset)) + return FALSE; + pcs->ctx_frame = *StackFrame; /* Context is not (no longer?) used */ + return TRUE; }
@@ -643,11 +643,11 @@ BOOL WINAPI SymSetScopeFromAddr(HANDLE hProcess, ULONG64 addr) TRACE("(%p %#I64x)\n", hProcess, addr);
if (!module_init_pair(&pair, hProcess, addr)) return FALSE; - if ((sym = symt_find_nearest(pair.effective, addr)) == NULL) return FALSE; - if (sym->symt.tag != SymTagFunction) return FALSE; - pair.pcs->localscope_pc = addr; - pair.pcs->localscope_symt = &sym->symt; + if ((sym = symt_find_nearest(pair.effective, addr)) != NULL && sym->symt.tag == SymTagFunction) + pair.pcs->localscope_symt = &sym->symt; + else + pair.pcs->localscope_symt = NULL;
return TRUE; }
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dwarf.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index ef17f7d539f..7b925ee53b8 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1835,8 +1835,9 @@ static void dwarf2_parse_enumerator(dwarf2_debug_info_t* di, static struct symt* dwarf2_parse_enumeration_type(dwarf2_debug_info_t* di) { struct attribute name; - struct attribute size; - struct symt_basic* basetype; + struct attribute attrtype; + dwarf2_debug_info_t*ditype; + struct symt* type; struct vector* children; dwarf2_debug_info_t*child; unsigned int i; @@ -1846,20 +1847,28 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_debug_info_t* di) TRACE("%s\n", dwarf2_debug_di(di));
if (!dwarf2_find_attribute(di, DW_AT_name, &name)) name.u.string = NULL; - if (!dwarf2_find_attribute(di, DW_AT_byte_size, &size)) size.u.uvalue = 4; - - switch (size.u.uvalue) /* FIXME: that's wrong */ + if (dwarf2_find_attribute(di, DW_AT_type, &attrtype) && (ditype = dwarf2_jump_to_debug_info(&attrtype)) != NULL) + type = ditype->symt; + else /* no type found for this enumeration, construct it from size */ { - case 1: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "char", 1); break; - case 2: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "short", 2); break; - default: - case 4: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "int", 4); break; - } + struct attribute size; + struct symt_basic* basetype; + + if (!dwarf2_find_attribute(di, DW_AT_byte_size, &size)) size.u.uvalue = 4;
- di->symt = &symt_new_enum(di->unit_ctx->module_ctx->module, name.u.string, &basetype->symt)->symt; + switch (size.u.uvalue) /* FIXME: that's wrong */ + { + case 1: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "char", 1); break; + case 2: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "short", 2); break; + default: + case 4: basetype = symt_new_basic(di->unit_ctx->module_ctx->module, btInt, "int", 4); break; + } + type = &basetype->symt; + }
+ di->symt = &symt_new_enum(di->unit_ctx->module_ctx->module, name.u.string, type)->symt; children = dwarf2_get_di_children(di); - /* FIXME: should we use the sibling stuff ?? */ + if (children) for (i = 0; i < vector_length(children); i++) { child = *(dwarf2_debug_info_t**)vector_at(children, i);
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dwarf.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 7b925ee53b8..d6b8de7400a 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -2065,14 +2065,18 @@ static void dwarf2_parse_subprogram_label(dwarf2_subprogram_t* subpgm,
TRACE("%s\n", dwarf2_debug_di(di));
- if (!dwarf2_find_attribute(di, DW_AT_low_pc, &low_pc)) low_pc.u.uvalue = 0; if (!dwarf2_find_attribute(di, DW_AT_name, &name)) name.u.string = NULL; - - loc.kind = loc_absolute; - loc.offset = subpgm->ctx->module_ctx->load_offset + low_pc.u.uvalue - subpgm->top_func->address; - symt_add_function_point(subpgm->ctx->module_ctx->module, subpgm->top_func, SymTagLabel, - &loc, name.u.string); + if (dwarf2_find_attribute(di, DW_AT_low_pc, &low_pc)) + { + loc.kind = loc_absolute; + loc.offset = subpgm->ctx->module_ctx->load_offset + low_pc.u.uvalue - subpgm->top_func->address; + symt_add_function_point(subpgm->ctx->module_ctx->module, subpgm->top_func, SymTagLabel, + &loc, name.u.string); + } + else + WARN("Label %s inside function %s doesn't have an address... don't register it\n", + name.u.string, subpgm->top_func->hash_elt.name); }
static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
Dwarf4 clarified that only FORM_sec_offset can refer to location lists - fix dwarf2_compute_location_attr accordingly
this fixes the 'fixme:dwarf2_parse_udt_member: Found register, while not expecting it' messages
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dwarf.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index d6b8de7400a..9d60aeb5ad4 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1059,18 +1059,31 @@ static BOOL dwarf2_compute_location_attr(dwarf2_parse_context_t* ctx,
switch (xloc.form) { + case DW_FORM_data4: + if (ctx->head.version < 4) + { + loc->kind = loc_dwarf2_location_list; + loc->reg = Wine_DW_no_register; + loc->offset = xloc.u.uvalue; + return TRUE; + } + /* fall through */ case DW_FORM_data1: case DW_FORM_data2: case DW_FORM_udata: case DW_FORM_sdata: loc->kind = loc_absolute; loc->reg = 0; loc->offset = xloc.u.uvalue; return TRUE; - case DW_FORM_data4: - loc->kind = loc_dwarf2_location_list; - loc->reg = Wine_DW_no_register; - loc->offset = xloc.u.uvalue; - return TRUE; - case DW_FORM_data8: case DW_FORM_sec_offset: + case DW_FORM_data8: + if (ctx->head.version >= 4) + { + loc->kind = loc_absolute; + loc->reg = 0; + loc->offset = xloc.u.lluvalue; + return TRUE; + } + /* fall through */ + case DW_FORM_sec_offset: loc->kind = loc_dwarf2_location_list; loc->reg = Wine_DW_no_register; loc->offset = xloc.u.lluvalue; @@ -1701,8 +1714,9 @@ static void dwarf2_parse_udt_member(dwarf2_debug_info_t* di, { if (loc.kind != loc_absolute) { - FIXME("Found register, while not expecting it\n"); - loc.offset = 0; + FIXME("Unexpected offset computation for member %s in %ls!%s\n", + name.u.string, di->unit_ctx->module_ctx->module->modulename, parent->hash_elt.name); + loc.offset = 0; } else TRACE("found member_location at %s -> %lu\n",
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/msc.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 4e44655deb5..d62f06f5606 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2517,8 +2517,10 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, case S_BUILDINFO: case S_FILESTATIC: case S_CALLEES: + case S_CALLERS: case S_UNAMESPACE: case S_INLINEES: + case S_POGODATA: TRACE("Unsupported symbol id %x\n", sym->generic.id); break;
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/msc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index d62f06f5606..894d01a4c00 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2497,6 +2497,27 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, sym->heap_alloc_site_v3.inst_len, sym->heap_alloc_site_v3.index); break;
+ case S_SEPCODE: + if (!top_func) + { + ULONG_PTR parent_addr = codeview_get_address(msc_dbg, sym->sepcode_v3.sectParent, sym->sepcode_v3.offParent); + struct symt_ht* parent = symt_find_nearest(msc_dbg->module, parent_addr); + if (symt_check_tag(&parent->symt, SymTagFunction)) + { + struct symt_function* pfunc = (struct symt_function*)parent; + top_func = symt_new_function(msc_dbg->module, compiland, pfunc->hash_elt.name, + codeview_get_address(msc_dbg, sym->sepcode_v3.sect, sym->sepcode_v3.off), + sym->sepcode_v3.length, pfunc->type); + curr_func = top_func; + } + else + WARN("Couldn't find function referenced by S_SEPCODE at %04x:%08x\n", + sym->sepcode_v3.sectParent, sym->sepcode_v3.offParent); + } + else + FIXME("S_SEPCODE inside top-level function %s\n", top_func->hash_elt.name); + break; + /* the symbols we can safely ignore for now */ case S_TRAMPOLINE: case S_FRAMEPROC: