From: Peter Crozier Date: Wed, 13 May 2020 12:09:08 +0000 (+0100) Subject: Extend YS_DEBUGTRAP to MacOS. X-Git-Tag: working-ls180~546^2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3988f935b8715ddeffc994472c146e62448c8749;p=yosys.git Extend YS_DEBUGTRAP to MacOS. --- diff --git a/kernel/log.h b/kernel/log.h index dee5d44d7..4b60ffb0d 100644 --- a/kernel/log.h +++ b/kernel/log.h @@ -86,7 +86,7 @@ YOSYS_NAMESPACE_BEGIN # endif # if __has_builtin(__builtin_debugtrap) # define YS_DEBUGTRAP __builtin_debugtrap() -# elif defined(__unix__) +# elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) # define YS_DEBUGTRAP raise(SIGTRAP) # else # define YS_DEBUGTRAP do {} while(0) @@ -103,6 +103,9 @@ YOSYS_NAMESPACE_BEGIN # define YS_DEBUGTRAP_IF_DEBUGGING do { \ sighandler_t old = signal(SIGTRAP, SIG_IGN); raise(SIGTRAP); signal(SIGTRAP, old); \ } while(0) +#elif defined(__APPLE__) && defined(__MACH__) +// MacOS +#define YS_DEBUGTRAP_IF_DEBUGGING { sig_t old = signal(SIGTRAP, SIG_IGN); raise(SIGTRAP); signal(SIGTRAP, old); } #else # define YS_DEBUGTRAP_IF_DEBUGGING do {} while(0) #endif