aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/log.h
diff options
context:
space:
mode:
authorPeter Crozier <peter@crozier.com>2020-05-13 14:17:00 +0100
committerPeter Crozier <peter@crozier.com>2020-05-13 14:17:00 +0100
commit495dcfc812be0f990bee20fc1ac819c72b8b7e47 (patch)
tree00598bf2996d128e374e3d4a814a540aa68b76c4 /kernel/log.h
parent3988f935b8715ddeffc994472c146e62448c8749 (diff)
downloadyosys-495dcfc812be0f990bee20fc1ac819c72b8b7e47.tar.gz
yosys-495dcfc812be0f990bee20fc1ac819c72b8b7e47.tar.bz2
yosys-495dcfc812be0f990bee20fc1ac819c72b8b7e47.zip
Consolidate Linux and Mac version of YS_DEBUGTRAP_IF_DEBUGGING.
Diffstat (limited to 'kernel/log.h')
-rw-r--r--kernel/log.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/kernel/log.h b/kernel/log.h
index 4b60ffb0d..6c5de78d7 100644
--- a/kernel/log.h
+++ b/kernel/log.h
@@ -97,15 +97,12 @@ YOSYS_NAMESPACE_BEGIN
// if a debugger is attached, and does nothing otherwise.
#if defined(_WIN32)
# define YS_DEBUGTRAP_IF_DEBUGGING do { if (IsDebuggerPresent()) DebugBreak(); } while(0)
-#elif defined(__unix__)
+# elif defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
// There is no reliable (or portable) *nix equivalent of IsDebuggerPresent(). However,
// debuggers will stop when SIGTRAP is raised, even if the action is set to ignore.
# define YS_DEBUGTRAP_IF_DEBUGGING do { \
- sighandler_t old = signal(SIGTRAP, SIG_IGN); raise(SIGTRAP); signal(SIGTRAP, old); \
+ auto 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