it happens to be generated for some inline functions, that we badly support yet
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dwarf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 0397ffe90b2..f05186eb9c0 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1236,7 +1236,7 @@ static BOOL dwarf2_read_range(dwarf2_parse_context_t* ctx, const dwarf2_debug_in if (high > *phigh) *phigh = high; } if (*plow == UMAX || *phigh == 0) {FIXME("no entry found\n"); return FALSE;} - if (*plow == *phigh) {FIXME("entry found, but low=high\n"); return FALSE;} + if (*plow == *phigh) {WARN("entry found, but low=high %lx %lx\n", low, high); return FALSE;}
return TRUE; } @@ -2002,7 +2002,7 @@ static void dwarf2_parse_inlined_subroutine(dwarf2_subprogram_t* subpgm,
if (!dwarf2_read_range(subpgm->ctx, di, &low_pc, &high_pc)) { - FIXME("cannot read range\n"); + WARN("cannot read range\n"); return; }
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;
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dwarf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 33c3b7fc467..51789f8591e 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1948,18 +1948,22 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm, } else { - /* variable has been optimized away... report anyway */ - loc.kind = loc_error; - loc.reg = loc_err_no_location; if (subpgm->func) { + /* local variable has been optimized away... report anyway */ + loc.kind = loc_error; + loc.reg = loc_err_no_location; symt_add_func_local(subpgm->ctx->module_ctx->module, subpgm->func, is_pmt ? DataIsParam : DataIsLocal, &loc, block, param_type, name.u.string); } else { - WARN("dropping global variable %s which has been optimized away\n", debugstr_a(name.u.string)); + struct attribute is_decl; + /* only warn when di doesn't represent a declaration */ + if (!dwarf2_find_attribute(di, DW_AT_declaration, &is_decl) || + !is_decl.u.uvalue || is_decl.gotten_from != attr_direct) + WARN("dropping global variable %s which has been optimized away\n", debugstr_a(name.u.string)); } } if (is_pmt && subpgm->func && symt_check_tag(subpgm->func->type, SymTagFunctionType))
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dwarf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 51789f8591e..430544196c5 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -2710,18 +2710,14 @@ static BOOL dwarf2_parse_compilation_unit_head(dwarf2_parse_context_t* ctx, if (max_supported_dwarf_version == 0) { char* env = getenv("DBGHELP_DWARF_VERSION"); - LONG v = env ? atol(env) : 2; - max_supported_dwarf_version = (v >= 2 && v <= 4) ? v : 2; + LONG v = env ? atol(env) : 4; + max_supported_dwarf_version = (v >= 2 && v <= 4) ? v : 4; }
if (ctx->head.version < 2 || ctx->head.version > max_supported_dwarf_version) { - if (max_supported_dwarf_version > 2) - WARN("%u DWARF version unsupported. Wine dbghelp only support DWARF 2 up to %u.\n", - ctx->head.version, max_supported_dwarf_version); - else - WARN("%u DWARF version unsupported. Wine dbghelp only support DWARF 2.\n", - ctx->head.version); + WARN("DWARF version %d isn't supported. Wine dbghelp only supports DWARF 2 up to %u.\n", + ctx->head.version, max_supported_dwarf_version); return FALSE; }
- added support in CROSSDEBUG for choosing which dwarf version is used for cross compiling Wine - added DEBUGFORMAT option to pick dwarf version for regular compilation
Default for both is still 2
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- configure.ac | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac index c0a126293c4..a019b4ac2d6 100644 --- a/configure.ac +++ b/configure.ac @@ -1036,16 +1036,20 @@ then then for ac_flag in $CROSSCFLAGS; do case $ac_flag in - -gdwarf*) CROSSDEBUG=dwarf ;; + -gdwarf*) CROSSDEBUG=$ac_flag ;; -gcodeview) CROSSDEBUG=pdb ;; -g) CROSSDEBUG=${CROSSDEBUG:-dwarf} ;; esac done fi case $CROSSDEBUG in - *dwarf) WINE_TRY_CROSSCFLAGS([-gdwarf-2]) - WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;; - pdb) WINE_TRY_CROSSCFLAGS([-gcodeview]) ;; + *dwarf-3) WINE_TRY_CROSSCFLAGS([-gdwarf-3]) + WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;; + *dwarf-4) WINE_TRY_CROSSCFLAGS([-gdwarf-4]) + WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;; + *dwarf|*dwarf-2) WINE_TRY_CROSSCFLAGS([-gdwarf-2]) + WINE_TRY_CROSSCFLAGS([-gstrict-dwarf]) ;; + pdb) WINE_TRY_CROSSCFLAGS([-gcodeview]) ;; esac
WINE_TRY_CROSSCFLAGS([-fexcess-precision=standard],[AC_SUBST(EXCESS_PRECISION_CFLAGS,"-fexcess-precision=standard")]) @@ -2040,9 +2044,10 @@ char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy= esac
dnl Default to dwarf-2 debug info + AC_SUBST(DEBUGFORMAT) for ac_flag in $CFLAGS; do case $ac_flag in - -g) WINE_TRY_CFLAGS([-gdwarf-2]) + -g) WINE_TRY_CFLAGS([-g${DEBUGFORMAT:-dwarf-2}]) WINE_TRY_CFLAGS([-gstrict-dwarf]) ;; esac done
Hi Eric,
On 9/28/21 3:44 PM, Eric Pouech wrote:
@@ -2040,9 +2044,10 @@ char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy= esac
dnl Default to dwarf-2 debug info
- AC_SUBST(DEBUGFORMAT) for ac_flag in $CFLAGS; do case $ac_flag in
-g) WINE_TRY_CFLAGS([-gdwarf-2])
done-g) WINE_TRY_CFLAGS([-g${DEBUGFORMAT:-dwarf-2}]) WINE_TRY_CFLAGS([-gstrict-dwarf]) ;; esac
Maybe we could make it a bit smarter, by scanning CFLAGS for explicit -gdwarf-X like CROSSDEBUG does. That should in fact make exposing DEBUGFORMAT redundant. In case of CROSSDEBUG, we also have split debug option that somehow needs to be passed to configure, but we don't have that for native parts. (Still, DEBUGFORMAT may be useful for convenience).
Thanks,
Jacek
Le 28/09/2021 à 16:04, Jacek Caban a écrit :
Hi Eric,
On 9/28/21 3:44 PM, Eric Pouech wrote:
@@ -2040,9 +2044,10 @@ char*f(const char *h,char n) {return strchr(h,n);}]])],[ac_cv_c_logicalop_noisy= esac dnl Default to dwarf-2 debug info + AC_SUBST(DEBUGFORMAT) for ac_flag in $CFLAGS; do case $ac_flag in - -g) WINE_TRY_CFLAGS([-gdwarf-2]) + -g) WINE_TRY_CFLAGS([-g${DEBUGFORMAT:-dwarf-2}]) WINE_TRY_CFLAGS([-gstrict-dwarf]) ;; esac done
Maybe we could make it a bit smarter, by scanning CFLAGS for explicit -gdwarf-X like CROSSDEBUG does. That should in fact make exposing DEBUGFORMAT redundant. In case of CROSSDEBUG, we also have split debug option that somehow needs to be passed to configure, but we don't have that for native parts. (Still, DEBUGFORMAT may be useful for convenience).
Thanks,
Jacek
Hi Jacek,
yes, that would be more coherent
going this path of coherency, would also require to have consistent naming between CROSSDEBUG and DEBUGFORMAT
I found the simple DEBUG a bit misleading, hence the DEBUGFORMAT choice
so renaming CROSSDEBUG into CROSSDEBUGFORMAT (or supporting both CROSSDEBUG and CROSSDEBUGFORMAT for easing the transition) would be even cleaner IMO
I'll resend along those lines
A+
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/type.c | 15 +++++++++++++-- include/cvconst.h | 14 +++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c index 29d8a5350a5..70719cf6b7c 100644 --- a/dlls/dbghelp/type.c +++ b/dlls/dbghelp/type.c @@ -62,9 +62,9 @@ static const char* symt_get_tag_str(DWORD tag) case SymTagBaseClass: return "SymTagBaseClass"; case SymTagFriend: return "SymTagFriend"; case SymTagFunctionArgType: return "SymTagFunctionArgType,"; - case SymTagFuncDebugStart: return "SymTagFuncDebugStart,"; + case SymTagFuncDebugStart: return "SymTagFuncDebugStart"; case SymTagFuncDebugEnd: return "SymTagFuncDebugEnd"; - case SymTagUsingNamespace: return "SymTagUsingNamespace,"; + case SymTagUsingNamespace: return "SymTagUsingNamespace"; case SymTagVTableShape: return "SymTagVTableShape"; case SymTagVTable: return "SymTagVTable"; case SymTagCustom: return "SymTagCustom"; @@ -72,6 +72,17 @@ static const char* symt_get_tag_str(DWORD tag) case SymTagCustomType: return "SymTagCustomType"; case SymTagManagedType: return "SymTagManagedType"; case SymTagDimension: return "SymTagDimension"; + case SymTagCallSite: return "SymTagCallSite"; + case SymTagInlineSite: return "SymTagInlineSite"; + case SymTagBaseInterface: return "SymTagBaseInterface"; + case SymTagVectorType: return "SymTagVectorType"; + case SymTagMatrixType: return "SymTagMatrixType"; + case SymTagHLSLType: return "SymTagHLSLType"; + case SymTagCaller: return "SymTagCaller"; + case SymTagCallee: return "SymTagCallee"; + case SymTagExport: return "SymTagExport"; + case SymTagHeapAllocationSite: return "SymTagHeapAllocationSite"; + case SymTagCoffGroup: return "SymTagCoffGroup"; default: return "---"; } } diff --git a/include/cvconst.h b/include/cvconst.h index 95fdc9c73e5..f90c61a57fa 100644 --- a/include/cvconst.h +++ b/include/cvconst.h @@ -55,6 +55,17 @@ enum SymTagEnum SymTagCustomType, SymTagManagedType, SymTagDimension, + SymTagCallSite, + SymTagInlineSite, + SymTagBaseInterface, + SymTagVectorType, + SymTagMatrixType, + SymTagHLSLType, + SymTagCaller, + SymTagCallee, + SymTagExport, + SymTagHeapAllocationSite, + SymTagCoffGroup, SymTagMax };
@@ -103,7 +114,8 @@ enum LocationType LocIsSlot, LocIsIlRel, LocInMetaData, - LocIsConstant + LocIsConstant, + LocTypeMax };
/* kind of SymTagData */