dbghelp: Use loader_ops for load_debug_info.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-03-25 17:41:16 +01:00 committed by Alexandre Julliard
parent 5ae3f969d4
commit a676c5785e
4 changed files with 15 additions and 26 deletions

View File

@ -393,6 +393,7 @@ struct loader_ops
{ {
BOOL (*synchronize_module_list)(struct process* process); BOOL (*synchronize_module_list)(struct process* process);
struct module* (*load_module)(struct process* process, const WCHAR* name, ULONG_PTR addr); struct module* (*load_module)(struct process* process, const WCHAR* name, ULONG_PTR addr);
BOOL (*load_debug_info)(struct process *process, struct module* module);
BOOL (*enum_modules)(struct process* process, enum_modules_cb callback, void* user); BOOL (*enum_modules)(struct process* process, enum_modules_cb callback, void* user);
BOOL (*fetch_file_info)(struct process* process, const WCHAR* name, ULONG_PTR load_addr, DWORD_PTR* base, DWORD* size, DWORD* checksum); BOOL (*fetch_file_info)(struct process* process, const WCHAR* name, ULONG_PTR load_addr, DWORD_PTR* base, DWORD* size, DWORD* checksum);
}; };
@ -603,13 +604,11 @@ extern struct cpu* cpu_find(DWORD) DECLSPEC_HIDDEN;
extern DWORD calc_crc32(HANDLE handle) DECLSPEC_HIDDEN; extern DWORD calc_crc32(HANDLE handle) DECLSPEC_HIDDEN;
/* elf_module.c */ /* elf_module.c */
extern BOOL elf_load_debug_info(struct module* module) DECLSPEC_HIDDEN;
extern BOOL elf_read_wine_loader_dbg_info(struct process* pcs) DECLSPEC_HIDDEN; extern BOOL elf_read_wine_loader_dbg_info(struct process* pcs) DECLSPEC_HIDDEN;
struct elf_thunk_area; struct elf_thunk_area;
extern int elf_is_in_thunk_area(unsigned long addr, const struct elf_thunk_area* thunks) DECLSPEC_HIDDEN; extern int elf_is_in_thunk_area(unsigned long addr, const struct elf_thunk_area* thunks) DECLSPEC_HIDDEN;
/* macho_module.c */ /* macho_module.c */
extern BOOL macho_load_debug_info(struct process *pcs, struct module* module) DECLSPEC_HIDDEN;
extern BOOL macho_read_wine_loader_dbg_info(struct process* pcs) DECLSPEC_HIDDEN; extern BOOL macho_read_wine_loader_dbg_info(struct process* pcs) DECLSPEC_HIDDEN;
/* minidump.c */ /* minidump.c */

View File

