From 46c12b2971a9514ec80ca48017c7fce1bc91f6fe Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 30 Aug 2021 09:24:48 +0200 Subject: [PATCH] dbghelp: Enums should be found by name (as UDTs are). Signed-off-by: Eric Pouech Signed-off-by: Alexandre Julliard --- dlls/dbghelp/dbghelp_private.h | 2 +- dlls/dbghelp/type.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 0e5c1826108..2906a5df6c3 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -270,8 +270,8 @@ struct symt_basic struct symt_enum { struct symt symt; + struct hash_table_elt hash_elt; struct symt* base_type; - const char* name; struct vector vchildren; }; diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 56673a7e4c4..da4fc1a0a9d 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -88,7 +88,7 @@ const char* symt_get_name(const struct symt* sym) case SymTagLabel: return ((const struct symt_hierarchy_point*)sym)->hash_elt.name; case SymTagThunk: return ((const struct symt_thunk*)sym)->hash_elt.name; /* hierarchy tree */ - case SymTagEnum: return ((const struct symt_enum*)sym)->name; + case SymTagEnum: return ((const struct symt_enum*)sym)->hash_elt.name; case SymTagTypedef: return ((const struct symt_typedef*)sym)->hash_elt.name; case SymTagUDT: return ((const struct symt_udt*)sym)->hash_elt.name; case SymTagCompiland: return source_get(((const struct symt_compiland*)sym)->container->module, @@ -307,12 +307,19 @@ struct symt_enum* symt_new_enum(struct module* module, const char* typename, { struct symt_enum* sym; + TRACE_(dbghelp_symt)("Adding enum %s:%s\n", + debugstr_w(module->module.ModuleName), typename); if ((sym = pool_alloc(&module->pool, sizeof(*sym)))) { sym->symt.tag = SymTagEnum; - sym->name = (typename) ? pool_strdup(&module->pool, typename) : NULL; + if (typename) + { + sym->hash_elt.name = pool_strdup(&module->pool, typename); + hash_table_add(&module->ht_types, &sym->hash_elt); + } else sym->hash_elt.name = NULL; sym->base_type = basetype; vector_init(&sym->vchildren, sizeof(struct symt*), 8); + symt_add_type(module, &sym->symt); } return sym; }