Module: wine Branch: master Commit: 724f433f39f71e8869c49a5960364c5669759b08 URL: https://source.winehq.org/git/wine.git/?a=commit;h=724f433f39f71e8869c49a596...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Mar 24 01:53:23 2020 +0100
dbghelp: Pass process struct to elf_enum_modules and macho_enum_modules.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dbghelp/dbghelp_private.h | 4 ++-- dlls/dbghelp/elf_module.c | 12 ++++-------- dlls/dbghelp/macho_module.c | 13 ++++--------- dlls/dbghelp/minidump.c | 7 +++++-- 4 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 733fc487fe..ad6679a3d3 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -594,7 +594,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; @@ -606,7 +606,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/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index 0b60524fc4..728025fa40 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/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/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c index 193c97b001..a35ed5db73 100644 --- a/dlls/dbghelp/macho_module.c +++ b/dlls/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/dlls/dbghelp/minidump.c b/dlls/dbghelp/minidump.c index dcb09cfcac..c7c8561bf7 100644 --- a/dlls/dbghelp/minidump.c +++ b/dlls/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)