[WINESYNC] dbghelp: Use loader_ops for load_debug_info.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id a676c5785ea56fede37370cd6d5e4508e9d8c62a by Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
winesync 2020-09-11 17:17:04 +02:00 committed by Jérôme Gardou
parent f308fa857b
commit 87c943516f
5 changed files with 16 additions and 31 deletions

View file

@ -424,6 +424,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);
}; };
@ -634,13 +635,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

@ -387,14 +387,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)
{ {
#ifndef DBGHELP_STATIC_LIB
case DMT_ELF:
ret = elf_load_debug_info(pair->effective);
break;
#endif
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;
@ -409,16 +403,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;
#ifndef DBGHELP_STATIC_LIB
case DMT_MACHO:
ret = macho_load_debug_info(pair->pcs, pair->effective);
break;
#endif
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;
@ -1457,6 +1444,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;
@ -1472,6 +1464,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,
}; };

View file

@ -4,4 +4,4 @@ files:
include/dbghelp.h: sdk/include/psdk/dbghelp.h include/dbghelp.h: sdk/include/psdk/dbghelp.h
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
tags: tags:
wine: 5ae3f969d4ec525a14a8109a5ee4c5a2e2238405 wine: a676c5785ea56fede37370cd6d5e4508e9d8c62a