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_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.
endif ()
# Always use bundled QJSon.
#include "os_backtrace.hpp"
#include "os_backtrace.hpp"
-#if defined(ANDROID) || defined(__ELF__)
-
+#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 {
using trace::Id;
namespace os {
return backtraceFunctionNamePrefixes.contain(fname);
}
return backtraceFunctionNamePrefixes.contain(fname);
}
-#include <dlfcn.h>
-#include "os.hpp"
-#include <vector>
-
-namespace os {
-
/* The following two declarations are copied from Android sources */
enum DebugTargetKind {
/* The following two declarations are copied from Android sources */
enum DebugTargetKind {
-/* end ANDROID */
-#elif defined(__ELF__)
-#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)
{
static char* format(uintptr_t num, int base, char *buf, int maxlen)
{
+#else /* !HAVE_BACKTRACE */
+std::vector<RawStackFrame> get_backtrace() {
+ return std::vector<RawStackFrame>();
+}
-#endif /* ANDROID or LINUX */
+void dump_backtrace() {
+}
+
+#endif
+
+
+} /* namespace os */
using trace::RawStackFrame;
using trace::RawStackFrame;
-#if defined(ANDROID) || defined(__ELF__)
-
std::vector<RawStackFrame> get_backtrace();
bool backtrace_is_needed(const char* fname);
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__)
-
-#else
-
-static inline void dump_backtrace() {}
-
-#endif