From 6ba6cb9cf0a5eb73b06d3876c363b472de1d5809 Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Sun, 7 Sep 2025 11:45:54 -0400 Subject: [PATCH] Mrntt: Add ability to listen for SIGSEGV But don't actually use it because it makes it difficult to exit SMO from the cmdline. --- smocore/marionette/marionette.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/smocore/marionette/marionette.cpp b/smocore/marionette/marionette.cpp index a2a9872..9d6904f 100644 --- a/smocore/marionette/marionette.cpp +++ b/smocore/marionette/marionette.cpp @@ -49,12 +49,22 @@ void ComponentThread::marionetteMain(ComponentThread& self) bool callFinalizeReq = false; try { - // Register SIGINT (Ctrl+C) handler to request user shutdown + // Register SIGINT (Ctrl+C) and SIGSEGV handlers signals.async_wait( - [&self](const boost::system::error_code& ec, int /*signal*/) + [&self](const boost::system::error_code& ec, int signal) { if (ec) { return; } - // Post user shutdown indication + + switch (signal) { + case SIGINT: + std::cerr << "SIGINT (Ctrl+C) received. Initiating shutdown..." << std::endl; + break; + case SIGSEGV: + std::cerr << "FATAL: Segmentation fault detected. Initiating shutdown..." << std::endl; + break; + default: + break; + } self.userShutdownInd(); } );