From: Eric Pouech <epouech@codeweavers.com> Only storing the compiland in top's children when this symref is a symt ptr. Signed-off-by: Eric Pouech <epouech@codeweavers.com> --- dlls/dbghelp/coff.c | 2 +- dlls/dbghelp/dbghelp_private.h | 2 +- dlls/dbghelp/dwarf.c | 2 +- dlls/dbghelp/elf_module.c | 2 +- dlls/dbghelp/msc.c | 2 +- dlls/dbghelp/pdb.c | 2 +- dlls/dbghelp/pe_module.c | 2 +- dlls/dbghelp/stabs.c | 2 +- dlls/dbghelp/symbol.c | 12 ++++++++---- 9 files changed, 16 insertions(+), 12 deletions(-) diff --git a/dlls/dbghelp/coff.c b/dlls/dbghelp/coff.c index d4d804d935e..855d17342f4 100644 --- a/dlls/dbghelp/coff.c +++ b/dlls/dbghelp/coff.c @@ -114,7 +114,7 @@ static int coff_add_file(struct CoffFileSet* coff_files, struct module* module, file = coff_files->files + coff_files->nfiles; file->startaddr = 0xffffffff; file->endaddr = 0; - file->compiland = symt_new_compiland(module, filename); + file->compiland = symt_new_compiland(module, symt_ptr_to_symref(&module->top->symt), filename); file->linetab_offset = -1; file->linecnt = 0; file->entries = NULL; diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 20892db8cda..00ddc77c51e 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -919,7 +919,7 @@ extern struct symt_ht* extern struct symt_module* symt_new_module(struct module* module); extern struct symt_compiland* - symt_new_compiland(struct module* module, const char *filename); + symt_new_compiland(struct module* module, symref_t parent, const char *filename); extern struct symt_public* symt_new_public(struct module* module, struct symt_compiland* parent, diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 4f1908aff09..faf05564345 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -3063,7 +3063,7 @@ static BOOL dwarf2_parse_compilation_unit(dwarf2_parse_context_t* ctx) ctx->language = language.u.uvalue; tmp = source_build_path(comp_dir.u.string, name.u.string); - ctx->compiland = symt_new_compiland(ctx->module_ctx->module, tmp); + ctx->compiland = symt_new_compiland(ctx->module_ctx->module, symt_ptr_to_symref(&ctx->module_ctx->module->top->symt), tmp); HeapFree(GetProcessHeap(), 0, tmp); ctx->compiland->address = ctx->module_ctx->load_offset + low_pc.u.uvalue; dwarf2_cache_cuhead(ctx->module_ctx->module, ctx->module_ctx->module->format_info[DFI_DWARF]->u.dwarf2_info, ctx->compiland, &ctx->head); diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index 81f933c76ef..2a7d9bde8d5 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -698,7 +698,7 @@ static void elf_hash_symtab(struct module* module, struct pool* pool, { case ELF_STT_FILE: if (symname) - compiland = symt_new_compiland(module, symname); + compiland = symt_new_compiland(module, symt_ptr_to_symref(&module->top->symt), symname); else compiland = NULL; continue; diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 1a75dab70ac..135ffbe8c83 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -2295,7 +2295,7 @@ static struct symt_compiland* codeview_new_compiland(const struct msc_debug_info if (symt_check_tag(&p->symt, SymTagCompiland) && !strcmp(p->filename, objname)) return p; } - return symt_new_compiland(msc_dbg->module, objname); + return symt_new_compiland(msc_dbg->module, symt_ptr_to_symref(&msc_dbg->module->top->symt), objname); } static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, diff --git a/dlls/dbghelp/pdb.c b/dlls/dbghelp/pdb.c index 18bfa538665..7cfe922849e 100644 --- a/dlls/dbghelp/pdb.c +++ b/dlls/dbghelp/pdb.c @@ -4871,7 +4871,7 @@ static enum pdb_result pdb_reader_ensure_symbols_loaded_from_compiland(struct pd if ((result = pdb_reader_walker_init(pdb, PDB_STREAM_DBI, &walker))) return result; walker.offset = compiland->stream_offset; if ((result = pdb_reader_alloc_and_fetch_string(pdb, &walker, &obj_name))) return result; - compiland->compiland = symt_new_compiland(pdb->module, obj_name); + compiland->compiland = symt_new_compiland(pdb->module, symt_ptr_to_symref(&pdb->module->top->symt), obj_name); pdb_reader_free(pdb, obj_name); if ((result = pdb_reader_walker_init(pdb, compiland->compiland_stream_id, &walker))) return result; diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 44122d385cb..7c30fa2f9f3 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -522,7 +522,7 @@ static BOOL pe_load_coff_symbol_table(struct module* module) if (name[0] == '_') name++; if (!compiland && lastfilename) - compiland = symt_new_compiland(module, lastfilename); + compiland = symt_new_compiland(module, symt_ptr_to_symref(&module->top->symt), lastfilename); if (!(dbghelp_options & SYMOPT_NO_PUBLICS)) symt_new_public(module, compiland, name, FALSE, diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c index 8aa9907449c..1a2ddb7fb60 100644 --- a/dlls/dbghelp/stabs.c +++ b/dlls/dbghelp/stabs.c @@ -1587,7 +1587,7 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset, { stabs_reset_includes(); source_idx = source_new(module, srcpath, ptr); - compiland = symt_new_compiland(module, source_get(module, source_idx)); + compiland = symt_new_compiland(module, symt_ptr_to_symref(&module->top->symt), source_get(module, source_idx)); } else { diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index e786dc61e66..8c7dd280d01 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -231,7 +231,7 @@ struct symt_module* symt_new_module(struct module* module) return sym; } -struct symt_compiland* symt_new_compiland(struct module* module, const char *filename) +struct symt_compiland* symt_new_compiland(struct module* module, symref_t parent, const char *filename) { struct symt_compiland* sym; symref_t* p; @@ -241,13 +241,17 @@ struct symt_compiland* symt_new_compiland(struct module* module, const char *fil if ((sym = pool_alloc(&module->pool, sizeof(*sym)))) { sym->symt.tag = SymTagCompiland; - sym->container = symt_ptr_to_symref(&module->top->symt); + sym->container = parent; sym->address = 0; sym->filename = pool_strdup(&module->pool, filename); vector_init(&sym->vchildren, sizeof(symref_t), 0); sym->user = NULL; - p = vector_add(&module->top->vchildren, &module->pool); - if (p) *p = symt_ptr_to_symref(&sym->symt); + if (symt_is_symref_ptr(parent)) + { + if (parent != symt_ptr_to_symref(&module->top->symt)) FIXME("Unexpected parent\n"); + p = vector_add(&module->top->vchildren, &module->pool); + if (p) *p = symt_ptr_to_symref(&sym->symt); + } } return sym; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10018