Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dbghelp_private.h | 4 ++++ dlls/dbghelp/dwarf.c | 15 +++++++++++---- dlls/dbghelp/symbol.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 2d4efafd041..0587ce13914 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -756,6 +756,10 @@ extern struct symt_data* enum DataKind dt, const struct location* loc, struct symt_block* block, struct symt* type, const char* name) DECLSPEC_HIDDEN; +extern struct symt_data* + symt_add_func_constant(struct module* module, + struct symt_function* func, struct symt_block* block, + struct symt* type, const char* name, VARIANT* v) DECLSPEC_HIDDEN; extern struct symt_block* symt_open_func_block(struct module* module, struct symt_function* func, diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index f05186eb9c0..33c3b7fc467 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1880,8 +1880,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm, else if (dwarf2_find_attribute(di, DW_AT_const_value, &value)) { VARIANT v; - if (subpgm->func) WARN("Unsupported constant %s in function\n", debugstr_a(name.u.string)); - if (is_pmt) FIXME("Unsupported constant (parameter) %s in function\n", debugstr_a(name.u.string)); + switch (value.form) { case DW_FORM_data1: @@ -1936,8 +1935,16 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm, debugstr_a(name.u.string), value.form); v.n1.n2.vt = VT_EMPTY; } - di->symt = &symt_new_constant(subpgm->ctx->module_ctx->module, subpgm->ctx->compiland, - name.u.string, param_type, &v)->symt; + if (subpgm->func) + { + if (is_pmt) FIXME("Unsupported constant (parameter) %s in function '%s'\n", debugstr_a(name.u.string), subpgm->func->hash_elt.name); + di->symt = &symt_add_func_constant(subpgm->ctx->module_ctx->module, + subpgm->func, block, + param_type, name.u.string, &v)->symt; + } + else + di->symt = &symt_new_constant(subpgm->ctx->module_ctx->module, subpgm->ctx->compiland, + name.u.string, param_type, &v)->symt; } else { diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 29376812653..e2fde00456a 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -409,6 +409,42 @@ struct symt_data* symt_add_func_local(struct module* module, return locsym; }
+/****************************************************************** + * symt_add_func_local + * + * Adds a new (local) constant to a given function + */ +struct symt_data* symt_add_func_constant(struct module* module, + struct symt_function* func, + struct symt_block* block, + struct symt* type, const char* name, + VARIANT* v) +{ + struct symt_data* locsym; + struct symt** p; + + TRACE_(dbghelp_symt)("Adding local constant (%s:%s): %s %p\n", + debugstr_w(module->modulename), func->hash_elt.name, + name, type); + + assert(func); + assert(func->symt.tag == SymTagFunction); + + locsym = pool_alloc(&module->pool, sizeof(*locsym)); + locsym->symt.tag = SymTagData; + locsym->hash_elt.name = pool_strdup(&module->pool, name); + locsym->hash_elt.next = NULL; + locsym->kind = DataIsConstant; + locsym->container = block ? &block->symt : &func->symt; + locsym->type = type; + locsym->u.value = *v; + if (block) + p = vector_add(&block->vchildren, &module->pool); + else + p = vector_add(&func->vchildren, &module->pool); + *p = &locsym->symt; + return locsym; +}
struct symt_block* symt_open_func_block(struct module* module, struct symt_function* func, @@ -653,6 +689,9 @@ static void symt_fill_sym_info(struct module_pair* pair, break; case DataIsConstant: sym_info->Flags |= SYMFLAG_VALUEPRESENT; + if (data->container && + (data->container->tag == SymTagFunction || data->container->tag == SymTagBlock)) + sym_info->Flags |= SYMFLAG_LOCAL; switch (data->u.value.n1.n2.vt) { case VT_I4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.lVal; break;