summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/StackTrace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/OSSupport/StackTrace.cpp')
-rw-r--r--src/OSSupport/StackTrace.cpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/OSSupport/StackTrace.cpp b/src/OSSupport/StackTrace.cpp
index 77c5a3724..5466d0617 100644
--- a/src/OSSupport/StackTrace.cpp
+++ b/src/OSSupport/StackTrace.cpp
@@ -6,12 +6,12 @@
#include "Globals.h"
#include "StackTrace.h"
#ifdef _WIN32
- #include "WinStackWalker.h"
+#include "WinStackWalker.h"
#else
- #ifdef __GLIBC__
- #include <execinfo.h>
- #endif
- #include <unistd.h>
+#ifdef __GLIBC__
+#include <execinfo.h>
+#endif
+#include <unistd.h>
#endif
@@ -20,23 +20,20 @@
void PrintStackTrace(void)
{
- #ifdef _WIN32
- class PrintingStackWalker:
- public WinStackWalker
- {
- virtual void OnOutput(LPCSTR szText) override
- {
- std::fputs(szText, stdout);
- }
- } sw;
- sw.ShowCallstack();
- #else
- #ifdef __GLIBC__
- // Use the backtrace() function to get and output the stackTrace:
- // Code adapted from https://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes
- void * stackTrace[30];
- auto numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
- backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
- #endif
- #endif
+#ifdef _WIN32
+ class PrintingStackWalker : public WinStackWalker
+ {
+ virtual void OnOutput(LPCSTR szText) override { std::fputs(szText, stdout); }
+ } sw;
+ sw.ShowCallstack();
+#else
+#ifdef __GLIBC__
+ // Use the backtrace() function to get and output the stackTrace:
+ // Code adapted from
+ // https://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes
+ void * stackTrace[30];
+ auto numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
+ backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
+#endif
+#endif
}