From c3312a1497e4969033c9f24030d05626a7637b67 Mon Sep 17 00:00:00 2001 From: Merry Date: Sat, 31 Dec 2022 14:56:51 +0000 Subject: [PATCH] test_generator: Assist with debugging fastmem on arm64 macOS --- tests/test_generator.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_generator.cpp b/tests/test_generator.cpp index 58d5c088..d995d831 100644 --- a/tests/test_generator.cpp +++ b/tests/test_generator.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include "./A32/testenv.h" @@ -39,6 +40,12 @@ #include #include +#if defined(__APPLE__) && defined(MCL_ARCHITECTURE_ARM64) +# include +# include +# include +#endif + constexpr bool mask_fpsr_cum_bits = true; namespace { @@ -660,6 +667,11 @@ static std::optional str2sz(char const* s) { } int main(int argc, char* argv[]) { +#if defined(__APPLE__) && defined(MCL_ARCHITECTURE_ARM64) + // Allows for attaching a debugger to this process to work when debugging fastmem (since we currently use POSIX signals rather than a mach socket on arm64). + task_set_exception_ports(mach_task_self(), EXC_MASK_BAD_ACCESS, MACH_PORT_NULL, EXCEPTION_DEFAULT, 0); +#endif + if (argc != 5) { fmt::print("Usage: {} \n", argv[0]); }