From 58c50e916e04fca478789f1212691a1946ad211e Mon Sep 17 00:00:00 2001 From: winesync Date: Fri, 11 Sep 2020 17:10:42 +0200 Subject: [PATCH] [WINESYNC] dbghelp: Pass process struct to elf_enum_modules and macho_enum_modules. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard wine commit id 724f433f39f71e8869c49a5960364c5669759b08 by Jacek Caban --- dll/win32/dbghelp/dbghelp_private.h | 4 ++-- dll/win32/dbghelp/elf_module.c | 12 ++++-------- dll/win32/dbghelp/macho_module.c | 13 ++++--------- dll/win32/dbghelp/minidump.c | 7 +++++-- sdk/tools/winesync/dbghelp.cfg | 2 +- 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/dll/win32/dbghelp/dbghelp_private.h b/dll/win32/dbghelp/dbghelp_private.h index 4e2d9f414f9..7c164fce219 100644 --- a/dll/win32/dbghelp/dbghelp_private.h +++ b/dll/win32/dbghelp/dbghelp_private.h @@ -625,7 +625,7 @@ extern DWORD calc_crc32(HANDLE handle) DECLSPEC_HIDDEN; typedef BOOL (*enum_modules_cb)(const WCHAR*, unsigned long addr, void* user); /* elf_module.c */ -extern BOOL elf_enum_modules(HANDLE hProc, enum_modules_cb, void*) DECLSPEC_HIDDEN; +extern BOOL elf_enum_modules(struct process*, enum_modules_cb, void*) DECLSPEC_HIDDEN; extern BOOL elf_fetch_file_info(const WCHAR* name, DWORD_PTR* base, DWORD* size, DWORD* checksum) DECLSPEC_HIDDEN; struct image_file_map; extern BOOL elf_load_debug_info(struct module* module) DECLSPEC_HIDDEN; @@ -637,7 +637,7 @@ 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_enum_modules(HANDLE hProc, enum_modules_cb, void*) DECLSPEC_HIDDEN; +extern BOOL macho_enum_modules(struct process*, enum_modules_cb, void*) DECLSPEC_HIDDEN; extern BOOL macho_fetch_file_info(HANDLE process, const WCHAR* name, unsigned long load_addr, DWORD_PTR* base, DWORD* size, DWORD* checksum) DECLSPEC_HIDDEN; extern BOOL macho_load_debug_info(struct process *pcs, struct module* module) DECLSPEC_HIDDEN; extern struct module* diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c index 0b60524fc44..728025fa405 100644 --- a/dll/win32/dbghelp/elf_module.c +++ b/dll/win32/dbghelp/elf_module.c @@ -1561,21 +1561,17 @@ static BOOL elf_enum_modules_translate(const WCHAR* name, unsigned long load_add * This function doesn't require that someone has called SymInitialize * on this very process. */ -BOOL elf_enum_modules(HANDLE hProc, enum_modules_cb cb, void* user) +BOOL elf_enum_modules(struct process* process, enum_modules_cb cb, void* user) { - struct process pcs; struct elf_info elf_info; BOOL ret; struct elf_enum_user eeu; - memset(&pcs, 0, sizeof(pcs)); - pcs.handle = hProc; elf_info.flags = ELF_INFO_DEBUG_HEADER | ELF_INFO_NAME; - if (!elf_search_loader(&pcs, &elf_info)) return FALSE; - pcs.dbg_hdr_addr = elf_info.dbg_hdr_addr; + elf_info.module_name = NULL; eeu.cb = cb; eeu.user = user; - ret = elf_enum_modules_internal(&pcs, elf_info.module_name, elf_enum_modules_translate, &eeu); + ret = elf_enum_modules_internal(process, elf_info.module_name, elf_enum_modules_translate, &eeu); HeapFree(GetProcessHeap(), 0, (char*)elf_info.module_name); return ret; } @@ -1747,7 +1743,7 @@ BOOL elf_read_wine_loader_dbg_info(struct process* pcs) return FALSE; } -BOOL elf_enum_modules(HANDLE hProc, enum_modules_cb cb, void* user) +BOOL elf_enum_modules(struct process *process, enum_modules_cb cb, void* user) { return FALSE; } diff --git a/dll/win32/dbghelp/macho_module.c b/dll/win32/dbghelp/macho_module.c index 193c97b0011..a35ed5db732 100644 --- a/dll/win32/dbghelp/macho_module.c +++ b/dll/win32/dbghelp/macho_module.c @@ -1843,19 +1843,14 @@ BOOL macho_read_wine_loader_dbg_info(struct process* pcs) * This function doesn't require that someone has called SymInitialize * on this very process. */ -BOOL macho_enum_modules(HANDLE hProc, enum_modules_cb cb, void* user) +BOOL macho_enum_modules(struct process* process, enum_modules_cb cb, void* user) { - struct process pcs; struct macho_info macho_info; BOOL ret; - TRACE("(%p, %p, %p)\n", hProc, cb, user); - memset(&pcs, 0, sizeof(pcs)); - pcs.handle = hProc; + TRACE("(%p, %p, %p)\n", process->handle, cb, user); macho_info.flags = MACHO_INFO_DEBUG_HEADER | MACHO_INFO_NAME; - if (!macho_search_loader(&pcs, &macho_info)) return FALSE; - pcs.dbg_hdr_addr = macho_info.dbg_hdr_addr; - ret = macho_enum_modules_internal(&pcs, macho_info.module_name, cb, user); + ret = macho_enum_modules_internal(process, macho_info.module_name, cb, user); HeapFree(GetProcessHeap(), 0, (char*)macho_info.module_name); return ret; } @@ -1949,7 +1944,7 @@ BOOL macho_read_wine_loader_dbg_info(struct process* pcs) return FALSE; } -BOOL macho_enum_modules(HANDLE hProc, enum_modules_cb cb, void* user) +BOOL macho_enum_modules(struct process *process, enum_modules_cb cb, void* user) { return FALSE; } diff --git a/dll/win32/dbghelp/minidump.c b/dll/win32/dbghelp/minidump.c index 04652c040cf..899a88b8d15 100644 --- a/dll/win32/dbghelp/minidump.c +++ b/dll/win32/dbghelp/minidump.c @@ -346,8 +346,11 @@ static void fetch_modules_info(struct dump_context* dc) * And it's always a good idea to have a trace of the loaded ELF modules for * a given application in a post mortem debugging condition. */ - elf_enum_modules(dc->process->handle, fetch_elf_module_info_cb, dc); - macho_enum_modules(dc->process->handle, fetch_macho_module_info_cb, dc); + if (dc->process->dbg_hdr_addr) + { + elf_enum_modules(dc->process, fetch_elf_module_info_cb, dc); + macho_enum_modules(dc->process, fetch_macho_module_info_cb, dc); + } } static void fetch_module_versioninfo(LPCWSTR filename, VS_FIXEDFILEINFO* ffi) diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg index 00802ca02d5..e3201a2b01f 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: 6b3018d03da983050516821caa2aada2f4814678 + wine: 724f433f39f71e8869c49a5960364c5669759b08