return str;
}
-const char *CrashReasonAsString(CrashReason reason) {
- const char *str = nullptr;
-
- switch (reason) {
- case CrashReason::eInvalidCrashReason:
- str = "eInvalidCrashReason";
- break;
-
- // SIGSEGV crash reasons.
- case CrashReason::eInvalidAddress:
- str = "eInvalidAddress";
- break;
- case CrashReason::ePrivilegedAddress:
- str = "ePrivilegedAddress";
- break;
- case CrashReason::eBoundViolation:
- str = "eBoundViolation";
- break;
- case CrashReason::eAsyncTagCheckFault:
- str = "eAsyncTagCheckFault";
- break;
- case CrashReason::eSyncTagCheckFault:
- str = "eSyncTagCheckFault";
- break;
-
- // SIGILL crash reasons.
- case CrashReason::eIllegalOpcode:
- str = "eIllegalOpcode";
- break;
- case CrashReason::eIllegalOperand:
- str = "eIllegalOperand";
- break;
- case CrashReason::eIllegalAddressingMode:
- str = "eIllegalAddressingMode";
- break;
- case CrashReason::eIllegalTrap:
- str = "eIllegalTrap";
- break;
- case CrashReason::ePrivilegedOpcode:
- str = "ePrivilegedOpcode";
- break;
- case CrashReason::ePrivilegedRegister:
- str = "ePrivilegedRegister";
- break;
- case CrashReason::eCoprocessorError:
- str = "eCoprocessorError";
- break;
- case CrashReason::eInternalStackError:
- str = "eInternalStackError";
- break;
-
- // SIGBUS crash reasons:
- case CrashReason::eIllegalAlignment:
- str = "eIllegalAlignment";
- break;
- case CrashReason::eIllegalAddress:
- str = "eIllegalAddress";
- break;
- case CrashReason::eHardwareError:
- str = "eHardwareError";
- break;
-
- // SIGFPE crash reasons:
- case CrashReason::eIntegerDivideByZero:
- str = "eIntegerDivideByZero";
- break;
- case CrashReason::eIntegerOverflow:
- str = "eIntegerOverflow";
- break;
- case CrashReason::eFloatDivideByZero:
- str = "eFloatDivideByZero";
- break;
- case CrashReason::eFloatOverflow:
- str = "eFloatOverflow";
- break;
- case CrashReason::eFloatUnderflow:
- str = "eFloatUnderflow";
- break;
- case CrashReason::eFloatInexactResult:
- str = "eFloatInexactResult";
- break;
- case CrashReason::eFloatInvalidOperation:
- str = "eFloatInvalidOperation";
- break;
- case CrashReason::eFloatSubscriptRange:
- str = "eFloatSubscriptRange";
- break;
- }
- return str;
-}
-
CrashReason GetCrashReason(const siginfo_t &info) {
switch (info.si_signo) {
case SIGSEGV: