From 2a87a89680be2fecd87e73a1fbae1f65d3749441 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sat, 9 Oct 2010 08:51:15 +0200 Subject: [PATCH] dbghelp: Only map an ELF file once. --- dlls/dbghelp/dbghelp_private.h | 2 +- dlls/dbghelp/elf_module.c | 26 ++++++-------------------- dlls/dbghelp/module.c | 2 +- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 44e62f34b24..63b9f391b50 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -511,7 +511,7 @@ typedef BOOL (*enum_modules_cb)(const WCHAR*, unsigned long addr, void* user); extern BOOL elf_enum_modules(HANDLE hProc, enum_modules_cb, void*); extern BOOL elf_fetch_file_info(const WCHAR* name, DWORD_PTR* base, DWORD* size, DWORD* checksum); struct image_file_map; -extern BOOL elf_load_debug_info(struct module* module, struct image_file_map* fmap); +extern BOOL elf_load_debug_info(struct module* module); extern struct module* elf_load_module(struct process* pcs, const WCHAR* name, unsigned long); extern BOOL elf_read_wine_loader_dbg_info(struct process* pcs); diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index 395b5648223..514c2882365 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -948,12 +948,11 @@ static BOOL elf_load_debug_info_from_map(struct module* module, * * Loads ELF debugging information from the module image file. */ -BOOL elf_load_debug_info(struct module* module, struct image_file_map* fmap) +BOOL elf_load_debug_info(struct module* module) { BOOL ret = TRUE; struct pool pool; struct hash_table ht_symtab; - struct image_file_map my_fmap; struct module_format* modfmt; if (module->type != DMT_ELF || !(modfmt = module->format_info[DFI_ELF]) || !modfmt->u.elf_info) @@ -965,22 +964,9 @@ BOOL elf_load_debug_info(struct module* module, struct image_file_map* fmap) pool_init(&pool, 65536); hash_table_init(&pool, &ht_symtab, 256); - if (!fmap) - { - fmap = &my_fmap; - ret = elf_map_file(module->module.LoadedImageName, fmap); - } - if (ret) - ret = elf_load_debug_info_from_map(module, fmap, &pool, &ht_symtab); - - if (ret) - { - modfmt->u.elf_info->file_map = *fmap; - elf_reset_file_map(fmap); - } + ret = elf_load_debug_info_from_map(module, &modfmt->u.elf_info->file_map, &pool, &ht_symtab); pool_destroy(&pool); - if (fmap == &my_fmap) elf_unmap_file(fmap); return ret; } @@ -1090,14 +1076,14 @@ static BOOL elf_load_file(struct process* pcs, const WCHAR* filename, elf_module_info->elf_addr = load_offset; + elf_module_info->file_map = fmap; + elf_reset_file_map(&fmap); if (dbghelp_options & SYMOPT_DEFERRED_LOADS) { elf_info->module->module.SymType = SymDeferred; - elf_module_info->file_map = fmap; - elf_reset_file_map(&fmap); ret = TRUE; } - else ret = elf_load_debug_info(elf_info->module, &fmap); + else ret = elf_load_debug_info(elf_info->module); elf_module_info->elf_mark = 1; elf_module_info->elf_loader = 0; @@ -1523,7 +1509,7 @@ struct module* elf_load_module(struct process* pcs, const WCHAR* name, unsigned return NULL; } -BOOL elf_load_debug_info(struct module* module, struct image_file_map* fmap) +BOOL elf_load_debug_info(struct module* module) { return FALSE; } diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c index 89422a9fc09..adadcb79110 100644 --- a/dlls/dbghelp/module.c +++ b/dlls/dbghelp/module.c @@ -310,7 +310,7 @@ BOOL module_get_debug(struct module_pair* pair) else switch (pair->effective->type) { case DMT_ELF: - ret = elf_load_debug_info(pair->effective, NULL); + ret = elf_load_debug_info(pair->effective); break; case DMT_PE: idslW64.SizeOfStruct = sizeof(idslW64);