From 268050246544ce1dba02f11a6a827d697e4e9b03 Mon Sep 17 00:00:00 2001 From: Emily Boudreaux Date: Wed, 19 Mar 2025 13:48:26 -0400 Subject: [PATCH] feat(macros): added BREAKPOINT() macro to set a breakpoint in code --- src/resources/macros/debug.h | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/resources/macros/debug.h diff --git a/src/resources/macros/debug.h b/src/resources/macros/debug.h new file mode 100644 index 0000000..b0f7d5b --- /dev/null +++ b/src/resources/macros/debug.h @@ -0,0 +1,11 @@ +#ifdef __GNUC__ // GCC and Clang + #define BREAKPOINT() __builtin_debugtrap() +#elif defined(_MSC_VER) // MSVC + #define BREAKPOINT() __debugbreak() +#elif defined(__APPLE__) && defined(__MACH__) // macOS with Clang and LLDB + #include + #define BREAKPOINT() raise(SIGTRAP) +#else + #include + #define BREAKPOINT() std::raise(SIGTRAP) +#endif