Eric Pouech : dbghelp: Properly handle errors when reading first DIE in compilation unit.
Alexandre Julliard
julliard at winehq.org
Fri Sep 3 16:25:28 CDT 2021
Module: wine
Branch: master
Commit: ca00b056b8cc3742694e289e69ffc44c8659e457
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ca00b056b8cc3742694e289e69ffc44c8659e457
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Thu Sep 2 11:23:08 2021 +0200
dbghelp: Properly handle errors when reading first DIE in compilation unit.
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dbghelp/dwarf.c | 70 +++++++++++++++++++++++++++-------------------------
1 file changed, 36 insertions(+), 34 deletions(-)
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 6b4eb90c05a..e514a4fde3b 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -2389,43 +2389,45 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections,
dwarf2_parse_abbrev_set(&abbrev_ctx, &ctx.abbrev_table, &ctx.pool);
sparse_array_init(&ctx.debug_info_table, sizeof(dwarf2_debug_info_t), 128);
- dwarf2_read_one_debug_info(&ctx, &cu_ctx, NULL, &di);
-
- if (di->abbrev->tag == DW_TAG_compile_unit)
- {
- struct attribute name;
- struct vector* children;
- dwarf2_debug_info_t* child = NULL;
- unsigned int i;
- struct attribute stmt_list, low_pc;
- struct attribute comp_dir;
-
- if (!dwarf2_find_attribute(&ctx, di, DW_AT_name, &name))
- name.u.string = NULL;
-
- /* get working directory of current compilation unit */
- if (!dwarf2_find_attribute(&ctx, di, DW_AT_comp_dir, &comp_dir))
- comp_dir.u.string = NULL;
-
- if (!dwarf2_find_attribute(&ctx, di, DW_AT_low_pc, &low_pc))
- low_pc.u.uvalue = 0;
- ctx.compiland = symt_new_compiland(module, ctx.load_offset + low_pc.u.uvalue,
- source_new(module, comp_dir.u.string, name.u.string));
- di->symt = &ctx.compiland->symt;
- children = dwarf2_get_di_children(&ctx, di);
- if (children) for (i = 0; i < vector_length(children); i++)
- {
- child = *(dwarf2_debug_info_t**)vector_at(children, i);
- dwarf2_load_one_entry(&ctx, child);
- }
- if (dwarf2_find_attribute(&ctx, di, DW_AT_stmt_list, &stmt_list))
+
+ if (dwarf2_read_one_debug_info(&ctx, &cu_ctx, NULL, &di))
+ {
+ if (di->abbrev->tag == DW_TAG_compile_unit)
{
- if (dwarf2_parse_line_numbers(sections, &ctx, comp_dir.u.string, stmt_list.u.uvalue))
- module->module.LineNumbers = TRUE;
+ struct attribute name;
+ struct vector* children;
+ dwarf2_debug_info_t* child = NULL;
+ unsigned int i;
+ struct attribute stmt_list, low_pc;
+ struct attribute comp_dir;
+
+ if (!dwarf2_find_attribute(&ctx, di, DW_AT_name, &name))
+ name.u.string = NULL;
+
+ /* get working directory of current compilation unit */
+ if (!dwarf2_find_attribute(&ctx, di, DW_AT_comp_dir, &comp_dir))
+ comp_dir.u.string = NULL;
+
+ if (!dwarf2_find_attribute(&ctx, di, DW_AT_low_pc, &low_pc))
+ low_pc.u.uvalue = 0;
+ ctx.compiland = symt_new_compiland(module, ctx.load_offset + low_pc.u.uvalue,
+ source_new(module, comp_dir.u.string, name.u.string));
+ di->symt = &ctx.compiland->symt;
+ children = dwarf2_get_di_children(&ctx, di);
+ if (children) for (i = 0; i < vector_length(children); i++)
+ {
+ child = *(dwarf2_debug_info_t**)vector_at(children, i);
+ dwarf2_load_one_entry(&ctx, child);
+ }
+ if (dwarf2_find_attribute(&ctx, di, DW_AT_stmt_list, &stmt_list))
+ {
+ if (dwarf2_parse_line_numbers(sections, &ctx, comp_dir.u.string, stmt_list.u.uvalue))
+ module->module.LineNumbers = TRUE;
+ }
+ ret = TRUE;
}
- ret = TRUE;
+ else FIXME("Should have a compilation unit here\n");
}
- else FIXME("Should have a compilation unit here\n");
pool_destroy(&ctx.pool);
return ret;
}
More information about the wine-cvs
mailing list