dbghelp: Set is_first and is_last flags on the fly in symt_add_func_line.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cd8b85e4a9
commit
707a2273ec
|
@ -320,6 +320,8 @@ 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 offset)
|
||||||
{
|
{
|
||||||
struct line_info* dli;
|
struct line_info* dli;
|
||||||
|
unsigned vlen;
|
||||||
|
struct line_info* prev;
|
||||||
BOOL last_matches = FALSE;
|
BOOL last_matches = FALSE;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -340,19 +342,24 @@ void symt_add_func_line(struct module* module, struct symt_function* func,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
vlen = vector_length(&func->vlines);
|
||||||
|
prev = vlen ? vector_at(&func->vlines, vlen - 1) : NULL;
|
||||||
if (!last_matches)
|
if (!last_matches)
|
||||||
{
|
{
|
||||||
/* we shouldn't have line changes on first line of function */
|
/* we shouldn't have line changes on first line of function */
|
||||||
dli = vector_add(&func->vlines, &module->pool);
|
dli = vector_add(&func->vlines, &module->pool);
|
||||||
dli->is_source_file = 1;
|
dli->is_source_file = 1;
|
||||||
dli->is_first = dli->is_last = 0;
|
dli->is_first = (prev == NULL);
|
||||||
|
dli->is_last = 0;
|
||||||
dli->line_number = 0;
|
dli->line_number = 0;
|
||||||
dli->u.source_file = source_idx;
|
dli->u.source_file = source_idx;
|
||||||
}
|
}
|
||||||
|
/* clear previous last */
|
||||||
|
if (prev) prev->is_last = 0;
|
||||||
dli = vector_add(&func->vlines, &module->pool);
|
dli = vector_add(&func->vlines, &module->pool);
|
||||||
dli->is_source_file = 0;
|
dli->is_source_file = 0;
|
||||||
dli->is_first = dli->is_last = 0;
|
dli->is_first = 0; /* only a source file can be first */
|
||||||
|
dli->is_last = 1;
|
||||||
dli->line_number = line_num;
|
dli->line_number = line_num;
|
||||||
dli->u.pc_offset = func->address + offset;
|
dli->u.pc_offset = func->address + offset;
|
||||||
}
|
}
|
||||||
|
@ -465,9 +472,6 @@ struct symt_hierarchy_point* symt_add_function_point(struct module* module,
|
||||||
|
|
||||||
BOOL symt_normalize_function(struct module* module, const struct symt_function* func)
|
BOOL symt_normalize_function(struct module* module, const struct symt_function* func)
|
||||||
{
|
{
|
||||||
unsigned len;
|
|
||||||
struct line_info* dli;
|
|
||||||
|
|
||||||
assert(func);
|
assert(func);
|
||||||
/* We aren't adding any more locals or line numbers to this function.
|
/* We aren't adding any more locals or line numbers to this function.
|
||||||
* Free any spare memory that we might have allocated.
|
* Free any spare memory that we might have allocated.
|
||||||
|
@ -477,12 +481,6 @@ BOOL symt_normalize_function(struct module* module, const struct symt_function*
|
||||||
/* EPP vector_pool_normalize(&func->vlines, &module->pool); */
|
/* EPP vector_pool_normalize(&func->vlines, &module->pool); */
|
||||||
/* EPP vector_pool_normalize(&func->vchildren, &module->pool); */
|
/* EPP vector_pool_normalize(&func->vchildren, &module->pool); */
|
||||||
|
|
||||||
len = vector_length(&func->vlines);
|
|
||||||
if (len--)
|
|
||||||
{
|
|
||||||
dli = vector_at(&func->vlines, 0); dli->is_first = 1;
|
|
||||||
dli = vector_at(&func->vlines, len); dli->is_last = 1;
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue