From: Eric Pouech <eric.pouech(a)gmail.com> In PDB debug information, compiland's pathname is stored twice: - both refer to the same file, but with variations in path handling (eg: one could be foo1\foo2\bar.obj and the other foo1\deadbeef\..\foo2\bar.obj) Use same pathname string as native when storing compiland's pathname (it eases comparison of dumps between the two). Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> --- dlls/dbghelp/msc.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 85d12063076..e75d67ea432 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2246,7 +2246,8 @@ static struct symt_function* codeview_create_inline_site(const struct msc_debug_ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* root, unsigned offset, unsigned size, - const struct cv_module_snarf* cvmod) + const struct cv_module_snarf* cvmod, + const char* objname) { struct symt_function* top_func = NULL; struct symt_function* curr_func = NULL; @@ -2256,6 +2257,9 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, struct symt_compiland* compiland = NULL; struct location loc; + /* overwrite compiland name from outter context (if any) */ + if (objname) + compiland = symt_new_compiland(msc_dbg->module, source_new(msc_dbg->module, NULL, objname)); /* * Loop over the different types of records and whenever we * find something we are interested in, record it and move on. @@ -2516,16 +2520,18 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, case S_OBJNAME: TRACE("S-ObjName-V3 %s\n", sym->objname_v3.name); - compiland = symt_new_compiland(msc_dbg->module, - source_new(msc_dbg->module, NULL, - sym->objname_v3.name)); + if (!compiland) + compiland = symt_new_compiland(msc_dbg->module, + source_new(msc_dbg->module, NULL, + sym->objname_v3.name)); break; case S_OBJNAME_ST: TRACE("S-ObjName-V1 %s\n", terminate_string(&sym->objname_v1.p_name)); - compiland = symt_new_compiland(msc_dbg->module, - source_new(msc_dbg->module, NULL, - terminate_string(&sym->objname_v1.p_name))); + if (!compiland) + compiland = symt_new_compiland(msc_dbg->module, + source_new(msc_dbg->module, NULL, + terminate_string(&sym->objname_v1.p_name))); break; case S_LABEL32_ST: @@ -3774,11 +3780,12 @@ static BOOL pdb_process_internal(const struct process* pcs, pdb_convert_symbol_file(&symbols, &sfile, &size, file); modimage = pdb_read_file(pdb_file, sfile.file); + file_name = (const char*)file + size; if (modimage) { struct cv_module_snarf cvmod = {ipi_ok ? &ipi_ctp : NULL, (const void*)(modimage + sfile.symbol_size), sfile.lineno2_size, files_image}; - codeview_snarf(msc_dbg, modimage, sizeof(DWORD), sfile.symbol_size, &cvmod); + codeview_snarf(msc_dbg, modimage, sizeof(DWORD), sfile.symbol_size, &cvmod, file_name); if (sfile.lineno_size && sfile.lineno2_size) FIXME("Both line info present... only supporting second\n"); @@ -3790,8 +3797,8 @@ static BOOL pdb_process_internal(const struct process* pcs, pdb_free(modimage); } - file_name = (const char*)file + size; file_name += strlen(file_name) + 1; + /* now at lib_name */ file = (BYTE*)((DWORD_PTR)(file_name + strlen(file_name) + 1 + 3) & ~3); } /* Load the global variables and constants (if not yet loaded) and public information */ @@ -4283,7 +4290,7 @@ static BOOL codeview_process_info(const struct process* pcs, if (ent->SubSection == sstAlignSym) { - codeview_snarf(msc_dbg, msc_dbg->root + ent->lfo, sizeof(DWORD), ent->cb, NULL); + codeview_snarf(msc_dbg, msc_dbg->root + ent->lfo, sizeof(DWORD), ent->cb, NULL, NULL); /* * Check the next and previous entry. If either is a -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1413