diff options
Diffstat (limited to 'src/client/linux/handler/exception_handler.cc')
-rw-r--r-- | src/client/linux/handler/exception_handler.cc | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc index c65feaa1..bbdb798b 100644 --- a/src/client/linux/handler/exception_handler.cc +++ b/src/client/linux/handler/exception_handler.cc @@ -1,5 +1,4 @@ -// Copyright (c) 2010 Google Inc. -// All rights reserved. +// Copyright 2010 Google LLC // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -11,7 +10,7 @@ // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. -// * Neither the name of Google Inc. nor the names of its +// * Neither the name of Google LLC nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // @@ -138,7 +137,7 @@ void InstallAlternateStackLocked() { // SIGSTKSZ may be too small to prevent the signal handlers from overrunning // the alternative stack. Ensure that the size of the alternative stack is // large enough. - static const unsigned kSigStackSize = std::max(16384, SIGSTKSZ); + const unsigned kSigStackSize = std::max<unsigned>(16384, SIGSTKSZ); // Only set an alternative stack if there isn't already one, or if the current // one is too small. @@ -419,8 +418,8 @@ struct ThreadArgument { // This is the entry function for the cloned process. We are in a compromised // context here: see the top of the file. // static -int ExceptionHandler::ThreadEntry(void *arg) { - const ThreadArgument *thread_arg = reinterpret_cast<ThreadArgument*>(arg); +int ExceptionHandler::ThreadEntry(void* arg) { + const ThreadArgument* thread_arg = reinterpret_cast<ThreadArgument*>(arg); // Close the write end of the pipe. This allows us to fail if the parent dies // while waiting for the continue signal. @@ -461,10 +460,7 @@ bool ExceptionHandler::HandleSignal(int /*sig*/, siginfo_t* info, void* uc) { memcpy(&g_crash_context_.float_state, fp_ptr, sizeof(g_crash_context_.float_state)); } -#elif !defined(__ARM_EABI__) && !defined(__mips__) - // FP state is not part of user ABI on ARM Linux. - // In case of MIPS Linux FP state is already part of ucontext_t - // and 'float_state' is not a member of CrashContext. +#elif GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE ucontext_t* uc_ptr = (ucontext_t*)uc; if (uc_ptr->uc_mcontext.fpregs) { memcpy(&g_crash_context_.float_state, uc_ptr->uc_mcontext.fpregs, @@ -495,7 +491,7 @@ bool ExceptionHandler::SimulateSignalDelivery(int sig) { } // This function may run in a compromised context: see the top of the file. -bool ExceptionHandler::GenerateDump(CrashContext *context) { +bool ExceptionHandler::GenerateDump(CrashContext* context) { if (IsOutOfProcess()) return crash_generation_client_->RequestDump(context, sizeof(*context)); @@ -701,8 +697,7 @@ bool ExceptionHandler::WriteMinidump() { } #endif -#if !defined(__ARM_EABI__) && !defined(__aarch64__) && !defined(__mips__) - // FPU state is not part of ARM EABI ucontext_t. +#if GOOGLE_BREAKPAD_CRASH_CONTEXT_HAS_FLOAT_STATE && !defined(__aarch64__) memcpy(&context.float_state, context.context.uc_mcontext.fpregs, sizeof(context.float_state)); #endif @@ -726,8 +721,11 @@ bool ExceptionHandler::WriteMinidump() { #elif defined(__mips__) context.siginfo.si_addr = reinterpret_cast<void*>(context.context.uc_mcontext.pc); +#elif defined(__riscv) + context.siginfo.si_addr = + reinterpret_cast<void*>(context.context.uc_mcontext.__gregs[REG_PC]); #else -#error "This code has not been ported to your platform yet." +# error "This code has not been ported to your platform yet." #endif return GenerateDump(&context); |