Crashlog: Unix: Decode REG_ERR for SIGSEGV

This commit is contained in:
Jonathan G Rennison
2023-08-14 11:23:48 +01:00
parent cb0c8d5e38
commit 79509b76a6

View File

@@ -337,8 +337,23 @@ class CrashLogUnix : public CrashLog {
this->signal_instruction_ptr);
}
}
#if defined(WITH_UCONTEXT) && (defined(__x86_64__) || defined(__i386))
if (this->signal_instruction_ptr_valid && this->signum == SIGSEGV) {
auto err = static_cast<ucontext_t *>(this->context)->uc_mcontext.gregs[REG_ERR];
buffer += seprintf(buffer, last,
" REG_ERR: %s%s%s%s%s\n",
(err & 1) ? "protection fault" : "no page",
(err & 2) ? ", write" : ", read",
(err & 4) ? "" : ", kernel",
(err & 8) ? ", reserved bit" : "",
(err & 16) ? ", instruction fetch" : ""
);
}
#endif
#endif /* defined(WITH_UCONTEXT) && (defined(__x86_64__) || defined(__i386)) */
}
#endif /* WITH_SIGACTION */
this->CrashLogFaultSectionCheckpoint(buffer);
buffer += seprintf(buffer, last,
" Message: %s\n\n",