summaryrefslogtreecommitdiff
path: root/absl/debugging/failure_signal_handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/debugging/failure_signal_handler.cc')
-rw-r--r--absl/debugging/failure_signal_handler.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/absl/debugging/failure_signal_handler.cc b/absl/debugging/failure_signal_handler.cc
index b2035148..a3a36f64 100644
--- a/absl/debugging/failure_signal_handler.cc
+++ b/absl/debugging/failure_signal_handler.cc
@@ -47,7 +47,7 @@
#endif
namespace absl {
-inline namespace lts_2018_06_20 {
+inline namespace lts_2018_12_18 {
ABSL_CONST_INIT static FailureSignalHandlerOptions fsh_options;
@@ -120,7 +120,11 @@ const char* FailureSignalToString(int signo) {
#ifndef _WIN32
static bool SetupAlternateStackOnce() {
+#if defined(__wasm__) || defined (__asjms__)
const size_t page_mask = getpagesize() - 1;
+#else
+ const size_t page_mask = sysconf(_SC_PAGESIZE) - 1;
+#endif
size_t stack_size = (std::max(SIGSTKSZ, 65536) + page_mask) & ~page_mask;
#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \
defined(THREAD_SANITIZER)
@@ -253,7 +257,7 @@ ABSL_ATTRIBUTE_NOINLINE static void WriteStackTrace(
depth, min_dropped_frames, symbolize_stacktrace, writerfn, writerfn_arg);
}
-// Called by FailureSignalHandler() to write the failure info. It is
+// Called by AbslFailureSignalHandler() to write the failure info. It is
// called once with writerfn set to WriteToStderr() and then possibly
// with writerfn set to the user provided function.
static void WriteFailureInfo(int signo, void* ucontext,
@@ -279,9 +283,9 @@ static void PortableSleepForSeconds(int seconds) {
}
#ifdef ABSL_HAVE_ALARM
-// FailureSignalHandler() installs this as a signal handler for
+// AbslFailureSignalHandler() installs this as a signal handler for
// SIGALRM, then sets an alarm to be delivered to the program after a
-// set amount of time. If FailureSignalHandler() hangs for more than
+// set amount of time. If AbslFailureSignalHandler() hangs for more than
// the alarm timeout, ImmediateAbortSignalHandler() will abort the
// program.
static void ImmediateAbortSignalHandler(int) {
@@ -295,11 +299,10 @@ using GetTidType = decltype(absl::base_internal::GetTID());
ABSL_CONST_INIT static std::atomic<GetTidType> failed_tid(0);
#ifndef ABSL_HAVE_SIGACTION
-static void FailureSignalHandler(int signo) {
+static void AbslFailureSignalHandler(int signo) {
void* ucontext = nullptr;
#else
-static void FailureSignalHandler(int signo, siginfo_t*,
- void* ucontext) {
+static void AbslFailureSignalHandler(int signo, siginfo_t*, void* ucontext) {
#endif
const GetTidType this_tid = absl::base_internal::GetTID();
@@ -309,10 +312,10 @@ static void FailureSignalHandler(int signo, siginfo_t*,
std::memory_order_acq_rel, std::memory_order_relaxed)) {
ABSL_RAW_LOG(
ERROR,
- "Signal %d raised at PC=%p while already in FailureSignalHandler()",
+ "Signal %d raised at PC=%p while already in AbslFailureSignalHandler()",
signo, absl::debugging_internal::GetProgramCounter(ucontext));
if (this_tid != previous_failed_tid) {
- // Another thread is already in FailureSignalHandler(), so wait
+ // Another thread is already in AbslFailureSignalHandler(), so wait
// a bit for it to finish. If the other thread doesn't kill us,
// we do so after sleeping.
PortableSleepForSeconds(3);
@@ -350,9 +353,9 @@ static void FailureSignalHandler(int signo, siginfo_t*,
void InstallFailureSignalHandler(const FailureSignalHandlerOptions& options) {
fsh_options = options;
for (auto& it : failure_signal_data) {
- InstallOneFailureHandler(&it, FailureSignalHandler);
+ InstallOneFailureHandler(&it, AbslFailureSignalHandler);
}
}
-} // inline namespace lts_2018_06_20
+} // inline namespace lts_2018_12_18
} // namespace absl