parent
213419a4cc
commit
03a972ec55
@ -14,13 +14,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -44,7 +37,7 @@ void PrintStackTrace(void)
|
|||||||
// Use the backtrace() function to get and output the stackTrace:
|
// 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
|
// Code adapted from http://stackoverflow.com/questions/77005/how-to-generate-a-stacktrace-when-my-gcc-c-app-crashes
|
||||||
void * stackTrace[30];
|
void * stackTrace[30];
|
||||||
btsize numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
|
auto numItems = backtrace(stackTrace, ARRAYCOUNT(stackTrace));
|
||||||
backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
|
backtrace_symbols_fd(stackTrace, numItems, STDERR_FILENO);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user