X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fcode.git;a=blobdiff_plain;f=src%2Flog.cpp;h=49b209a4f1c02f82cce61a3d79552cda2d0d9a3e;hp=3af4aca723c0607004bc8c25576e07cb37ade84a;hb=dfd021b1505fb3924ae103d8aa27c6200d6ec3fd;hpb=42737c4c096f6469fb27e261806b48338a8f672f diff --git a/src/log.cpp b/src/log.cpp index 3af4aca..49b209a 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #ifdef LOG_SYSLOG @@ -139,3 +140,13 @@ void FatalEx(const char * funct, const char * file, int line, ...) } +/** + * Print a backtrace + */ +void Backtrace(int size) +{ + void * buffer[100]; + int actual_size = backtrace(buffer, size); + backtrace_symbols_fd(buffer, actual_size, fileno(stderr)); +} +