Commit 1c598946 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Make symt_add_func_line() last parameter an absolute address.

It used to be an offset to the start of function, but it's actually stored as an absolute address afterwards. This avoids unnecessary computations. Signed-off-by: 's avatarEric Pouech <eric.pouech@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 01876750
......@@ -421,16 +421,11 @@ DECLSPEC_HIDDEN BOOL coff_process_info(const struct msc_debug_info* msc_dbg)
{
if (coff_files.files[j].entries[l+1]->tag == SymTagFunction)
{
/*
* Add the line number. This is always relative to the
* start of the function, so we need to subtract that offset
* first.
*/
symt_add_func_line(msc_dbg->module,
(struct symt_function*)coff_files.files[j].entries[l+1],
coff_files.files[j].compiland->source,
linepnt->Linenumber,
msc_dbg->module->module.BaseOfImage + linepnt->Type.VirtualAddress - addr);
msc_dbg->module->module.BaseOfImage + linepnt->Type.VirtualAddress);
}
break;
}
......
......@@ -2526,7 +2526,7 @@ static void dwarf2_set_line_number(struct module* module, ULONG_PTR address,
if (symt_check_tag(&symt->symt, SymTagFunction))
{
func = (struct symt_function*)symt;
symt_add_func_line(module, func, *psrc, line, address - func->address);
symt_add_func_line(module, func, *psrc, line, address);
}
}
......
......@@ -1454,8 +1454,7 @@ static void codeview_snarf_linetab(const struct msc_debug_info* msc_dbg, const B
break;
}
}
symt_add_func_line(msc_dbg->module, func, source,
linenos[k], addr - func->address);
symt_add_func_line(msc_dbg->module, func, source, linenos[k], addr);
}
}
}
......@@ -1519,7 +1518,7 @@ static void codeview_snarf_linetab2(const struct msc_debug_info* msc_dbg, const
{
symt_add_func_line(msc_dbg->module, func, source,
lines_blk->l[i].lineno ^ 0x80000000,
lines_blk->l[i].offset);
func->address + lines_blk->l[i].offset);
}
break;
case LT2_FILES_BLOCK: /* skip */
......
......@@ -1168,7 +1168,7 @@ static void pending_flush(struct pending_list* pending, struct module* module,
if (module->type == DMT_MACHO)
pending->objs[i].u.line.offset -= func->address - pending->objs[i].u.line.load_offset;
symt_add_func_line(module, func, pending->objs[i].u.line.source_idx,
pending->objs[i].u.line.line_num, pending->objs[i].u.line.offset);
pending->objs[i].u.line.line_num, func->address + pending->objs[i].u.line.offset);
break;
default:
ERR("Unknown pending object tag %u\n", (unsigned)pending->objs[i].tag);
......@@ -1492,7 +1492,7 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
if (module->type == DMT_MACHO)
offset -= curr_func->address - load_offset;
symt_add_func_line(module, curr_func, source_idx,
stab_ptr->n_desc, offset);
stab_ptr->n_desc, curr_func->address + offset);
}
else pending_add_line(&pending_func, source_idx, stab_ptr->n_desc,
n_value, load_offset);
......
......@@ -391,7 +391,7 @@ struct symt_inlinesite* symt_new_inlinesite(struct module* module,
}
void symt_add_func_line(struct module* module, struct symt_function* func,
unsigned source_idx, int line_num, ULONG_PTR offset)
unsigned source_idx, int line_num, ULONG_PTR addr)
{
struct line_info* dli;
unsigned vlen;
......@@ -401,8 +401,8 @@ void symt_add_func_line(struct module* module, struct symt_function* func,
if (func == NULL || !(dbghelp_options & SYMOPT_LOAD_LINES)) return;
TRACE_(dbghelp_symt)("(%p)%s:%lx %s:%u\n",
func, func->hash_elt.name, offset,
TRACE_(dbghelp_symt)("(%p)%s:%Ix %s:%u\n",
func, func->hash_elt.name, addr,
source_get(module, source_idx), line_num);
assert(func->symt.tag == SymTagFunction || func->symt.tag == SymTagInlineSite);
......@@ -435,7 +435,7 @@ void symt_add_func_line(struct module* module, struct symt_function* func,
dli->is_first = 0; /* only a source file can be first */
dli->is_last = 1;
dli->line_number = line_num;
dli->u.address = func->address + offset;
dli->u.address = addr;
}
/******************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment