]> git.cworth.org Git - apitrace/blobdiff - common/os_backtrace.cpp
eglretrace: Fix window size hints problem.
[apitrace] / common / os_backtrace.cpp
index fbe74455b867ebe2967308f5a9fa01c640192d0b..c95692bd11a54b6e4bb7d2e7ea44c8b1accef767 100644 (file)
  */
 
 
-
 #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 {
@@ -111,16 +122,8 @@ bool backtrace_is_needed(const char* fname) {
     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 {
@@ -270,21 +273,13 @@ std::vector<RawStackFrame> get_backtrace() {
     return backtraceProvider.parseBacktrace(backtraceProvider.getBacktrace());
 }
 
-} /* namespace os */
-
-/* end ANDROID */
-#elif defined(__ELF__)
+void dump_backtrace() {
+    /* TODO */
+}
 
-#include <stdint.h>
-#include <dlfcn.h>
-#include <unistd.h>
-#include <map>
-#include <vector>
-#include <cxxabi.h>
 
-#include <backtrace.h>
+#elif HAVE_BACKTRACE
 
-namespace os {
 
 static char* format(uintptr_t num, int base, char *buf, int maxlen)
 {
@@ -476,8 +471,16 @@ void dump_backtrace() {
 }
 
 
-} /* namespace os */
+#else /* !HAVE_BACKTRACE */
+
+std::vector<RawStackFrame> get_backtrace() {
+    return std::vector<RawStackFrame>();
+}
 
-#endif /* __ELF__ */
+void dump_backtrace() {
+}
 
-#endif /* ANDROID or LINUX */
+#endif
+
+
+} /* namespace os */