From cb0c8d5e3857f9118223ba297759b8a410b0eb66 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 14 Aug 2023 11:07:11 +0100 Subject: [PATCH] Crashlog: Unix: Decode common si_code values for SIGSEGV --- src/os/unix/crashlog_unix.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/os/unix/crashlog_unix.cpp b/src/os/unix/crashlog_unix.cpp index bdbf44a6ab..ea63357c71 100644 --- a/src/os/unix/crashlog_unix.cpp +++ b/src/os/unix/crashlog_unix.cpp @@ -312,8 +312,21 @@ class CrashLogUnix : public CrashLog { #ifdef WITH_SIGACTION if (this->si) { buffer += seprintf(buffer, last, - " si_code: %d\n", + " si_code: %d", this->si->si_code); + if (this->signum == SIGSEGV) { + switch (this->si->si_code) { + case SEGV_MAPERR: + buffer += seprintf(buffer, last, " (SEGV_MAPERR)"); + break; + case SEGV_ACCERR: + buffer += seprintf(buffer, last, " (SEGV_ACCERR)"); + break; + default: + break; + } + } + buffer += seprintf(buffer, last, "\n"); if (this->signum != SIGABRT) { buffer += seprintf(buffer, last, " Fault address: %p\n",