X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Flog.cpp;h=a695b0e72e53264dd58fa78e61c0c036cd1040e5;hb=25548aa3a2c3fd86202b01a88df6abd820a9eb6d;hp=3af4aca723c0607004bc8c25576e07cb37ade84a;hpb=42737c4c096f6469fb27e261806b48338a8f672f;p=ipdf%2Fcode.git diff --git a/src/log.cpp b/src/log.cpp index 3af4aca..a695b0e 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -10,6 +10,9 @@ #include #include #include +#ifndef __MINGW32__ +#include +#endif #ifdef LOG_SYSLOG @@ -139,3 +142,17 @@ void FatalEx(const char * funct, const char * file, int line, ...) } +/** + * Print a backtrace + */ +void Backtrace(int size) +{ + #ifndef __MINGW32__ + void * buffer[100]; + int actual_size = backtrace(buffer, size); + backtrace_symbols_fd(buffer, actual_size, fileno(stderr)); + #else + Error("Backtrace not supported by compiler"); + #endif +} +