Skip to content

Commit

Permalink
Fixed xrCore compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jul 30, 2018
1 parent f1085c2 commit 28ffb6a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 9 additions & 6 deletions src/xrCore/xrDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,21 @@ xr_vector<xr_string> xrDebug::BuildStackTrace(PCONTEXT threadCtx, u16 maxFramesC

return traceResult;
}
#endif // defined(WINDOWS)

SStringVec xrDebug::BuildStackTrace(u16 maxFramesCount)
{
#if defined(WINDOWS)
CONTEXT currentThreadCtx = {};

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

return BuildStackTrace(&currentThreadCtx, maxFramesCount);
#else
#pragma todo("Implement stack trace for Linux")
return {"Implement stack trace for Linux"};
#endif
}

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


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

extern LPCSTR log_name();

#ifdef USE_BUG_TRAP
void WINAPI xrDebug::PreErrorHandler(INT_PTR)
void xrDebug::PreErrorHandler(INT_PTR)
{
#if defined(USE_BUG_TRAP) && defined(WINDOWS)
if (!xr_FS || !FS.m_Flags.test(CLocatorAPI::flReady))
return;
string_path logDir;
Expand All @@ -587,7 +592,6 @@ void WINAPI xrDebug::PreErrorHandler(INT_PTR)
}
string_path temp;
strconcat(sizeof(temp), temp, logDir, log_name());
#if defined(WINDOWS)
BT_AddLogFile(temp);
if (*BugReportFile)
BT_AddLogFile(BugReportFile);
Expand All @@ -604,7 +608,7 @@ void WINAPI xrDebug::PreErrorHandler(INT_PTR)

void xrDebug::SetupExceptionHandler(const bool& dedicated)
{
#if defined(WINDOWS)
#if defined(USE_BUG_TRAP) && defined(WINDOWS)
// disable 'appname has stopped working' popup dialog
UINT prevMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
SetErrorMode(prevMode | SEM_NOGPFAULTERRORBOX);
Expand Down Expand Up @@ -641,7 +645,6 @@ void xrDebug::SetupExceptionHandler(const bool& dedicated)
BT_SetSupportEMail("[email protected]");
#endif
}
#endif // USE_BUG_TRAP

#ifdef USE_OWN_MINI_DUMP
void xrDebug::SaveMiniDump(EXCEPTION_POINTERS *exPtrs)
Expand Down
5 changes: 1 addition & 4 deletions src/xrCore/xrDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,13 @@ class XRCORE_API xrDebug
static int ShowMessage(pcstr title, pcstr message, bool simple = true);

static void LogStackTrace(const char* header);
#if defined(WINDOWS)
static xr_vector<xr_string> BuildStackTrace(u16 maxFramesCount = 512);
#endif

private:
static bool symEngineInitialized;
static Lock dbgHelpLock;
static void FormatLastError(char* buffer, const size_t& bufferSize);
#ifdef USE_BUG_TRAP
static void SetupExceptionHandler(const bool& dedicated);
#endif
static LONG WINAPI UnhandledFilter(EXCEPTION_POINTERS* exPtrs);
static void WINAPI PreErrorHandler(INT_PTR);
static void SaveMiniDump(EXCEPTION_POINTERS* exPtrs);
Expand Down

0 comments on commit 28ffb6a

Please sign in to comment.