Commit 0d942b3a authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Function points location is now expressed as a struct location.

parent d812f8b4
......@@ -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);
......
......@@ -1274,15 +1274,17 @@ static void dwarf2_parse_subprogram_label(dwarf2_subprogram_t* subpgm,
{
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,
......
......@@ -1338,8 +1338,11 @@ static int codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* root
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 msc_debug_info* msc_dbg, const BYTE* root
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 msc_debug_info* msc_dbg, const BYTE* root
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 msc_debug_info* msc_dbg, const BYTE* root
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 msc_debug_info* msc_dbg, const BYTE* root
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);
......
......@@ -1153,7 +1153,8 @@ static void stabs_finalize_function(struct module* module, struct symt_function*
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(struct module* module, struct symt_function*
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;
}
......
......@@ -376,7 +376,8 @@ struct symt_block* symt_close_func_block(struct module* module,
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_function_point(struct module* module,
{
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(struct module_pair* pair,
case SymTagLabel:
case SymTagFuncDebugStart:
case SymTagFuncDebugEnd:
case SymTagCustom:
break;
default:
FIXME("Unknown type: %u (%x)\n", lsym->tag, lsym->tag);
......
......@@ -484,7 +484,7 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
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;
......
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