summaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-12-06 12:56:03 +0000
committerChris Wilson <chris+github@qwirx.com>2014-12-06 12:56:03 +0000
commit9ce77cc16d4a8aeb72ec0dc925966e11c85a985e (patch)
treed95a96104d4be2fb9b42d406ec0db150601f8ceb /lib/common
parent5e0e3bb7a9d2767bb1ffdb392c742b616f97eb25 (diff)
Fix compile on platforms without execinfo.h
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/Utils.cpp8
-rw-r--r--lib/common/Utils.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/common/Utils.cpp b/lib/common/Utils.cpp
index ddb79ba8..a73a80da 100644
--- a/lib/common/Utils.cpp
+++ b/lib/common/Utils.cpp
@@ -15,7 +15,7 @@
#include <cstdlib>
-#ifdef SHOW_BACKTRACE_ON_EXCEPTION
+#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#include <stdlib.h>
#endif
@@ -95,7 +95,6 @@ void SplitString(std::string String, char SplitOn, std::vector<std::string> &rOu
#endif*/
}
-#ifdef SHOW_BACKTRACE_ON_EXCEPTION
static std::string demangle(const std::string& mangled_name)
{
std::string demangled_name = mangled_name;
@@ -146,6 +145,7 @@ static std::string demangle(const std::string& mangled_name)
void DumpStackBacktrace()
{
+#ifdef HAVE_EXECINFO_H
void *array[20];
size_t size = backtrace(array, 20);
BOX_TRACE("Obtained " << size << " stack frames.");
@@ -182,8 +182,10 @@ void DumpStackBacktrace()
BOX_TRACE(output.str());
}
+#else // !HAVE_EXECINFO_H
+ BOX_TRACE("Backtrace support was not compiled in");
+#endif // HAVE_EXECINFO_H
}
-#endif // SHOW_BACKTRACE_ON_EXCEPTION
diff --git a/lib/common/Utils.h b/lib/common/Utils.h
index 636fb487..3a5f0eb5 100644
--- a/lib/common/Utils.h
+++ b/lib/common/Utils.h
@@ -19,9 +19,7 @@ std::string GetBoxBackupVersion();
void SplitString(std::string String, char SplitOn, std::vector<std::string> &rOutput);
-#ifdef SHOW_BACKTRACE_ON_EXCEPTION
- void DumpStackBacktrace();
-#endif
+void DumpStackBacktrace();
bool FileExists(const std::string& rFilename, int64_t *pFileSize = 0,
bool TreatLinksAsNotExisting = false);