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

Unified Diff: src/base/debug/stack_trace_posix.cc

Issue 2333023002: Fix backtrace for solaris and musl C based linux environments as well (Closed)
Patch Set: address code review comments Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 65df63e8e754a1e8e4f5198590dd0609e1ce4853..87c0a73d191e65fcba1726adc5bfa9df8d410225 100644
--- a/src/base/debug/stack_trace_posix.cc
+++ b/src/base/debug/stack_trace_posix.cc
@@ -25,7 +25,11 @@
#include <string>
#include <vector>
-#if V8_LIBC_GLIBC || V8_OS_BSD || V8_LIBC_UCLIBC
+#if V8_LIBC_GLIBC || V8_LIBC_BSD || V8_LIBC_UCLIBC || V8_OS_SOLARIS
+#define HAVE_EXECINFO_H 1
+#endif
+
+#if HAVE_EXECINFO_H
#include <cxxabi.h>
#include <execinfo.h>
#endif
@@ -77,7 +81,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 || V8_LIBC_UCLIBC
+#if HAVE_EXECINFO_H
std::string::size_type search_from = 0;
while (search_from < text->size()) {
@@ -114,7 +118,7 @@ void DemangleSymbols(std::string* text) {
}
}
-#endif // V8_LIBC_GLIBC || V8_OS_BSD || V8_LIBC_UCLIBC
+#endif // HAVE_EXECINFO_H
}
class BacktraceOutputHandler {
@@ -135,7 +139,7 @@ void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
handler->HandleOutput(buf);
}
-#if !V8_OS_AIX
+#if HAVE_EXECINFO_H
void ProcessBacktrace(void* const* trace, size_t size,
BacktraceOutputHandler* handler) {
// NOTE: This code MUST be async-signal safe (it's used by in-process
@@ -172,7 +176,7 @@ void ProcessBacktrace(void* const* trace, size_t size,
}
}
}
-#endif // !V8_OS_AIX
+#endif // HAVE_EXECINFO_H
void PrintToStderr(const char* output) {
// NOTE: This code MUST be async-signal safe (it's used by in-process
@@ -361,7 +365,7 @@ 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_OS_AIX
+#if HAVE_EXECINFO_H
// 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_)));
@@ -374,18 +378,18 @@ 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_OS_AIX
+#if HAVE_EXECINFO_H
PrintBacktraceOutputHandler handler;
ProcessBacktrace(trace_, count_, &handler);
#endif
}
-#if !V8_OS_AIX
void StackTrace::OutputToStream(std::ostream* os) const {
+#if HAVE_EXECINFO_H
StreamBacktraceOutputHandler handler(os);
ProcessBacktrace(trace_, count_, &handler);
-}
#endif
+}
namespace internal {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698