summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/os_backtrace.cpp16
-rw-r--r--common/os_backtrace.hpp6
-rw-r--r--common/trace_writer_local.cpp4
3 files changed, 16 insertions, 10 deletions
diff --git a/common/os_backtrace.cpp b/common/os_backtrace.cpp
index eb809e0a..7f194951 100644
--- a/common/os_backtrace.cpp
+++ b/common/os_backtrace.cpp
@@ -38,8 +38,9 @@
#include <set>
#include "os.hpp"
+using trace::Id;
-namespace trace {
+namespace os {
/*
* Pascal string (with zero terminator optionally omitted)
@@ -110,7 +111,7 @@ bool backtrace_is_needed(const char* fname) {
return backtraceFunctionNamePrefixes.contain(fname);
}
-} /* namespace trace */
+} /* namespace os */
#if defined(ANDROID)
@@ -118,7 +119,7 @@ bool backtrace_is_needed(const char* fname) {
#include "os.hpp"
#include <vector>
-namespace trace {
+namespace os {
/* The following two declarations are copied from Android sources */
@@ -269,6 +270,8 @@ std::vector<RawStackFrame> get_backtrace() {
return backtraceProvider.parseBacktrace(backtraceProvider.getBacktrace());
}
+} /* namespace os */
+
/* end ANDROID */
#elif defined(__ELF__)
@@ -280,7 +283,7 @@ std::vector<RawStackFrame> get_backtrace() {
#include <backtrace.h>
-namespace trace {
+namespace os {
@@ -383,8 +386,9 @@ std::vector<RawStackFrame> get_backtrace() {
return backtraceProvider.getParsedBacktrace();
}
-#endif /* LINUX */
-} /* namespace trace */
+} /* namespace os */
+
+#endif /* __ELF__ */
#endif /* ANDROID or LINUX */
diff --git a/common/os_backtrace.hpp b/common/os_backtrace.hpp
index bfb0ffd1..43dbb417 100644
--- a/common/os_backtrace.hpp
+++ b/common/os_backtrace.hpp
@@ -31,7 +31,9 @@
#include "trace_model.hpp"
-namespace trace {
+namespace os {
+
+using trace::RawStackFrame;
#if defined(ANDROID) || defined(__ELF__)
@@ -51,6 +53,6 @@ static inline bool backtrace_is_needed(const char*) {
#endif
-} /* namespace trace */
+} /* namespace os */
#endif
diff --git a/common/trace_writer_local.cpp b/common/trace_writer_local.cpp
index a592cb8c..529f83b2 100644
--- a/common/trace_writer_local.cpp
+++ b/common/trace_writer_local.cpp
@@ -173,8 +173,8 @@ unsigned LocalWriter::beginEnter(const FunctionSig *sig, bool fake) {
assert(this_thread_num);
unsigned thread_id = this_thread_num - 1;
unsigned call_no = Writer::beginEnter(sig, thread_id);
- if (!fake && backtrace_is_needed(sig->name)) {
- std::vector<RawStackFrame> backtrace = get_backtrace();
+ if (!fake && os::backtrace_is_needed(sig->name)) {
+ std::vector<RawStackFrame> backtrace = os::get_backtrace();
beginBacktrace(backtrace.size());
for (unsigned i = 0; i < backtrace.size(); ++i) {
writeStackFrame(&backtrace[i]);