57 lines
1.4 KiB
Diff
57 lines
1.4 KiB
Diff
--- a/src/CrashHandler.cpp
|
|
+++ b/src/CrashHandler.cpp
|
|
@@ -16,6 +16,14 @@
|
|
#include <iomanip>
|
|
#include <sstream>
|
|
|
|
+#ifdef __MINGW32__
|
|
+ #include <winsock2.h>
|
|
+ #include <windows.h>
|
|
+ #include <DbgHelp.h>
|
|
+#elif defined(__GLIBC__)
|
|
+ #include <execinfo.h>
|
|
+#endif
|
|
+
|
|
using namespace std;
|
|
using namespace openshot;
|
|
|
|
@@ -34,7 +42,7 @@ CrashHandler *CrashHandler::Instance()
|
|
// TODO: Windows exception handling methods
|
|
signal(SIGSEGV, CrashHandler::abortHandler);
|
|
|
|
-#else
|
|
+#elif defined(__GLIBC__)
|
|
struct sigaction sa;
|
|
sa.sa_flags = SA_SIGINFO;
|
|
sa.sa_sigaction = CrashHandler::abortHandler;
|
|
@@ -111,6 +119,7 @@ void CrashHandler::abortHandler( int sig
|
|
|
|
void CrashHandler::printStackTrace(FILE *out, unsigned int max_frames)
|
|
{
|
|
+#ifdef __GLIBC__
|
|
fprintf(out, "---- Unhandled Exception: Stack Trace ----\n");
|
|
ZmqLogger::Instance()->LogToFile("---- Unhandled Exception: Stack Trace ----\n");
|
|
stringstream stack_output;
|
|
@@ -306,4 +315,5 @@ void CrashHandler::printStackTrace(FILE
|
|
|
|
fprintf(out, "---- End of Stack Trace ----\n");
|
|
ZmqLogger::Instance()->LogToFile("---- End of Stack Trace ----\n");
|
|
+#endif // __GLIBC__
|
|
}
|
|
--- a/src/CrashHandler.h
|
|
+++ b/src/CrashHandler.h
|
|
@@ -16,13 +16,6 @@
|
|
#include <cstdlib>
|
|
#include <stdio.h>
|
|
#include <signal.h>
|
|
-#ifdef __MINGW32__
|
|
- #include <winsock2.h>
|
|
- #include <windows.h>
|
|
- #include <DbgHelp.h>
|
|
-#else
|
|
- #include <execinfo.h>
|
|
-#endif
|
|
#include <errno.h>
|
|
#include <cxxabi.h>
|
|
#include "ZmqLogger.h"
|