Skip to content

Commit 28ffb6a

Browse files
committed
Fixed xrCore compilation
1 parent f1085c2 commit 28ffb6a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/xrCore/xrDebug.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,15 +337,21 @@ xr_vector<xr_string> xrDebug::BuildStackTrace(PCONTEXT threadCtx, u16 maxFramesC
337337

338338
return traceResult;
339339
}
340+
#endif // defined(WINDOWS)
340341

341342
SStringVec xrDebug::BuildStackTrace(u16 maxFramesCount)
342343
{
344+
#if defined(WINDOWS)
343345
CONTEXT currentThreadCtx = {};
344346

345347
RtlCaptureContext(&currentThreadCtx); /// GetThreadContext can't be used on the current thread
346348
currentThreadCtx.ContextFlags = CONTEXT_FULL;
347349

348350
return BuildStackTrace(&currentThreadCtx, maxFramesCount);
351+
#else
352+
#pragma todo("Implement stack trace for Linux")
353+
return {"Implement stack trace for Linux"};
354+
#endif
349355
}
350356

351357
void xrDebug::LogStackTrace(const char* header)
@@ -357,7 +363,6 @@ void xrDebug::LogStackTrace(const char* header)
357363
Msg("%s", frame.c_str());
358364
}
359365
}
360-
#endif // defined(WINDOWS)
361366

362367

363368
void xrDebug::GatherInfo(char* assertionInfo, size_t bufferSize, const ErrorLocation& loc, const char* expr,
@@ -563,9 +568,9 @@ int out_of_memory_handler(size_t size)
563568

564569
extern LPCSTR log_name();
565570

566-
#ifdef USE_BUG_TRAP
567-
void WINAPI xrDebug::PreErrorHandler(INT_PTR)
571+
void xrDebug::PreErrorHandler(INT_PTR)
568572
{
573+
#if defined(USE_BUG_TRAP) && defined(WINDOWS)
569574
if (!xr_FS || !FS.m_Flags.test(CLocatorAPI::flReady))
570575
return;
571576
string_path logDir;
@@ -587,7 +592,6 @@ void WINAPI xrDebug::PreErrorHandler(INT_PTR)
587592
}
588593
string_path temp;
589594
strconcat(sizeof(temp), temp, logDir, log_name());
590-
#if defined(WINDOWS)
591595
BT_AddLogFile(temp);
592596
if (*BugReportFile)
593597
BT_AddLogFile(BugReportFile);
@@ -604,7 +608,7 @@ void WINAPI xrDebug::PreErrorHandler(INT_PTR)
604608

605609
void xrDebug::SetupExceptionHandler(const bool& dedicated)
606610
{
607-
#if defined(WINDOWS)
611+
#if defined(USE_BUG_TRAP) && defined(WINDOWS)
608612
// disable 'appname has stopped working' popup dialog
609613
UINT prevMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
610614
SetErrorMode(prevMode | SEM_NOGPFAULTERRORBOX);
@@ -641,7 +645,6 @@ void xrDebug::SetupExceptionHandler(const bool& dedicated)
641645
BT_SetSupportEMail("[email protected]");
642646
#endif
643647
}
644-
#endif // USE_BUG_TRAP
645648

646649
#ifdef USE_OWN_MINI_DUMP
647650
void xrDebug::SaveMiniDump(EXCEPTION_POINTERS *exPtrs)

src/xrCore/xrDebug.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,13 @@ class XRCORE_API xrDebug
8585
static int ShowMessage(pcstr title, pcstr message, bool simple = true);
8686

8787
static void LogStackTrace(const char* header);
88-
#if defined(WINDOWS)
8988
static xr_vector<xr_string> BuildStackTrace(u16 maxFramesCount = 512);
90-
#endif
89+
9190
private:
9291
static bool symEngineInitialized;
9392
static Lock dbgHelpLock;
9493
static void FormatLastError(char* buffer, const size_t& bufferSize);
95-
#ifdef USE_BUG_TRAP
9694
static void SetupExceptionHandler(const bool& dedicated);
97-
#endif
9895
static LONG WINAPI UnhandledFilter(EXCEPTION_POINTERS* exPtrs);
9996
static void WINAPI PreErrorHandler(INT_PTR);
10097
static void SaveMiniDump(EXCEPTION_POINTERS* exPtrs);

0 commit comments

Comments
 (0)