dbghelp: Use same compiland's pathname as native (PDB).

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>
This commit is contained in:
Eric Pouech 2022-11-17 10:50:48 +01:00 committed by Alexandre Julliard
parent 22e9093c80
commit e37f1ada64

View file

@ -2247,7 +2247,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;
@ -2257,6 +2258,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.
@ -2517,16 +2521,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:
@ -3775,11 +3781,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");
@ -3791,8 +3798,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 */
@ -4284,7 +4291,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