mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-29 01:38:24 +00:00
signals: Fix compilation on GCC. (#934)
This commit is contained in:
parent
faea291295
commit
da1e4ff5eb
|
@ -59,7 +59,7 @@ static LONG WINAPI SignalHandler(EXCEPTION_POINTERS* pExp) noexcept {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef IS_WRITE_ERROR
|
#ifndef IS_WRITE_ERROR
|
||||||
#error "Missing IS_WRITE_ERROR() implementation for target OS and CPU architecture.
|
#error "Missing IS_WRITE_ERROR() implementation for target OS and CPU architecture."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static std::string DisassembleInstruction(void* code_address) {
|
static std::string DisassembleInstruction(void* code_address) {
|
||||||
|
@ -120,9 +120,11 @@ SignalDispatch::SignalDispatch() {
|
||||||
ASSERT_MSG(handle = AddVectoredExceptionHandler(0, SignalHandler),
|
ASSERT_MSG(handle = AddVectoredExceptionHandler(0, SignalHandler),
|
||||||
"Failed to register exception handler.");
|
"Failed to register exception handler.");
|
||||||
#else
|
#else
|
||||||
constexpr struct sigaction action {
|
struct sigaction action {};
|
||||||
.sa_flags = SA_SIGINFO | SA_ONSTACK, .sa_sigaction = SignalHandler, .sa_mask = 0,
|
action.sa_sigaction = SignalHandler;
|
||||||
};
|
action.sa_flags = SA_SIGINFO | SA_ONSTACK;
|
||||||
|
sigemptyset(&action.sa_mask);
|
||||||
|
|
||||||
ASSERT_MSG(sigaction(SIGSEGV, &action, nullptr) == 0 &&
|
ASSERT_MSG(sigaction(SIGSEGV, &action, nullptr) == 0 &&
|
||||||
sigaction(SIGBUS, &action, nullptr) == 0,
|
sigaction(SIGBUS, &action, nullptr) == 0,
|
||||||
"Failed to register access violation signal handler.");
|
"Failed to register access violation signal handler.");
|
||||||
|
@ -135,9 +137,11 @@ SignalDispatch::~SignalDispatch() {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
ASSERT_MSG(RemoveVectoredExceptionHandler(handle), "Failed to remove exception handler.");
|
ASSERT_MSG(RemoveVectoredExceptionHandler(handle), "Failed to remove exception handler.");
|
||||||
#else
|
#else
|
||||||
constexpr struct sigaction action {
|
struct sigaction action {};
|
||||||
.sa_flags = 0, .sa_handler = SIG_DFL, .sa_mask = 0,
|
action.sa_handler = SIG_DFL;
|
||||||
};
|
action.sa_flags = 0;
|
||||||
|
sigemptyset(&action.sa_mask);
|
||||||
|
|
||||||
ASSERT_MSG(sigaction(SIGSEGV, &action, nullptr) == 0 &&
|
ASSERT_MSG(sigaction(SIGSEGV, &action, nullptr) == 0 &&
|
||||||
sigaction(SIGBUS, &action, nullptr) == 0,
|
sigaction(SIGBUS, &action, nullptr) == 0,
|
||||||
"Failed to remove access violation signal handler.");
|
"Failed to remove access violation signal handler.");
|
||||||
|
|
Loading…
Reference in a new issue