From 9c016004c20bdce96a268717bc3bd1b197cc3c16 Mon Sep 17 00:00:00 2001 From: Martins Mozeiko Date: Wed, 16 Oct 2024 14:09:57 -0700 Subject: [PATCH] Setup symbol path in win32 exception handler to the .exe folder Otherwise it was trying lookup .pdb files only in the current folder, as that is how .exe's are built (/pdbaltpath). This change now makes exception handler to load .pdb from the same folder as where .exe is. --- src/os/core/win32/os_core_win32.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/os/core/win32/os_core_win32.c b/src/os/core/win32/os_core_win32.c index 8c60f765..07befcf9 100644 --- a/src/os/core/win32/os_core_win32.c +++ b/src/os/core/win32/os_core_win32.c @@ -1362,8 +1362,12 @@ win32_exception_filter(EXCEPTION_POINTERS* exception_ptrs) HANDLE thread = GetCurrentThread(); CONTEXT* context = exception_ptrs->ContextRecord; + WCHAR module_path[MAX_PATH]; + GetModuleFileNameW(NULL, module_path, ArrayCount(module_path)); + PathRemoveFileSpecW(module_path); + dbg_SymSetOptions(SYMOPT_EXACT_SYMBOLS | SYMOPT_FAIL_CRITICAL_ERRORS | SYMOPT_LOAD_LINES | SYMOPT_UNDNAME); - if(dbg_SymInitializeW(process, L"", TRUE)) + if(dbg_SymInitializeW(process, module_path, TRUE)) { // check that raddbg.pdb file is good B32 raddbg_pdb_valid = 0;