diff options
author | N. Engelhardt <nak@symbioticeda.com> | 2020-05-20 10:12:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-20 10:12:24 +0200 |
commit | 026fed31356faa5a1b21a6270dd5cf0c745bb76e (patch) | |
tree | cfbefb8621b6d012531f205f8e6c6f806c4500c4 /kernel | |
parent | 7c4e580f8f9b5f441f3af5454e68cba38eb52e91 (diff) | |
parent | 495dcfc812be0f990bee20fc1ac819c72b8b7e47 (diff) | |
download | yosys-026fed31356faa5a1b21a6270dd5cf0c745bb76e.tar.gz yosys-026fed31356faa5a1b21a6270dd5cf0c745bb76e.tar.bz2 yosys-026fed31356faa5a1b21a6270dd5cf0c745bb76e.zip |
Merge pull request #2046 from PeterCrozier/trap
Extend YS_DEBUGTRAP to MacOS.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/log.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/log.h b/kernel/log.h index dee5d44d7..6c5de78d7 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) @@ -97,11 +97,11 @@ 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) #else # define YS_DEBUGTRAP_IF_DEBUGGING do {} while(0) |