aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorMerry <[email protected]>2022-12-31 14:56:51 +0000
committerMerry <[email protected]>2022-12-31 14:56:51 +0000
commitc3312a1497e4969033c9f24030d05626a7637b67 (patch)
treef23b5371a256745a15f8af8d6cffc9a8f0778b8a /tests
parent3bdfbdb79394a5cbab9e62349a24cd330b1ea430 (diff)
downloaddynarmic-c3312a1497e4969033c9f24030d05626a7637b67.tar.gz
dynarmic-c3312a1497e4969033c9f24030d05626a7637b67.zip
test_generator: Assist with debugging fastmem on arm64 macOS
Diffstat (limited to 'tests')
-rw-r--r--tests/test_generator.cpp12
1 files changed, 12 insertions, 0 deletions
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 <vector>
#include <mcl/bit/swap.hpp>
+#include <mcl/macro/architecture.hpp>
#include <mcl/stdint.hpp>
#include "./A32/testenv.h"
@@ -39,6 +40,12 @@
#include <fmt/format.h>
#include <fmt/ostream.h>
+#if defined(__APPLE__) && defined(MCL_ARCHITECTURE_ARM64)
+# include <mach/mach_init.h>
+# include <mach/mach_port.h>
+# include <mach/task.h>
+#endif
+
constexpr bool mask_fpsr_cum_bits = true;
namespace {
@@ -660,6 +667,11 @@ static std::optional<size_t> 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: {} <thumb|arm|a64> <seed> <instruction_count> <iteration_count>\n", argv[0]);
}