From 1a723f237c2b11534ceac8fa8db7b511db4a017b Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Fri, 24 Nov 2006 22:17:21 +0100 Subject: [PATCH] dbghelp: Store compiland's address in internal structures. --- dlls/dbghelp/coff.c | 3 ++- dlls/dbghelp/dbghelp_private.h | 4 +++- dlls/dbghelp/dwarf.c | 8 ++++++-- dlls/dbghelp/elf_module.c | 6 +++++- dlls/dbghelp/msc.c | 2 +- dlls/dbghelp/stabs.c | 2 +- dlls/dbghelp/symbol.c | 4 +++- dlls/dbghelp/type.c | 3 +++ 8 files changed, 24 insertions(+), 8 deletions(-) diff --git a/dlls/dbghelp/coff.c b/dlls/dbghelp/coff.c index a344ac984b6..9bdf0bfbf92 100644 --- a/dlls/dbghelp/coff.c +++ b/dlls/dbghelp/coff.c @@ -120,7 +120,8 @@ 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, source_new(module, NULL, filename)); + file->compiland = symt_new_compiland(module, 0, + source_new(module, NULL, 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 ee1f7118964..5eae51a5571 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -137,6 +137,7 @@ struct symt_block struct symt_compiland { struct symt symt; + unsigned long address; unsigned source; struct vector vchildren; /* global variables & functions */ }; @@ -447,7 +448,8 @@ extern const char* symt_get_name(const struct symt* sym); extern int symt_cmp_addr(const void* p1, const void* p2); extern int symt_find_nearest(struct module* module, DWORD addr); extern struct symt_compiland* - symt_new_compiland(struct module* module, unsigned src_idx); + symt_new_compiland(struct module* module, unsigned long address, + unsigned src_idx); 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 aa5aa89deb1..9c08bb5cb90 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1807,7 +1807,7 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections, { struct attribute name; dwarf2_debug_info_t** pdi = NULL; - struct attribute stmt_list; + struct attribute stmt_list, low_pc; struct attribute comp_dir; dwarf2_find_name(&ctx, di, &name, "compiland"); @@ -1816,7 +1816,11 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections, if (!dwarf2_find_attribute(&ctx, di, DW_AT_comp_dir, &comp_dir)) comp_dir.u.string = NULL; - di->symt = &symt_new_compiland(module, source_new(module, comp_dir.u.string, name.u.string))->symt; + if (!dwarf2_find_attribute(&ctx, di, DW_AT_low_pc, &low_pc)) + low_pc.u.uvalue = 0; + di->symt = &symt_new_compiland(module, + module->module.BaseOfImage + low_pc.u.uvalue, + source_new(module, comp_dir.u.string, name.u.string))->symt; if (di->abbrev->have_child) { diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index 171dd5ab5c6..a9a3bf3b586 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -325,7 +325,11 @@ static void elf_hash_symtab(struct module* module, struct pool* pool, switch (ELF32_ST_TYPE(symp->st_info)) { case STT_FILE: - compiland = symname ? symt_new_compiland(module, source_new(module, NULL, symname)) : NULL; + if (symname) + compiland = symt_new_compiland(module, symp->st_value, + source_new(module, NULL, symname)); + else + compiland = NULL; continue; case STT_NOTYPE: /* we are only interested in wine markers inserted by winebuild */ diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index a0b4960d929..de83b9e6d79 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -1465,7 +1465,7 @@ static int codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* root case S_OBJNAME_V1: TRACE("S-ObjName %s\n", terminate_string(&sym->objname_v1.p_name)); - compiland = symt_new_compiland(msc_dbg->module, + compiland = symt_new_compiland(msc_dbg->module, 0 /* FIXME */, source_new(msc_dbg->module, NULL, terminate_string(&sym->objname_v1.p_name))); break; diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c index e8fec4b6860..f90c62a9de1 100644 --- a/dlls/dbghelp/stabs.c +++ b/dlls/dbghelp/stabs.c @@ -1451,7 +1451,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset, { stabs_reset_includes(); source_idx = source_new(module, srcpath, ptr); - compiland = symt_new_compiland(module, source_idx); + compiland = symt_new_compiland(module, 0 /* FIXME */, source_idx); } else strcpy(srcpath, ptr); diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index a575ffef020..a3cd0c79206 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -125,7 +125,8 @@ static void compile_regex(const char* str, int numchar, regex_t* re, BOOL _case) HeapFree(GetProcessHeap(), 0, mask); } -struct symt_compiland* symt_new_compiland(struct module* module, unsigned src_idx) +struct symt_compiland* symt_new_compiland(struct module* module, + unsigned long address, unsigned src_idx) { struct symt_compiland* sym; @@ -134,6 +135,7 @@ struct symt_compiland* symt_new_compiland(struct module* module, unsigned src_id if ((sym = pool_alloc(&module->pool, sizeof(*sym)))) { sym->symt.tag = SymTagCompiland; + sym->address = address; sym->source = src_idx; vector_init(&sym->vchildren, sizeof(struct symt*), 32); } diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index da8d679e125..a50448b95d2 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -490,6 +490,9 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req, case SymTagThunk: X(ULONG64) = ((const struct symt_thunk*)type)->address; break; + case SymTagCompiland: + X(ULONG64) = ((const struct symt_compiland*)type)->address; + break; default: FIXME("Unsupported sym-tag %s for get-address\n", symt_get_tag_str(type->tag)); -- 2.11.4.GIT