[PATCH 05/10] [DbgHelp]: only map an ELF file once
Eric Pouech
eric.pouech at orange.fr
Sat Oct 9 01:51:15 CDT 2010
A+
---
dlls/dbghelp/dbghelp_private.h | 2 +-
dlls/dbghelp/elf_module.c | 24 +++++-------------------
dlls/dbghelp/module.c | 2 +-
3 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index 44e62f3..63b9f39 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 94faad0..bd6bd7b 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;
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index 89422a9..adadcb7 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);
More information about the wine-patches
mailing list