Eric Pouech : dbghelp: Set is_first and is_last flags on the fly in symt_add_func_line.
Alexandre Julliard
julliard at winehq.org
Tue Sep 7 16:25:21 CDT 2021
Module: wine
Branch: master
Commit: 707a2273ecb5fca392da22594d49be1122e9c171
URL: https://source.winehq.org/git/wine.git/?a=commit;h=707a2273ecb5fca392da22594d49be1122e9c171
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Tue Sep 7 09:27:01 2021 +0200
dbghelp: Set is_first and is_last flags on the fly in symt_add_func_line.
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/symbol.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index ee68967ce5d..e91f0dd1e07 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -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)
{
struct line_info* dli;
+ unsigned vlen;
+ struct line_info* prev;
BOOL last_matches = FALSE;
int i;
@@ -340,19 +342,24 @@ void symt_add_func_line(struct module* module, struct symt_function* func,
break;
}
}
-
+ vlen = vector_length(&func->vlines);
+ prev = vlen ? vector_at(&func->vlines, vlen - 1) : NULL;
if (!last_matches)
{
/* we shouldn't have line changes on first line of function */
dli = vector_add(&func->vlines, &module->pool);
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->u.source_file = source_idx;
}
+ /* clear previous last */
+ if (prev) prev->is_last = 0;
dli = vector_add(&func->vlines, &module->pool);
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->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)
{
- unsigned len;
- struct line_info* dli;
-
assert(func);
/* We aren't adding any more locals or line numbers to this function.
* 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->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;
}
More information about the wine-cvs
mailing list