summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/StackTrace.cpp
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-05-30 11:32:35 +0200
committerworktycho <work.tycho@gmail.com>2015-05-30 11:32:35 +0200
commit2ce405883ac34f3f2e443d60ba93a94568568f39 (patch)
tree63de5aa4fdcfe13224e954aa557096a720389401 /src/OSSupport/StackTrace.cpp
parentMerge pull request #2167 from SafwatHalaby/diags (diff)
parentFix FreeBSD/clang errors caused by -Werror (diff)
downloadcuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.gz
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.bz2
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.lz
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.xz
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.tar.zst
cuberite-2ce405883ac34f3f2e443d60ba93a94568568f39.zip
Diffstat (limited to 'src/OSSupport/StackTrace.cpp')
-rw-r--r--src/OSSupport/StackTrace.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/OSSupport/StackTrace.cpp b/src/OSSupport/StackTrace.cpp
index 015a53ba0..1ec10f20e 100644
--- a/src/OSSupport/StackTrace.cpp
+++ b/src/OSSupport/StackTrace.cpp
@@ -12,6 +12,13 @@
#include <unistd.h>
#endif
+// FreeBSD uses size_t for the return type of backtrace()
+#if defined(__FreeBSD__) && (__FreeBSD__ >= 10)
+ #define btsize size_t
+#else
+ #define btsize int
+#endif
+
@@ -34,7 +41,7 @@ void PrintStackTrace(void)
// Use the backtrace() function to get and output the stackTrace:
// Code adapted from http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes
void * stackTrace[30];
- int numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
+ btsize numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
#endif
}