[PATCH 1/9] dbghelp/dwarf: better handling of SymTagExe and SymTagCompiland
Eric Pouech
eric.pouech at gmail.com
Tue Oct 5 07:25:04 CDT 2021
- children of SymTagExe and SymTagCompiland can now be enumerated
- SymTagCompiland's lexical parent is now reported to SymTagExe
- native doesn't expose compiland's address, so don't expose it
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
---
dlls/dbghelp/dbghelp_private.h | 1 +
dlls/dbghelp/symbol.c | 4 ++++
dlls/dbghelp/type.c | 16 +++++++++++++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index 0587ce13914..2fc5a7e5eca 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -169,6 +169,7 @@ struct symt_block
struct symt_module /* in fact any of .exe, .dll... */
{
struct symt symt; /* module */
+ struct vector vchildren; /* compilation units */
struct module* module;
};
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index e2fde00456a..091ea173305 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -191,6 +191,7 @@ struct symt_module* symt_new_module(struct module* module)
{
sym->symt.tag = SymTagExe;
sym->module = module;
+ vector_init(&sym->vchildren, sizeof(struct symt*), 8);
}
return sym;
}
@@ -199,6 +200,7 @@ struct symt_compiland* symt_new_compiland(struct module* module,
ULONG_PTR address, unsigned src_idx)
{
struct symt_compiland* sym;
+ struct symt_compiland** p;
TRACE_(dbghelp_symt)("Adding compiland symbol %s:%s\n",
debugstr_w(module->modulename), source_get(module, src_idx));
@@ -210,6 +212,8 @@ struct symt_compiland* symt_new_compiland(struct module* module,
sym->source = src_idx;
vector_init(&sym->vchildren, sizeof(struct symt*), 32);
sym->user = NULL;
+ p = vector_add(&module->top->vchildren, &module->pool);
+ *p = sym;
}
return sym;
}
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c
index 70719cf6b7c..4eb230e2755 100644
--- a/dlls/dbghelp/type.c
+++ b/dlls/dbghelp/type.c
@@ -158,11 +158,10 @@ BOOL symt_get_address(const struct symt* type, ULONG64* addr)
case SymTagThunk:
*addr = ((const struct symt_thunk*)type)->address;
break;
- case SymTagCompiland:
- *addr = ((const struct symt_compiland*)type)->address;
- break;
default:
FIXME("Unsupported sym-tag %s for get-address\n", symt_get_tag_str(type->tag));
+ /* fall through */
+ case SymTagCompiland:
return FALSE;
}
return TRUE;
@@ -549,6 +548,8 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
switch (type->tag)
{
+ case SymTagExe: v = &((const struct symt_module*)type)->vchildren; break;
+ case SymTagCompiland: v = &((const struct symt_compiland*)type)->vchildren; break;
case SymTagUDT: v = &((const struct symt_udt*)type)->vchildren; break;
case SymTagEnum: v = &((const struct symt_enum*)type)->vchildren; break;
case SymTagFunctionType: v = &((const struct symt_function_signature*)type)->vchildren; break;
@@ -594,6 +595,12 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
case TI_GET_CHILDRENCOUNT:
switch (type->tag)
{
+ case SymTagExe:
+ X(DWORD) = vector_length(&((const struct symt_module*)type)->vchildren);
+ break;
+ case SymTagCompiland:
+ X(DWORD) = vector_length(&((const struct symt_compiland*)type)->vchildren);
+ break;
case SymTagUDT:
X(DWORD) = vector_length(&((const struct symt_udt*)type)->vchildren);
break;
@@ -697,6 +704,9 @@ BOOL symt_get_info(struct module* module, const struct symt* type,
case TI_GET_LEXICALPARENT:
switch (type->tag)
{
+ case SymTagCompiland:
+ X(DWORD) = symt_ptr2index(module, &((const struct symt_compiland*)type)->container->symt);
+ break;
case SymTagBlock:
X(DWORD) = symt_ptr2index(module, ((const struct symt_block*)type)->container);
break;
More information about the wine-devel
mailing list