@@ -47,18 +47,21 @@ static BOOL bException = FALSE;
4747
4848namespace
4949{
50- #ifdef XR_X64
51- extern " C" void * _ReturnAddress (void );
52- DWORD_PTR GetInstructionPtr ()
53- {
54- return (DWORD_PTR)_ReturnAddress ();
55- }
56- #else
57- void __declspec (naked, noinline) * __cdecl GetInstructionPtr()
50+
51+ ICN void * GetInstructionPtr ()
5852{
59- _asm mov eax, [esp] _asm retn
60- }
53+ #ifdef _MSC_VER
54+ return _ReturnAddress ();
55+ #else
56+ #ifdef _WIN64
57+ _asm mov rax, [rsp]
58+ _asm retn
59+ #else
60+ _asm mov eax, [esp]
61+ _asm retn
6162#endif
63+ #endif
64+ }
6265}
6366
6467xrDebug::UnhandledExceptionFilter xrDebug::PrevFilter = nullptr ;
@@ -90,7 +93,7 @@ size_t xrDebug::BuildStackTrace(char* buffer, size_t capacity, size_t lineCapaci
9093 if (GetThreadContext (GetCurrentThread (), &context))
9194 {
9295#if defined(XR_X64)
93- context.Rip = GetInstructionPtr ();
96+ context.Rip = (DWORD64) GetInstructionPtr ();
9497 context.Rbp = (DWORD64)&ebp;
9598 context.Rsp = (DWORD64)&context;
9699#elif defined(XR_X86)
@@ -337,7 +340,7 @@ void WINAPI xrDebug::PreErrorHandler(INT_PTR)
337340
338341 string_path dumpPath;
339342 if (FS.path_exist (" $app_data_root$" ))
340- FS.update_path (dumpPath, " $app_data_root$" , dumpPath );
343+ FS.update_path (dumpPath, " $app_data_root$" , " " );
341344 xr_strcat (dumpPath, " reports" );
342345
343346 BT_SetReportFilePath (dumpPath);
@@ -468,7 +471,7 @@ LONG WINAPI xrDebug::UnhandledFilter(EXCEPTION_POINTERS* exPtrs)
468471 if (OnDialog)
469472 OnDialog (true );
470473 MessageBox (NULL ,
471- " Fatal error occured \n\n "
474+ " Fatal error occurred \n\n "
472475 " Press OK to abort program execution" ,
473476 " Fatal error" , MB_OK | MB_ICONERROR | MB_SYSTEMMODAL);
474477 }
0 commit comments