From 1678b37aa063469f73ce1d6ea41dd1930e353ea0 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Tue, 10 Mar 2020 14:06:06 +0300 Subject: [PATCH] Use TRAP on segfault with debugger (Linux) --- Utilities/Thread.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index c634635f3a..8d840f8ce9 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1749,8 +1749,14 @@ static void signal_handler(int sig, siginfo_t* info, void* uct) noexcept fmt::append(msg, "Thread id = %s.\n", std::this_thread::get_id()); - // TODO (debugger interaction) sys_log.fatal("\n%s", msg); + std::fprintf(stderr, "%s\n", msg.c_str()); + + if (IsDebuggerPresent()) + { + __asm("int3;"); + } + report_fatal_error(msg); }