[WINESYNC] dbghelp: Recompute location after fixing it.

Fix a assertion raised by every exception with newer clang versions (>3.7) at least on ARM64:
../../../dlls/dbghelp/dwarf.c:1641: void dwarf2_parse_variable(dwarf2_subprogram_t *, struct symt_block *, dwarf2_debug_info_t *): Assertion `subpgm->func' failed.

Signed-off-by: André Hentschel <nerv@dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id 3d482d3f9f0a3ffa69540af87594b3c1dc46e07b by André Hentschel <nerv@dawncrow.de>
This commit is contained in:
winesync 2020-09-11 13:14:08 +02:00 committed by Jérôme Gardou
parent d119141669
commit d3247b3f59
2 changed files with 20 additions and 19 deletions

View file

@ -373,9 +373,9 @@ static unsigned long dwarf2_parse_addr(dwarf2_traverse_context_t* ctx)
return ret;
}
static const char* dwarf2_debug_traverse_ctx(const dwarf2_traverse_context_t* ctx)
static const char* dwarf2_debug_traverse_ctx(const dwarf2_traverse_context_t* ctx)
{
return wine_dbg_sprintf("ctx(%p)", ctx->data);
return wine_dbg_sprintf("ctx(%p)", ctx->data);
}
static const char* dwarf2_debug_ctx(const dwarf2_parse_context_t* ctx)
@ -398,7 +398,7 @@ dwarf2_abbrev_table_find_entry(const struct sparse_array* abbrev_table,
return sparse_array_find(abbrev_table, entry_code);
}
static void dwarf2_parse_abbrev_set(dwarf2_traverse_context_t* abbrev_ctx,
static void dwarf2_parse_abbrev_set(dwarf2_traverse_context_t* abbrev_ctx,
struct sparse_array* abbrev_table,
struct pool* pool)
{
@ -412,17 +412,17 @@ static void dwarf2_parse_abbrev_set(dwarf2_traverse_context_t* abbrev_ctx,
assert( NULL != abbrev_ctx );
TRACE("%s, end at %p\n",
dwarf2_debug_traverse_ctx(abbrev_ctx), abbrev_ctx->end_data);
dwarf2_debug_traverse_ctx(abbrev_ctx), abbrev_ctx->end_data);
sparse_array_init(abbrev_table, sizeof(dwarf2_abbrev_entry_t), 32);
while (abbrev_ctx->data < abbrev_ctx->end_data)
{
TRACE("now at %s\n", dwarf2_debug_traverse_ctx(abbrev_ctx));
TRACE("now at %s\n", dwarf2_debug_traverse_ctx(abbrev_ctx));
entry_code = dwarf2_leb128_as_unsigned(abbrev_ctx);
TRACE("found entry_code %lu\n", entry_code);
if (!entry_code)
{
TRACE("NULL entry code at %s\n", dwarf2_debug_traverse_ctx(abbrev_ctx));
TRACE("NULL entry code at %s\n", dwarf2_debug_traverse_ctx(abbrev_ctx));
break;
}
abbrev_entry = sparse_array_add(abbrev_table, entry_code, pool);
@ -556,7 +556,7 @@ static void dwarf2_fill_attr(const dwarf2_parse_context_t* ctx,
attr->u.uvalue = ctx->ref_offset + dwarf2_get_u4(data);
TRACE("ref4<0x%lx>\n", attr->u.uvalue);
break;
case DW_FORM_ref8:
FIXME("Unhandled 64-bit support\n");
break;
@ -585,7 +585,7 @@ static void dwarf2_fill_attr(const dwarf2_parse_context_t* ctx,
}
TRACE("strp<%s>\n", attr->u.string);
break;
case DW_FORM_block:
attr->u.block.size = dwarf2_get_leb128_as_unsigned(data, &attr->u.block.ptr);
break;
@ -953,6 +953,7 @@ static BOOL dwarf2_compute_location_attr(dwarf2_parse_context_t* ctx,
#else
loc->offset = (uintptr_t)ptr;
#endif
compute_location(&lctx, loc, NULL, frame);
}
}
return TRUE;
@ -1182,7 +1183,7 @@ static struct symt* dwarf2_parse_base_type(dwarf2_parse_context_t* ctx,
int cache_idx = -1;
if (di->symt) return di->symt;
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
if (!dwarf2_find_attribute(ctx, di, DW_AT_name, &name))
name.u.string = NULL;
@ -1234,7 +1235,7 @@ static struct symt* dwarf2_parse_typedef(dwarf2_parse_context_t* ctx,
if (di->symt) return di->symt;
TRACE("%s, for %lu\n", dwarf2_debug_ctx(ctx), di->abbrev->entry_code);
TRACE("%s, for %lu\n", dwarf2_debug_ctx(ctx), di->abbrev->entry_code);
if (!dwarf2_find_attribute(ctx, di, DW_AT_name, &name)) name.u.string = NULL;
ref_type = dwarf2_lookup_type(ctx, di);
@ -1253,7 +1254,7 @@ static struct symt* dwarf2_parse_pointer_type(dwarf2_parse_context_t* ctx,
if (di->symt) return di->symt;
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = sizeof(void *);
if (!(ref_type = dwarf2_lookup_type(ctx, di)))
@ -1443,7 +1444,7 @@ static void dwarf2_parse_udt_member(dwarf2_parse_context_t* ctx,
bit_offset.u.uvalue = nbytes.u.uvalue * 8 - bit_offset.u.uvalue - bit_size.u.uvalue;
}
else bit_offset.u.uvalue = 0;
symt_add_udt_element(ctx->module, parent, name.u.string, elt_type,
symt_add_udt_element(ctx->module, parent, name.u.string, elt_type,
(loc.offset << 3) + bit_offset.u.uvalue,
bit_size.u.uvalue);
@ -1465,7 +1466,7 @@ static struct symt* dwarf2_parse_udt_type(dwarf2_parse_context_t* ctx,
if (di->symt) return di->symt;
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
/* quirk... FIXME provide real support for anonymous UDTs */
if (!dwarf2_find_attribute(ctx, di, DW_AT_name, &name))
@ -1530,7 +1531,7 @@ static void dwarf2_parse_enumerator(dwarf2_parse_context_t* ctx,
struct attribute name;
struct attribute value;
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
if (!dwarf2_find_attribute(ctx, di, DW_AT_name, &name)) return;
if (!dwarf2_find_attribute(ctx, di, DW_AT_const_value, &value)) value.u.svalue = 0;
@ -1551,7 +1552,7 @@ static struct symt* dwarf2_parse_enumeration_type(dwarf2_parse_context_t* ctx,
if (di->symt) return di->symt;
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
if (!dwarf2_find_attribute(ctx, di, DW_AT_name, &name)) name.u.string = NULL;
if (!dwarf2_find_attribute(ctx, di, DW_AT_byte_size, &size)) size.u.uvalue = 4;
@ -1612,7 +1613,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
is_pmt = !block && di->abbrev->tag == DW_TAG_formal_parameter;
param_type = dwarf2_lookup_type(subpgm->ctx, di);
if (!dwarf2_find_attribute(subpgm->ctx, di, DW_AT_name, &name)) {
/* cannot do much without the name, the functions below won't like it. */
return;
@ -1649,7 +1650,7 @@ static void dwarf2_parse_variable(dwarf2_subprogram_t* subpgm,
* pmt/variable in a register
*/
assert(subpgm->func);
symt_add_func_local(subpgm->ctx->module, subpgm->func,
symt_add_func_local(subpgm->ctx->module, subpgm->func,
is_pmt ? DataIsParam : DataIsLocal,
&loc, block, param_type, name.u.string);
break;
@ -2171,7 +2172,7 @@ static void dwarf2_load_one_entry(dwarf2_parse_context_t* ctx,
break;
default:
FIXME("Unhandled Tag type 0x%lx at %s, for %lu\n",
di->abbrev->tag, dwarf2_debug_ctx(ctx), di->abbrev->entry_code);
di->abbrev->tag, dwarf2_debug_ctx(ctx), di->abbrev->entry_code);
}
}

View file

@ -3,4 +3,4 @@ directories:
files:
include/dbghelp.h: sdk/include/psdk/dbghelp.h
tags:
wine: 86864486be64a277f6edf8e66709cd0f17a4eed9
wine: 3d482d3f9f0a3ffa69540af87594b3c1dc46e07b