mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Apple platforms now use the same SIGSEGV/SIGBUS handler as Linux instead of a Mach exception port. The Mach port was only set on the installing thread, which is the loader thread, not the one running JIT code. ARM64 had no context definition at all. Also pass the thread state (not the mcontext) to the handler, accept SIGBUS fault codes, and fix restoring a disabled altstack on Darwin. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
29 lines
1.3 KiB
C++
29 lines
1.3 KiB
C++
// Copyright 2008 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
// On Windows, context is a CONTEXT object.
|
|
// On Apple, context is the thread state from the signal context (x86_thread_state64_t or arm_thread_state64_t).
|
|
// On Unix/Linux, context is a mcontext_t.
|
|
// On OpenBSD, context is a ucontext_t.
|
|
// Ugh, might need to abstract this better.
|
|
typedef bool (*BadAccessHandler)(uintptr_t address, void *context);
|
|
|
|
// logStackTraceOnCrash: if true, log a best-effort stack trace (via dbghelp on Windows)
|
|
// when a genuinely unhandled access violation is about to crash the process. Off by
|
|
// default since it links dbghelp and walks the stack from inside the exception handler -
|
|
// opt in only when you're chasing a native crash.
|
|
void InstallExceptionHandler(BadAccessHandler accessHandler, bool logStackTraceOnCrash = false);
|
|
|
|
// Implementation note: This must be a no-op if InstallExceptionHandler hasn't been called.
|
|
void UninstallExceptionHandler();
|
|
|
|
// MSVC-only, no-op elsewhere. Turns on the debug CRT's leak checking, and with suppressDialogs
|
|
// set, routes CRT assertions and abort() to stderr instead of a modal dialog - required for
|
|
// anything run non-interactively (headless, the unit tests, CI), where a dialog just hangs.
|
|
void SetupCRT(bool suppressDialogs);
|