From e40318e8104b992a9b42f71eeb7b27a36b675c93 Mon Sep 17 00:00:00 2001 From: Amlal Date: Sat, 26 Apr 2025 14:55:49 +0200 Subject: dev, cxxdrv: add sigsegv handler. Signed-off-by: Amlal --- dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'dev/LibCompiler/src') diff --git a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc index e58e4f6..6a7f261 100644 --- a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc +++ b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc @@ -19,7 +19,7 @@ #include #include #include - +#include #include #include @@ -50,6 +50,12 @@ ///////////////////////////////////// +/// @internal +static void cxxdrv_chaos_handler(std::int32_t _) { + pfd::notify("NeKernel C++ Compiler Driver", "CxxDrv just crashed, please report this to the developers."); + std::exit(LIBCOMPILER_EXEC_ERROR); +} + /// @internal namespace Detail { std::filesystem::path expand_home(const std::filesystem::path& p) { @@ -932,6 +938,8 @@ LIBCOMPILER_MODULE(CompilerCPlusPlusAMD64) { kFactory.Mount(new AssemblyCPlusPlusInterface()); kCompilerFrontend = new CompilerFrontendCPlusPlus(); + ::signal(SIGSEGV, cxxdrv_chaos_handler); + for (auto index = 1UL; index < argc; ++index) { if (argv[index][0] == '-') { if (skip) { -- cgit v1.2.3