Fix GL version detection.
[ipdf/code.git] / src / log.cpp
index 3af4aca..a695b0e 100644 (file)
@@ -10,6 +10,9 @@
 #include <cstdio>
 #include <unistd.h>
 #include <stdarg.h>
+#ifndef __MINGW32__
+#include <execinfo.h>
+#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
+}
+

UCC git Repository :: git.ucc.asn.au