Eric Pouech : dbghelp/dwarf: Share compilation unit header information.
Alexandre Julliard
julliard at winehq.org
Thu Sep 9 15:42:32 CDT 2021
Module: wine
Branch: master
Commit: d648dcd3a6addca18ea25a07aa31764021ea4e9a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d648dcd3a6addca18ea25a07aa31764021ea4e9a
Author: Eric Pouech <eric.pouech at gmail.com>
Date: Wed Sep 8 08:34:02 2021 +0200
dbghelp/dwarf: Share compilation unit header information.
Store cu information for dwarf content
- in each compiland
- and queue the unique one's inside the module.
Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 0ba15fd338c..19545e2b72b 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;
@@ -2335,6 +2337,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,
@@ -3475,6 +3497,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);
}
@@ -3541,6 +3564,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;
}
More information about the wine-cvs
mailing list