#include "src/base/debug/stack_trace.h"
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <map>
#include <memory>
#include <ostream>
#include <string>
#include <vector>
#if V8_LIBC_GLIBC || V8_LIBC_BSD || V8_LIBC_UCLIBC || V8_OS_SOLARIS
#define HAVE_EXECINFO_H …
#endif
#if HAVE_EXECINFO_H
#include <cxxabi.h>
#include <execinfo.h>
#endif
#if V8_OS_DARWIN
#include <AvailabilityMacros.h>
#endif
#include "src/base/build_config.h"
#include "src/base/free_deleter.h"
#include "src/base/logging.h"
#include "src/base/macros.h"
namespace v8 {
namespace base {
namespace debug {
namespace internal {
char* itoa_r(intptr_t i, char* buf, size_t sz, int base, size_t padding);
}
namespace {
volatile sig_atomic_t in_signal_handler = …;
bool dump_stack_in_signal_handler = …;
const char kMangledSymbolPrefix[] = …;
const char kSymbolCharacters[] = …;
#if HAVE_EXECINFO_H
void DemangleSymbols(std::string* text) { … }
#endif
class BacktraceOutputHandler { … };
#if HAVE_EXECINFO_H
void OutputPointer(void* pointer, BacktraceOutputHandler* handler) { … }
void ProcessBacktrace(void* const* trace, size_t size,
BacktraceOutputHandler* handler) { … }
#endif
void PrintToStderr(const char* output) { … }
void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { … }
class PrintBacktraceOutputHandler : public BacktraceOutputHandler { … };
class StreamBacktraceOutputHandler : public BacktraceOutputHandler { … };
void WarmUpBacktrace() { … }
}
bool EnableInProcessStackDumping() { … }
void DisableSignalStackDump() { … }
StackTrace::StackTrace() { … }
void StackTrace::Print() const { … }
void StackTrace::OutputToStream(std::ostream* os) const { … }
namespace internal {
char* itoa_r(intptr_t i, char* buf, size_t sz, int base, size_t padding) { … }
}
}
}
}