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

Alexandre Julliard julliard at winehq.org
Wed Oct 6 15:51:36 CDT 2021


Module: wine
Branch: master
Commit: 24a7de70a62f79f8642d7af248ce26d54fef0cf0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=24a7de70a62f79f8642d7af248ce26d54fef0cf0

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Wed Oct  6 10:00:53 2021 +0200

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

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dbghelp/dbghelp_private.h | 1 +
 dlls/dbghelp/symbol.c          | 4 ++++
 dlls/dbghelp/type.c            | 7 +++++++
 3 files changed, 12 insertions(+)

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 91c334689ce..ae601c0cda2 100644
--- a/dlls/dbghelp/type.c
+++ b/dlls/dbghelp/type.c
@@ -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;




More information about the wine-cvs mailing list