Commit 2a87a896 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Only map an ELF file once.

parent 580cab9d
......@@ -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);
......
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment