Now storing cu information for dwarf content - in each compiland - and queue the unique one's inside the module
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/dbghelp/dbghelp_private.h | 1 + dlls/dbghelp/dwarf.c | 25 +++++++++++++++++++++++++ dlls/dbghelp/symbol.c | 1 + 3 files changed, 27 insertions(+)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index f9191ae1205..2d4efafd041 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -179,6 +179,7 @@ struct symt_compiland ULONG_PTR address; unsigned source; struct vector vchildren; /* global variables & functions */ + void* user; /* when debug info provider needs to store information */ };
struct symt_data diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index abc011ad2e4..c102439773d 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -193,6 +193,8 @@ typedef struct dwarf2_parse_context_s /* stored in the dbghelp's module internal structure for later reuse */ struct dwarf2_module_info_s { + dwarf2_cuhead_t** cuheads; + unsigned num_cuheads; dwarf2_section_t debug_loc; dwarf2_section_t debug_frame; dwarf2_section_t eh_frame; @@ -2336,6 +2338,26 @@ static BOOL dwarf2_parse_line_numbers(const dwarf2_section_t* sections, return TRUE; }
+unsigned dwarf2_cache_cuhead(struct dwarf2_module_info_s* module, struct symt_compiland* c, const dwarf2_cuhead_t* head) +{ + dwarf2_cuhead_t* ah; + unsigned i; + for (i = 0; i < module->num_cuheads; ++i) + { + if (memcmp(module->cuheads[i], head, sizeof(*head)) == 0) + { + c->user = module->cuheads[i]; + return TRUE; + } + } + if (!(ah = pool_alloc(&c->container->module->pool, sizeof(*head)))) return FALSE; + memcpy(ah, head, sizeof(*head)); + module->cuheads = realloc(module->cuheads, ++module->num_cuheads * sizeof(head)); + module->cuheads[module->num_cuheads - 1] = ah; + c->user = ah; + return TRUE; +} + static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections, struct module* module, const struct elf_thunk_area* thunks, @@ -3476,6 +3498,7 @@ static void dwarf2_module_remove(struct process* pcs, struct module_format* modf { dwarf2_fini_section(&modfmt->u.dwarf2_info->debug_loc); dwarf2_fini_section(&modfmt->u.dwarf2_info->debug_frame); + free(modfmt->u.dwarf2_info->cuheads); HeapFree(GetProcessHeap(), 0, modfmt); }
@@ -3542,6 +3565,8 @@ BOOL dwarf2_parse(struct module* module, ULONG_PTR load_offset, dwarf2_init_section(&dwarf2_modfmt->u.dwarf2_info->debug_loc, fmap, ".debug_loc", ".zdebug_loc", NULL); dwarf2_init_section(&dwarf2_modfmt->u.dwarf2_info->debug_frame, fmap, ".debug_frame", ".zdebug_frame", NULL); dwarf2_modfmt->u.dwarf2_info->eh_frame = eh_frame; + dwarf2_modfmt->u.dwarf2_info->cuheads = NULL; + dwarf2_modfmt->u.dwarf2_info->num_cuheads = 0;
while (mod_ctx.data < mod_ctx.end_data) { diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index 8f192662b7d..28c906c10a3 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -210,6 +210,7 @@ struct symt_compiland* symt_new_compiland(struct module* module, sym->address = address; sym->source = src_idx; vector_init(&sym->vchildren, sizeof(struct symt*), 32); + sym->user = NULL; } return sym; }