Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yellowback/5501027 to your computer and use it in GitHub Desktop.
Save yellowback/5501027 to your computer and use it in GitHub Desktop.
Index: debug/stack_trace_posix.cc
===================================================================
--- debug/stack_trace_posix.cc (revision 161115)
+++ debug/stack_trace_posix.cc (working copy)
@@ -124,7 +124,7 @@
trace_strings->push_back(base::StringPrintf("%p", trace[i]));
}
}
-#else
+#elif defined(OS_LINUX)
scoped_ptr_malloc<char*> trace_symbols(backtrace_symbols(trace, size));
if (trace_symbols.get()) {
for (int i = 0; i < size; ++i) {
@@ -150,7 +150,11 @@
StackTrace::StackTrace() {
// Though the backtrace API man page does not list any possible negative
// return values, we take no chance.
+#if defined(OS_LINUX)
count_ = std::max(backtrace(trace_, arraysize(trace_)), 0);
+#else
+ count_ = 0;
+#endif
}
void StackTrace::PrintBacktrace() const {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment