Get MacOS rethinkdb_backtrace, make crash_or_trap abort() #7049
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One thing to note: it's not always working. E.g. it doesn't work if we have a SIGSEGV but it does if we have guarantee(false). It probably has something to do with signal handling.
We also encountered the confusing situation in
crash_or_trapwhereraise(SIGTRAP)didn't abort the process. Maybe it is now swallowed up by MacOS. So now the crash_or_trap macro is the same as crash -- it calls abort() after the BREAKPOINT line.If you're running a debugger on some system and want to do something crazy like step forward, well, then, you can adjust the macro accordingly.
I assume the reason for this MacOS change is somehow related to how we block signals on non-main threads in thread_pool.cc. Maybe we just ignore SIGTRAP now on MacOS. It didn't trap when running in lldb either.
(I tested a simple executable that calls
raise(SIGTRAP)in a separate thread and that did interrupt the whole process. I am not going to investigate further.)