[PATCH 02/10] dbghelp/dwarf: add vchildren field to SymTagExe's symt to retrieve all children (SymTagCompiland)

Eric Pouech eric.pouech at gmail.com
Fri Sep 24 10:32:21 CDT 2021


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            |    4 ++++
 3 files changed, 9 insertions(+)

diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index 2d4efafd041..a5a2f18b1e5 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 29376812653..dd4e20eeab7 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 29d8a5350a5..d02e27b4d64 100644
--- a/dlls/dbghelp/type.c
+++ b/dlls/dbghelp/type.c
@@ -538,6 +538,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 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;
@@ -583,6 +584,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 SymTagUDT:
             X(DWORD) = vector_length(&((const struct symt_udt*)type)->vchildren);
             break;




More information about the wine-devel mailing list