For apitrace integrated into Regal they want to opt-out of backtrace
support, for now. One reason is that it's fairly platform-specific.
Another concern is potential build issue across various Linux flavors.
Based on Nigel Stewart patch on issue #168.
add_subdirectory (thirdparty/libbacktrace)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libbacktrace)
set (LIBBACKTRACE_LIBRARIES dl backtrace)
+ add_definitions (-DHAVE_BACKTRACE=1)
endif ()
# Always use bundled QJSon.
*/
-
#include "os_backtrace.hpp"
-#if defined(ANDROID) || defined(__ELF__)
-
#include <set>
+#include <vector>
#include "os.hpp"
+#if defined(ANDROID)
+# include <dlfcn.h>
+#elif HAVE_BACKTRACE
+# include <stdint.h>
+# include <dlfcn.h>
+# include <unistd.h>
+# include <map>
+# include <vector>
+# include <cxxabi.h>
+# include <backtrace.h>
+#endif
+
+
using trace::Id;
namespace os {
return backtraceFunctionNamePrefixes.contain(fname);
}
-} /* namespace os */
-
#if defined(ANDROID)
-#include <dlfcn.h>
-#include "os.hpp"
-#include <vector>
-
-namespace os {
-
/* The following two declarations are copied from Android sources */
enum DebugTargetKind {
/* TODO */
}
-} /* namespace os */
-/* end ANDROID */
-#elif defined(__ELF__)
+#elif HAVE_BACKTRACE
-#include <stdint.h>
-#include <dlfcn.h>
-#include <unistd.h>
-#include <map>
-#include <vector>
-#include <cxxabi.h>
-
-#include <backtrace.h>
-
-namespace os {
static char* format(uintptr_t num, int base, char *buf, int maxlen)
{
}
-} /* namespace os */
+#else /* !HAVE_BACKTRACE */
-#endif /* __ELF__ */
+std::vector<RawStackFrame> get_backtrace() {
+ return std::vector<RawStackFrame>();
+}
-#endif /* ANDROID or LINUX */
+void dump_backtrace() {
+}
+
+#endif
+
+
+} /* namespace os */
using trace::RawStackFrame;
-#if defined(ANDROID) || defined(__ELF__)
-
std::vector<RawStackFrame> get_backtrace();
bool backtrace_is_needed(const char* fname);
-#else
-
-static inline std::vector<RawStackFrame> get_backtrace() {
- return std::vector<RawStackFrame>();
-}
-
-static inline bool backtrace_is_needed(const char*) {
- return false;
-}
-
-#endif
-
-#if defined(__ELF__)
-
void dump_backtrace();
-#else
-
-static inline void dump_backtrace() {}
-
-#endif
} /* namespace os */