@ -1041,7 +1041,7 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
* *
* Loads ELF debugging information from the module image file. * Loads ELF debugging information from the module image file.
*/ */
BOOL elf_load_debug_info(struct module* module) static BOOL elf_load_debug_info(struct process* process, struct module* module)
{ {
BOOL ret = TRUE; BOOL ret = TRUE;
struct pool pool; struct pool pool;
@ -1198,7 +1198,7 @@ static BOOL elf_load_file_from_fmap(struct process* pcs, const WCHAR* filename,
elf_info->module->module.SymType = SymDeferred; elf_info->module->module.SymType = SymDeferred;
ret = TRUE; ret = TRUE;
} }
else ret = elf_load_debug_info(elf_info->module); else ret = elf_load_debug_info(pcs, elf_info->module);
elf_module_info->elf_mark = 1; elf_module_info->elf_mark = 1;
elf_module_info->elf_loader = 0; elf_module_info->elf_loader = 0;
@ -1707,6 +1707,7 @@ static const struct loader_ops elf_loader_ops =
{ {
elf_synchronize_module_list, elf_synchronize_module_list,
elf_load_module, elf_load_module,
elf_load_debug_info,
elf_enum_modules, elf_enum_modules,
elf_fetch_file_info, elf_fetch_file_info,
}; };
@ -1741,11 +1742,6 @@ BOOL elf_read_wine_loader_dbg_info(struct process* pcs)
return FALSE; return FALSE;
} }
BOOL elf_load_debug_info(struct module* module)
{
return FALSE;
}
int elf_is_in_thunk_area(unsigned long addr, int elf_is_in_thunk_area(unsigned long addr,
const struct elf_thunk_area* thunks) const struct elf_thunk_area* thunks)
{ {

View File

@ -1281,7 +1281,7 @@ static BOOL image_uses_split_segs(struct process* process, unsigned long load_ad
* *
* Loads Mach-O debugging information from the module image file. * Loads Mach-O debugging information from the module image file.
*/ */
BOOL macho_load_debug_info(struct process *pcs, struct module* module) static BOOL macho_load_debug_info(struct process *pcs, struct module* module)
{ {
BOOL ret = FALSE; BOOL ret = FALSE;
struct macho_debug_info mdi; struct macho_debug_info mdi;
@ -1907,6 +1907,7 @@ static const struct loader_ops macho_loader_ops =
{ {
macho_synchronize_module_list, macho_synchronize_module_list,
macho_load_module, macho_load_module,
macho_load_debug_info,
macho_enum_modules, macho_enum_modules,
macho_fetch_file_info, macho_fetch_file_info,
}; };
@ -1937,8 +1938,4 @@ BOOL macho_read_wine_loader_dbg_info(struct process* pcs)
return FALSE; return FALSE;
} }
BOOL macho_load_debug_info(struct process *pcs, struct module* module)
{
return FALSE;
}
#endif /* HAVE_MACH_O_LOADER_H */ #endif /* HAVE_MACH_O_LOADER_H */

View File

@ -374,12 +374,8 @@ BOOL module_get_debug(struct module_pair* pair)
BOOL ret; BOOL ret;
if (pair->effective->is_virtual) ret = FALSE; if (pair->effective->is_virtual) ret = FALSE;
else switch (pair->effective->type) else if (pair->effective->type == DMT_PE)
{ {
case DMT_ELF:
ret = elf_load_debug_info(pair->effective);
break;
case DMT_PE:
idslW64.SizeOfStruct = sizeof(idslW64); idslW64.SizeOfStruct = sizeof(idslW64);
idslW64.BaseOfImage = pair->effective->module.BaseOfImage; idslW64.BaseOfImage = pair->effective->module.BaseOfImage;
idslW64.CheckSum = pair->effective->module.CheckSum; idslW64.CheckSum = pair->effective->module.CheckSum;
@ -394,14 +390,9 @@ BOOL module_get_debug(struct module_pair* pair)
pcs_callback(pair->pcs, pcs_callback(pair->pcs,
ret ? CBA_DEFERRED_SYMBOL_LOAD_COMPLETE : CBA_DEFERRED_SYMBOL_LOAD_FAILURE, ret ? CBA_DEFERRED_SYMBOL_LOAD_COMPLETE : CBA_DEFERRED_SYMBOL_LOAD_FAILURE,
&idslW64); &idslW64);
break;
case DMT_MACHO:
ret = macho_load_debug_info(pair->pcs, pair->effective);
break;
default:
ret = FALSE;
break;
} }
else ret = pair->pcs->loader->load_debug_info(pair->pcs, pair->effective);
if (!ret) pair->effective->module.SymType = SymNone; if (!ret) pair->effective->module.SymType = SymNone;
assert(pair->effective->module.SymType != SymDeferred); assert(pair->effective->module.SymType != SymDeferred);
pair->effective->module.NumSyms = pair->effective->ht_symbols.num_elts; pair->effective->module.NumSyms = pair->effective->ht_symbols.num_elts;
@ -1425,6 +1416,11 @@ static struct module* native_load_module(struct process* pcs, const WCHAR* name,
return NULL; return NULL;
} }
static BOOL native_load_debug_info(struct process* process, struct module* module)
{
return FALSE;
}
static BOOL native_enum_modules(struct process *process, enum_modules_cb cb, void* user) static BOOL native_enum_modules(struct process *process, enum_modules_cb cb, void* user)
{ {
return FALSE; return FALSE;
@ -1440,6 +1436,7 @@ const struct loader_ops no_loader_ops =
{ {
native_synchronize_module_list, native_synchronize_module_list,
native_load_module, native_load_module,
native_load_debug_info,
native_enum_modules, native_enum_modules,
native_fetch_file_info, native_fetch_file_info,
}; };