Chromium Code Reviews| 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..5824d64e592f4caeaa1fb72ab3377e652f710098 100644 |
| --- a/base/debug/stack_trace_posix.cc |
| +++ b/base/debug/stack_trace_posix.cc |
| @@ -5,7 +5,11 @@ |
| #include "base/debug/stack_trace.h" |
| #include <errno.h> |
| + |
| +#if !defined(__UCLIBC__) |
| #include <execinfo.h> |
| +#endif |
| + |
| #include <fcntl.h> |
| #include <signal.h> |
| #include <stdio.h> |
| @@ -20,7 +24,7 @@ |
| #include <string> |
| #include <vector> |
| -#if defined(__GLIBCXX__) |
| +#if defined(__GLIBCXX__) && !defined(__UCLIBC__) |
| #include <cxxabi.h> |
| #endif |
| @@ -71,7 +75,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 +112,7 @@ void DemangleSymbols(std::string* text) { |
| } |
| } |
| -#endif // defined(__GLIBCXX__) |
| +#endif // defined(__GLIBCXX__) && !defined(__UCLIBC__) |
| } |
| #endif // !defined(USE_SYMBOLIZE) |
| @@ -167,7 +171,7 @@ void ProcessBacktrace(void *const *trace, |
| handler->HandleOutput("\n"); |
| } |
| -#else |
| +#elif !defined(__UCLIBC__) |
| bool printed = false; |
| // Below part is async-signal unsafe (uses malloc), so execute it only |
| @@ -279,7 +283,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 +744,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(__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 |
|
earthdok
2014/04/08 15:28:30
#else
count_ = 0;
#endif
Mostyn Bramley-Moore
2014/04/08 15:40:46
Done.
|
| } |
| +#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 +764,7 @@ void StackTrace::OutputToStream(std::ostream* os) const { |
| StreamBacktraceOutputHandler handler(os); |
| ProcessBacktrace(trace_, count_, &handler); |
| } |
| +#endif |
| namespace internal { |