From: Jinoh Kang jinoh.kang.kr@gmail.com
This reverts commit 3047385437c7ef36996d0418ac378677f3e9d67c.
ntdll.so puts the base address of the main Unix executable, called the "debug base address," inside an unused field of PEB.
When debugging a WoW64 target process, obtaining the debug base address fails. This is because the architecture of PE modules differs from that of Unix modules. Specifically, dbghelp attempts to fetch it from the WoW64 PEB although it actually resides in the native PEB.
However, this shouldn't be a reason to give up initializing dbghelp entirely. We do not expect a "user-mode" debugger to be able to debug Unix-side modules in a WoW64 process anyway.
Signed-off-by: Jinoh Kang jinoh.kang.kr@gmail.com --- dlls/dbghelp/dbghelp.c | 2 -- dlls/dbghelp/macho_module.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c index c154d8d9713..6202c75381b 100644 --- a/dlls/dbghelp/dbghelp.c +++ b/dlls/dbghelp/dbghelp.c @@ -407,8 +407,6 @@ static BOOL check_live_target(struct process* pcs, BOOL wow64, BOOL child_wow64) free(buf); }
- if (!base) return FALSE; - TRACE("got debug info address %#Ix from PEB %p\n", base, pbi.PebBaseAddress); if (!elf_read_wine_loader_dbg_info(pcs, base) && !macho_read_wine_loader_dbg_info(pcs, base)) WARN("couldn't load process debug info at %#Ix\n", base); diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c index b90f248b15d..3ed77c3b1b8 100644 --- a/dlls/dbghelp/macho_module.c +++ b/dlls/dbghelp/macho_module.c @@ -1832,7 +1832,7 @@ static BOOL macho_search_loader(struct process* pcs, struct macho_info* macho_in len = sizeof(image_infos.infos64); else len = sizeof(image_infos.infos32); - if (read_process_memory(pcs, pcs->dbg_hdr_addr, &image_infos, len)) + if (pcs->dbg_hdr_addr && read_process_memory(pcs, pcs->dbg_hdr_addr, &image_infos, len)) { if (pcs->is_64bit) len = sizeof(image_info.info64);