Eric Pouech : dbghelp: Make symt_add_func_line() last parameter an absolute address.
Alexandre Julliard
julliard at winehq.org
Fri Oct 29 16:29:08 CDT 2021
Module: wine
Branch: master
Commit: 1c5989465e72d90b10c1c21105c99ba6f0f9b2f7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1c5989465e72d90b10c1c21105c99ba6f0f9b2f7
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Fri Oct 29 15:37:04 2021 +0200
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: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/coff.c | 7 +------
dlls/dbghelp/dwarf.c | 2 +-
dlls/dbghelp/msc.c | 5 ++---
dlls/dbghelp/stabs.c | 4 ++--
dlls/dbghelp/symbol.c | 8 ++++----
5 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/dlls/dbghelp/coff.c b/dlls/dbghelp/coff.c
index 8684a493310..cc005a3bbc5 100644
--- a/dlls/dbghelp/coff.c
+++ b/dlls/dbghelp/coff.c
@@ -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;
}
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 1ea8d2df773..eab6609cdf4 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -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);
}
}
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index c557cb24636..191e33e781f 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -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 */
diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c
index 9d7d5131fc4..647a71ec258 100644
--- a/dlls/dbghelp/stabs.c
+++ b/dlls/dbghelp/stabs.c
@@ -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);
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index e4208bc2418..43f7b3fdec2 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -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;
}
/******************************************************************
More information about the wine-cvs
mailing list