[PATCH 04/22] [DbgHelp]: compiland's address
Eric Pouech
eric.pouech at wanadoo.fr
Fri Nov 24 15:17:21 CST 2006
- now storing compiland's address in internal structures
- and returning it when needed
A+
---
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 a344ac9..9bdf0bf 100644
--- a/dlls/dbghelp/coff.c
+++ b/dlls/dbghelp/coff.c
@@ -120,7 +120,8 @@ static int coff_add_file(struct CoffFile
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 ee1f711..5eae51a 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
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 aa5aa89..9c08bb5 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -1807,7 +1807,7 @@ static BOOL dwarf2_parse_compilation_uni
{
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_uni
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 5f795be..8af876c 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -325,7 +325,11 @@ static void elf_hash_symtab(struct modul
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 f91b063..b9b3d5a 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -1471,7 +1471,7 @@ static int codeview_snarf(const struct m
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 e8fec4b..f90c62a 100644
--- a/dlls/dbghelp/stabs.c
+++ b/dlls/dbghelp/stabs.c
@@ -1451,7 +1451,7 @@ BOOL stabs_parse(struct module* module,
{
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 a575ffe..a3cd0c7 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -125,7 +125,8 @@ static void compile_regex(const char* st
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_compilan
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 da8d679..a50448b 100644
--- a/dlls/dbghelp/type.c
+++ b/dlls/dbghelp/type.c
@@ -490,6 +490,9 @@ #define X(_t) (*((_t*)pInfo))
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));
More information about the wine-patches
mailing list