Adjustements to mimic native behavior regarding compilands' handling.
From: Eric Pouech eric.pouech@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@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
From: Eric Pouech eric.pouech@gmail.com
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/dbghelp/msc.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index e75d67ea432..0736fa08b36 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2244,6 +2244,24 @@ static struct symt_function* codeview_create_inline_site(const struct msc_debug_ return inlined; }
+static struct symt_compiland* codeview_new_compiland(const struct msc_debug_info* msc_dbg, const char* objname) +{ + unsigned int src_idx = source_new(msc_dbg->module, NULL, objname); + unsigned int i; + + /* In some cases MSVC generates several compiland entries with same pathname in PDB file. + * (for example: for an import library, one compiland entry per imported function is generated). + * But native dbghelp (in this case) merges in a single compiland instance. + */ + for (i = 0; i < msc_dbg->module->top->vchildren.num_elts; i++) + { + struct symt_compiland** p = vector_at(&msc_dbg->module->top->vchildren, i); + if (symt_check_tag(&(*p)->symt, SymTagCompiland) && (*p)->source == src_idx) + return *p; + } + return symt_new_compiland(msc_dbg->module, src_idx); +} + static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* root, unsigned offset, unsigned size, const struct cv_module_snarf* cvmod, @@ -2259,7 +2277,7 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg,
/* overwrite compiland name from outter context (if any) */ if (objname) - compiland = symt_new_compiland(msc_dbg->module, source_new(msc_dbg->module, NULL, objname)); + compiland = codeview_new_compiland(msc_dbg, objname); /* * Loop over the different types of records and whenever we * find something we are interested in, record it and move on. @@ -2521,17 +2539,13 @@ static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, case S_OBJNAME: TRACE("S-ObjName-V3 %s\n", sym->objname_v3.name); if (!compiland) - compiland = symt_new_compiland(msc_dbg->module, - source_new(msc_dbg->module, NULL, - sym->objname_v3.name)); + compiland = codeview_new_compiland(msc_dbg, sym->objname_v3.name); break;
case S_OBJNAME_ST: TRACE("S-ObjName-V1 %s\n", 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))); + compiland = codeview_new_compiland(msc_dbg, terminate_string(&sym->objname_v1.p_name)); break;
case S_LABEL32_ST:
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126294
Your paranoid android.
=== debian11 (build log) ===
07c0:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this. 07c0:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this. 07c0:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this.