From 2fd6271bdc6c2382194cf79dd67a9482d152e94e Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 20 May 2025 15:53:46 +0200 Subject: feat(cxxdrv): Improving and patching C++'s driver segfault at exit. Signed-off-by: Amlal El Mahrouss --- dev/LibCompiler/Detail/ClUtils.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'dev/LibCompiler/Detail') diff --git a/dev/LibCompiler/Detail/ClUtils.h b/dev/LibCompiler/Detail/ClUtils.h index a809cdf..5277a6b 100644 --- a/dev/LibCompiler/Detail/ClUtils.h +++ b/dev/LibCompiler/Detail/ClUtils.h @@ -50,8 +50,22 @@ inline void print_warning(std::string reason, std::string file) noexcept { } /// @internal -inline void segfault_handler(std::int32_t _) { - pfd::notify("LibCompiler", "Driver just crashed, please report this on the GitHub issues page."); +/// @brief Handler for SIGSEGV signal. +inline void drv_segfault_handler(std::int32_t id) { + switch (id) { + case SIGSEGV: { + kStdErr << kRed << "drv: " << kWhite + << "Segmentation fault. Please report this on the GitHub issues page." << kBlank + << std::endl; + break; + } + case SIGABRT: { + kStdErr << kRed << "drv: " << kWhite + << "Aborted. Please report this on the GitHub issues page." << kBlank << std::endl; + break; + } + } + std::exit(LIBCOMPILER_EXEC_ERROR); } } // namespace Detail -- cgit v1.2.3