Eric Pouech : dbghelp:
Function points location is now expressed as a struct location.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Nov 27 12:51:52 CST 2006
Module: wine
Branch: master
Commit: 0d942b3aaac3a165e83c2b8edd4cfb2af8adfa81
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0d942b3aaac3a165e83c2b8edd4cfb2af8adfa81
Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date: Fri Nov 24 22:17:54 2006 +0100
dbghelp: Function points location is now expressed as a struct location.
---
dlls/dbghelp/dbghelp_private.h | 5 +++--
dlls/dbghelp/dwarf.c | 6 ++++--
dlls/dbghelp/msc.c | 31 +++++++++++++++++++++----------
dlls/dbghelp/stabs.c | 7 +++++--
dlls/dbghelp/symbol.c | 6 ++++--
dlls/dbghelp/type.c | 2 +-
6 files changed, 38 insertions(+), 19 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index fbf9879..19864db 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -210,7 +210,7 @@ struct symt_function_point
{
struct symt symt; /* either SymTagFunctionDebugStart, SymTagFunctionDebugEnd, SymTagLabel */
struct symt_function* parent;
- unsigned long offset;
+ struct location loc;
const char* name; /* for labels */
};
@@ -532,7 +532,8 @@ extern struct symt_function_point*
symt_add_function_point(struct module* module,
struct symt_function* func,
enum SymTagEnum point,
- unsigned offset, const char* name);
+ const struct location* loc,
+ const char* name);
extern BOOL symt_fill_func_line_info(struct module* module,
struct symt_function* func,
DWORD addr, IMAGEHLP_LINE* line);
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 5583413..f99c844 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -1274,15 +1274,17 @@ static void dwarf2_parse_subprogram_labe
{
struct attribute name;
struct attribute low_pc;
+ struct location loc;
TRACE("%s, for %s\n", dwarf2_debug_ctx(subpgm->ctx), dwarf2_debug_di(di));
if (!dwarf2_find_attribute(subpgm->ctx, di, DW_AT_low_pc, &low_pc)) low_pc.u.uvalue = 0;
dwarf2_find_name(subpgm->ctx, di, &name, "label");
+ loc.kind = loc_absolute;
+ loc.offset = subpgm->ctx->module->module.BaseOfImage + low_pc.u.uvalue,
symt_add_function_point(subpgm->ctx->module, subpgm->func, SymTagLabel,
- subpgm->ctx->module->module.BaseOfImage + low_pc.u.uvalue,
- name.u.string);
+ &loc, name.u.string);
}
static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index 9554d97..f336609 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -1338,8 +1338,11 @@ static int codeview_snarf(const struct m
codeview_get_type(sym->proc_v1.proctype, FALSE));
codeview_add_func_linenum(msc_dbg->module, curr_func, flt,
sym->proc_v1.offset, sym->proc_v1.proc_len);
- symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, sym->proc_v1.debug_start, NULL);
- symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, sym->proc_v1.debug_end, NULL);
+ loc.kind = loc_absolute;
+ loc.offset = sym->proc_v1.debug_start;
+ symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, &loc, NULL);
+ loc.offset = sym->proc_v1.debug_end;
+ symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, &loc, NULL);
break;
case S_GPROC_V2:
case S_LPROC_V2:
@@ -1352,8 +1355,11 @@ static int codeview_snarf(const struct m
codeview_get_type(sym->proc_v2.proctype, FALSE));
codeview_add_func_linenum(msc_dbg->module, curr_func, flt,
sym->proc_v2.offset, sym->proc_v2.proc_len);
- symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, sym->proc_v2.debug_start, NULL);
- symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, sym->proc_v2.debug_end, NULL);
+ loc.kind = loc_absolute;
+ loc.offset = sym->proc_v2.debug_start;
+ symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, &loc, NULL);
+ loc.offset = sym->proc_v2.debug_end;
+ symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, &loc, NULL);
break;
case S_GPROC_V3:
case S_LPROC_V3:
@@ -1366,8 +1372,11 @@ static int codeview_snarf(const struct m
codeview_get_type(sym->proc_v3.proctype, FALSE));
codeview_add_func_linenum(msc_dbg->module, curr_func, flt,
sym->proc_v3.offset, sym->proc_v3.proc_len);
- symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, sym->proc_v3.debug_start, NULL);
- symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, sym->proc_v3.debug_end, NULL);
+ loc.kind = loc_absolute;
+ loc.offset = sym->proc_v3.debug_start;
+ symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, &loc, NULL);
+ loc.offset = sym->proc_v3.debug_end;
+ symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, &loc, NULL);
break;
/*
* Function parameters and stack variables.
@@ -1489,8 +1498,9 @@ static int codeview_snarf(const struct m
case S_LABEL_V1:
if (curr_func)
{
- symt_add_function_point(msc_dbg->module, curr_func, SymTagLabel,
- codeview_get_address(msc_dbg, sym->label_v1.segment, sym->label_v1.offset) - curr_func->address,
+ loc.kind = loc_absolute;
+ loc.offset = codeview_get_address(msc_dbg, sym->label_v1.segment, sym->label_v1.offset) - curr_func->address;
+ symt_add_function_point(msc_dbg->module, curr_func, SymTagLabel, &loc,
terminate_string(&sym->label_v1.p_name));
}
else
@@ -1500,9 +1510,10 @@ static int codeview_snarf(const struct m
case S_LABEL_V3:
if (curr_func)
{
+ loc.kind = loc_absolute;
+ loc.offset = codeview_get_address(msc_dbg, sym->label_v3.segment, sym->label_v3.offset) - curr_func->address;
symt_add_function_point(msc_dbg->module, curr_func, SymTagLabel,
- codeview_get_address(msc_dbg, sym->label_v3.segment, sym->label_v3.offset) - curr_func->address,
- sym->label_v3.name);
+ &loc, sym->label_v3.name);
}
else
FIXME("No current function for label %s\n", sym->label_v3.name);
diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c
index 6f6c851..7693ff7 100644
--- a/dlls/dbghelp/stabs.c
+++ b/dlls/dbghelp/stabs.c
@@ -1153,7 +1153,8 @@ static void stabs_finalize_function(stru
unsigned long size)
{
IMAGEHLP_LINE il;
-
+ struct location loc;
+
if (!func) return;
symt_normalize_function(module, func);
/* To define the debug-start of the function, we use the second line number.
@@ -1162,8 +1163,10 @@ static void stabs_finalize_function(stru
if (symt_fill_func_line_info(module, func, func->address, &il) &&
symt_get_func_line_next(module, &il))
{
+ loc.kind = loc_absolute;
+ loc.offset = il.Address - func->address;
symt_add_function_point(module, func, SymTagFuncDebugStart,
- il.Address - func->address, NULL);
+ &loc, NULL);
}
if (size) func->size = size;
}
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index 8e1cdf4..0f62889 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -376,7 +376,8 @@ struct symt_block* symt_close_func_block
struct symt_function_point* symt_add_function_point(struct module* module,
struct symt_function* func,
enum SymTagEnum point,
- unsigned offset, const char* name)
+ const struct location* loc,
+ const char* name)
{
struct symt_function_point* sym;
struct symt** p;
@@ -385,7 +386,7 @@ struct symt_function_point* symt_add_fun
{
sym->symt.tag = point;
sym->parent = func;
- sym->offset = offset;
+ sym->loc = *loc;
sym->name = name ? pool_strdup(&module->pool, name) : NULL;
p = vector_add(&func->vchildren, &module->pool);
*p = &sym->symt;
@@ -741,6 +742,7 @@ static BOOL symt_enum_locals_helper(stru
case SymTagLabel:
case SymTagFuncDebugStart:
case SymTagFuncDebugEnd:
+ case SymTagCustom:
break;
default:
FIXME("Unknown type: %u (%x)\n", lsym->tag, lsym->tag);
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c
index 83db9eb..e112ce9 100644
--- a/dlls/dbghelp/type.c
+++ b/dlls/dbghelp/type.c
@@ -484,7 +484,7 @@ BOOL symt_get_info(const struct symt* ty
case SymTagFuncDebugEnd:
case SymTagLabel:
X(ULONG64) = ((const struct symt_function_point*)type)->parent->address +
- ((const struct symt_function_point*)type)->offset;
+ ((const struct symt_function_point*)type)->loc.offset;
break;
case SymTagThunk:
X(ULONG64) = ((const struct symt_thunk*)type)->address;
More information about the wine-cvs
mailing list