dbghelp: No longer pass inline site's address upon creation.

Instead use the first address of the first defined range of address.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
This commit is contained in:
Eric Pouech 2022-11-01 10:39:57 +01:00 committed by Alexandre Julliard
parent 389df55dfb
commit a6f1f7be7e
4 changed files with 10 additions and 33 deletions

View file

@ -850,7 +850,6 @@ extern struct symt_inlinesite*
struct symt_function* func,
struct symt* parent,
const char* name,
ULONG_PTR addr,
struct symt* type) DECLSPEC_HIDDEN;
extern void symt_add_func_line(struct module* module,
struct symt_function* func,

View file

@ -2141,13 +2141,15 @@ static void dwarf2_parse_inlined_subroutine(dwarf2_subprogram_t* subpgm,
subpgm->top_func,
subpgm->current_block ? &subpgm->current_block->symt : &subpgm->current_func->symt,
dwarf2_get_cpp_name(di, name.u.string),
adranges[0].low, &sig_type->symt);
&sig_type->symt);
subpgm->current_func = (struct symt_function*)inlined;
subpgm->current_block = NULL;
for (i = 0; i < num_adranges; ++i)
symt_add_inlinesite_range(subpgm->ctx->module_ctx->module, inlined,
adranges[i].low, adranges[i].high);
/* temporary: update address field */
inlined->func.address = adranges[0].low;
free(adranges);
children = dwarf2_get_di_children(di);

View file

@ -2101,7 +2101,7 @@ static struct symt_inlinesite* codeview_create_inline_site(const struct msc_debu
const union codeview_type* cvt;
struct symt_inlinesite* inlined;
struct cv_binannot cvba;
BOOL srcok, found = FALSE;
BOOL srcok;
unsigned offset, line, srcfile;
const struct CV_Checksum_t* chksms;
@ -2111,42 +2111,17 @@ static struct symt_inlinesite* codeview_create_inline_site(const struct msc_debu
return NULL;
}
/* grasp first code offset in binary annotation to compute inline site start address */
cvba.annot = annot;
cvba.last_annot = last_annot;
while (codeview_advance_binannot(&cvba))
if (cvba.opcode == BA_OP_CodeOffset ||
cvba.opcode == BA_OP_ChangeCodeOffset ||
cvba.opcode == BA_OP_ChangeCodeOffsetAndLineOffset)
{
offset = cvba.arg1;
found = TRUE;
break;
}
else if (cvba.opcode == BA_OP_ChangeCodeLengthAndCodeOffset)
{
offset = cvba.arg2;
found = TRUE;
break;
}
if (!found)
{
WARN("Couldn't find start address of inlined\n");
return NULL;
}
switch (cvt->generic.id)
{
case LF_FUNC_ID:
inlined = symt_new_inlinesite(msc_dbg->module, top_func, container,
cvt->func_id_v3.name, top_func->address + offset,
cvt->func_id_v3.name,
codeview_get_type(cvt->func_id_v3.type, FALSE));
break;
case LF_MFUNC_ID:
/* FIXME we just declare a function, not a method */
inlined = symt_new_inlinesite(msc_dbg->module, top_func, container,
cvt->mfunc_id_v3.name, top_func->address + offset,
cvt->mfunc_id_v3.name,
codeview_get_type(cvt->mfunc_id_v3.type, FALSE));
break;
default:
@ -2228,6 +2203,8 @@ static struct symt_inlinesite* codeview_create_inline_site(const struct msc_debu
if (range->low == range->high) WARN("pending empty range at end of %s inside %s\n",
inlined->func.hash_elt.name,
top_func->hash_elt.name);
/* temporary: update address field */
inlined->func.address = ((struct addr_range*)vector_at(&inlined->vranges, 0))->low;
}
return inlined;
}

View file

@ -362,17 +362,16 @@ struct symt_inlinesite* symt_new_inlinesite(struct module* module,
struct symt_function* func,
struct symt* container,
const char* name,
ULONG_PTR addr,
struct symt* sig_type)
{
struct symt_inlinesite* sym;
TRACE_(dbghelp_symt)("Adding inline site %s @%Ix\n", name, addr);
TRACE_(dbghelp_symt)("Adding inline site %s\n", name);
if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
{
struct symt** p;
assert(container);
init_function_or_inlinesite(&sym->func, module, SymTagInlineSite, container, name, addr, 0, sig_type);
init_function_or_inlinesite(&sym->func, module, SymTagInlineSite, container, name, 0, 0, sig_type);
vector_init(&sym->vranges, sizeof(struct addr_range), 2); /* FIXME: number of elts => to be set on input */
/* chain inline sites */
sym->func.next_inlinesite = func->next_inlinesite;