From 87c943516fa3c2547d28d80da716cca782043461 Mon Sep 17 00:00:00 2001 From: winesync Date: Fri, 11 Sep 2020 17:17:04 +0200 Subject: [PATCH] [WINESYNC] dbghelp: Use loader_ops for load_debug_info. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard wine commit id a676c5785ea56fede37370cd6d5e4508e9d8c62a by Jacek Caban --- dll/win32/dbghelp/dbghelp_private.h | 3 +-- dll/win32/dbghelp/elf_module.c | 10 +++------- dll/win32/dbghelp/macho_module.c | 7 ++----- dll/win32/dbghelp/module.c | 25 +++++++++---------------- sdk/tools/winesync/dbghelp.cfg | 2 +- 5 files changed, 16 insertions(+), 31 deletions(-) diff --git a/dll/win32/dbghelp/dbghelp_private.h b/dll/win32/dbghelp/dbghelp_private.h index a232547a514..39394ead267 100644 --- a/dll/win32/dbghelp/dbghelp_private.h +++ b/dll/win32/dbghelp/dbghelp_private.h @@ -424,6 +424,7 @@ struct loader_ops { BOOL (*synchronize_module_list)(struct process* process); 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 (*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; /* 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; struct elf_thunk_area; extern int elf_is_in_thunk_area(unsigned long addr, const struct elf_thunk_area* thunks) DECLSPEC_HIDDEN; /* 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; /* minidump.c */ diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c index 038a552e429..20c68dc1ab3 100644 --- a/dll/win32/dbghelp/elf_module.c +++ b/dll/win32/dbghelp/elf_module.c @@ -1041,7 +1041,7 @@ 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) +static BOOL elf_load_debug_info(struct process* process, struct module* module) { BOOL ret = TRUE; 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; 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_loader = 0; @@ -1707,6 +1707,7 @@ static const struct loader_ops elf_loader_ops = { elf_synchronize_module_list, elf_load_module, + elf_load_debug_info, elf_enum_modules, elf_fetch_file_info, }; @@ -1741,11 +1742,6 @@ BOOL elf_read_wine_loader_dbg_info(struct process* pcs) return FALSE; } -BOOL elf_load_debug_info(struct module* module) -{ - return FALSE; -} - int elf_is_in_thunk_area(unsigned long addr, const struct elf_thunk_area* thunks) { diff --git a/dll/win32/dbghelp/macho_module.c b/dll/win32/dbghelp/macho_module.c index c55443905b0..8e2fa796e03 100644 --- a/dll/win32/dbghelp/macho_module.c +++ b/dll/win32/dbghelp/macho_module.c @@ -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. */ -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; struct macho_debug_info mdi; @@ -1907,6 +1907,7 @@ static const struct loader_ops macho_loader_ops = { macho_synchronize_module_list, macho_load_module, + macho_load_debug_info, macho_enum_modules, macho_fetch_file_info, }; @@ -1937,8 +1938,4 @@ BOOL macho_read_wine_loader_dbg_info(struct process* pcs) return FALSE; } -BOOL macho_load_debug_info(struct process *pcs, struct module* module) -{ - return FALSE; -} #endif /* HAVE_MACH_O_LOADER_H */ diff --git a/dll/win32/dbghelp/module.c b/dll/win32/dbghelp/module.c index 4634893eb82..dcc73aa40ff 100644 --- a/dll/win32/dbghelp/module.c +++ b/dll/win32/dbghelp/module.c @@ -387,14 +387,8 @@ BOOL module_get_debug(struct module_pair* pair) BOOL ret; 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.BaseOfImage = pair->effective->module.BaseOfImage; idslW64.CheckSum = pair->effective->module.CheckSum; @@ -409,16 +403,9 @@ BOOL module_get_debug(struct module_pair* pair) pcs_callback(pair->pcs, ret ? CBA_DEFERRED_SYMBOL_LOAD_COMPLETE : CBA_DEFERRED_SYMBOL_LOAD_FAILURE, &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; assert(pair->effective->module.SymType != SymDeferred); 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; } +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) { return FALSE; @@ -1472,6 +1464,7 @@ const struct loader_ops no_loader_ops = { native_synchronize_module_list, native_load_module, + native_load_debug_info, native_enum_modules, native_fetch_file_info, }; diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg index 7a4f813471b..0225532289a 100644 --- a/sdk/tools/winesync/dbghelp.cfg +++ b/sdk/tools/winesync/dbghelp.cfg @@ -4,4 +4,4 @@ files: include/dbghelp.h: sdk/include/psdk/dbghelp.h include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h tags: - wine: 5ae3f969d4ec525a14a8109a5ee4c5a2e2238405 + wine: a676c5785ea56fede37370cd6d5e4508e9d8c62a