Chromium Code Reviews| Index: src/base/debug/stack_trace_posix.cc |
| diff --git a/src/base/debug/stack_trace_posix.cc b/src/base/debug/stack_trace_posix.cc |
| index cbd722d35cda9e12a33898c912f4da4794148599..ccd13dff8f234150f05769a12374bb5eea93c2e5 100644 |
| --- a/src/base/debug/stack_trace_posix.cc |
| +++ b/src/base/debug/stack_trace_posix.cc |
| @@ -25,7 +25,7 @@ |
| #include <string> |
| #include <vector> |
| -#if V8_LIBC_GLIBC || V8_OS_BSD |
| +#if V8_LIBC_GLIBC || V8_OS_BSD || V8_OS_SOLARIS |
| #include <cxxabi.h> |
| #include <execinfo.h> |
| #endif |
| @@ -77,7 +77,7 @@ void DemangleSymbols(std::string* text) { |
| // Note: code in this function is NOT async-signal safe (std::string uses |
| // malloc internally). |
| -#if V8_LIBC_GLIBC || V8_OS_BSD |
| +#if V8_LIBC_GLIBC || V8_OS_BSD || V8_OS_SOLARIS |
| std::string::size_type search_from = 0; |
| while (search_from < text->size()) { |
| @@ -114,7 +114,7 @@ void DemangleSymbols(std::string* text) { |
| } |
| } |
| -#endif // V8_LIBC_GLIBC || V8_OS_BSD |
| +#endif // V8_LIBC_GLIBC || V8_OS_BSD || V8_OS_SOLARIS |
| } |
| class BacktraceOutputHandler { |
| @@ -125,6 +125,7 @@ class BacktraceOutputHandler { |
| virtual ~BacktraceOutputHandler() {} |
| }; |
| +#if V8_LIBC_GLIBC || V8_OS_BSD || V8_OS_SOLARIS |
|
rmcilroy
2016/09/07 11:06:22
Why is this change needed (and the similar changes
|
| void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { |
| // This should be more than enough to store a 64-bit number in hex: |
| // 16 hex digits + 1 for null-terminator. |
| @@ -171,6 +172,7 @@ void ProcessBacktrace(void* const* trace, size_t size, |
| } |
| } |
| } |
| +#endif // V8_LIBC_GLIBC || V8_OS_BSD || V8_OS_SOLARIS |
| void PrintToStderr(const char* output) { |
| // NOTE: This code MUST be async-signal safe (it's used by in-process |
| @@ -359,23 +361,31 @@ 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 V8_LIBC_GLIBC || V8_OS_BSD || V8_OS_SOLARIS |
| // Though the backtrace API man page does not list any possible negative |
| // return values, we take no chance. |
| count_ = static_cast<size_t>(backtrace(trace_, arraysize(trace_))); |
| +#else |
| + count_ = 0; |
| +#endif |
| } |
| 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. |
| +#if V8_LIBC_GLIBC || V8_OS_BSD || V8_OS_SOLARIS |
| PrintBacktraceOutputHandler handler; |
| ProcessBacktrace(trace_, count_, &handler); |
| +#endif |
| } |
| +#if V8_LIBC_GLIBC || V8_OS_BSD || V8_OS_SOLARIS |
| void StackTrace::OutputToStream(std::ostream* os) const { |
| StreamBacktraceOutputHandler handler(os); |
| ProcessBacktrace(trace_, count_, &handler); |
| } |
| +#endif |
| namespace internal { |