dbghelp: Manage parent/child relationship between SymTagExe and SymTagCompiland.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2021-10-06 10:00:53 +02:00 committed by Alexandre Julliard
parent 8e50fea66b
commit 24a7de70a6
3 changed files with 12 additions and 0 deletions

View File

@ -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;
};

View File

@ -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;
}

View File

@ -549,6 +549,7 @@ 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;
@ -595,6 +596,9 @@ 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;
@ -703,6 +707,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;