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>
This commit is contained in:
Jacek Caban 2020-03-24 01:53:23 +01:00 committed by Alexandre Julliard
parent 6b3018d03d
commit 724f433f39
4 changed files with 15 additions and 21 deletions

View File

@ -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*

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)