Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2300)

Unified Diff: base/debug/stack_trace_posix.cc

Issue 226623008: don't use glibc-specific execinfo.h on uclibc builds (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ifdef out Print and OutputToStream in uClibc builds Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/debug/stack_trace.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/stack_trace_posix.cc
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
index 2d63a242430785a57d14ba5beedab9133f91d00c..13fd680e7e6e1a31b95992156e10da6d9a63a3fc 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -5,7 +5,6 @@
#include "base/debug/stack_trace.h"
#include <errno.h>
-#include <execinfo.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
@@ -20,8 +19,9 @@
#include <string>
#include <vector>
-#if defined(__GLIBCXX__)
+#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
#include <cxxabi.h>
+#include <execinfo.h>
#endif
#if defined(OS_MACOSX)
@@ -71,7 +71,7 @@ void DemangleSymbols(std::string* text) {
// Note: code in this function is NOT async-signal safe (std::string uses
// malloc internally).
-#if defined(__GLIBCXX__)
+#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
std::string::size_type search_from = 0;
while (search_from < text->size()) {
@@ -108,7 +108,7 @@ void DemangleSymbols(std::string* text) {
}
}
-#endif // defined(__GLIBCXX__)
+#endif // defined(__GLIBCXX__) && !defined(__UCLIBC__)
}
#endif // !defined(USE_SYMBOLIZE)
@@ -167,7 +167,7 @@ void ProcessBacktrace(void *const *trace,
handler->HandleOutput("\n");
}
-#else
+#elif defined(__GLIBCXX__) && !defined(__UCLIBC__)
bool printed = false;
// Below part is async-signal unsafe (uses malloc), so execute it only
@@ -279,7 +279,9 @@ void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) {
}
PrintToStderr("\n");
+#if !defined(__UCLIBC__)
debug::StackTrace().Print();
+#endif
#if defined(OS_LINUX)
#if ARCH_CPU_X86_FAMILY
@@ -738,11 +740,14 @@ StackTrace::StackTrace() {
// NOTE: This code MUST be async-signal safe (it's used by in-process
// stack dumping signal handler). NO malloc or stdio is allowed here.
+#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
// Though the backtrace API man page does not list any possible negative
// return values, we take no chance.
count_ = base::saturated_cast<size_t>(backtrace(trace_, arraysize(trace_)));
+#endif
}
+#if !defined(__UCLIBC__)
void StackTrace::Print() const {
// NOTE: This code MUST be async-signal safe (it's used by in-process
// stack dumping signal handler). NO malloc or stdio is allowed here.
@@ -755,6 +760,7 @@ void StackTrace::OutputToStream(std::ostream* os) const {
StreamBacktraceOutputHandler handler(os);
ProcessBacktrace(trace_, count_, &handler);
}
+#endif
namespace internal {
« no previous file with comments | « base/debug/stack_trace.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698