diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-20 15:53:46 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-20 15:55:09 +0200 |
| commit | 2fd6271bdc6c2382194cf79dd67a9482d152e94e (patch) | |
| tree | ce2763cdcbb154b03e631040930e67e9c4e3ac59 /dev/LibCompiler/Detail | |
| parent | 13ea83fa23ed118e7310b641d2895b830b2267ac (diff) | |
feat(cxxdrv): Improving and patching C++'s driver segfault at exit.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/LibCompiler/Detail')
| -rw-r--r-- | dev/LibCompiler/Detail/ClUtils.h | 18 |
1 files changed, 16 insertions, 2 deletions
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 |
