From ee4acb6ae6e32a02bc012d197aa82b1ca7a493ab Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Wed, 1 Jul 2020 08:36:23 -0700 Subject: [PATCH] Fix for macOS on ARM Also update the single include header to match. (cherry picked from commit bad3c930493d08dd7cca2af57cf355d9b7cddb21) --- include/internal/catch_debugger.h | 6 ++++-- single_include/catch.hpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/internal/catch_debugger.h b/include/internal/catch_debugger.h index 65361c2..a9ef91b 100644 --- a/include/internal/catch_debugger.h +++ b/include/internal/catch_debugger.h @@ -27,8 +27,10 @@ namespace Catch{ #define CATCH_TRAP() \ __asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \ : : : "memory","r0","r3","r4" ) /* NOLINT */ - #else - #define CATCH_TRAP() __asm__("int $3\n" : : /* NOLINT */ ) + #elif defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") #endif #elif defined(CATCH_PLATFORM_LINUX) diff --git a/single_include/catch.hpp b/single_include/catch.hpp index fdb046f..169962a 100644 --- a/single_include/catch.hpp +++ b/single_include/catch.hpp @@ -2129,8 +2129,10 @@ namespace Catch{ #define CATCH_TRAP() \ __asm__("li r0, 20\nsc\nnop\nli r0, 37\nli r4, 2\nsc\nnop\n" \ : : : "memory","r0","r3","r4" ) /* NOLINT */ - #else - #define CATCH_TRAP() __asm__("int $3\n" : : /* NOLINT */ ) + #elif defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") #endif #elif defined(CATCH_PLATFORM_LINUX)