diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-27 13:22:49 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-05-27 13:22:49 +0200 |
| commit | d12204e7302b8f3bd521c782094338733abfded1 (patch) | |
| tree | 708549c25f71e56b30b4223750adb0c317896fde /dev/LibCompiler/Util | |
| parent | 38f86a6646bd59dc746067caaaa9f933fa9707d4 (diff) | |
feat!: better crash reporting.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/LibCompiler/Util')
| -rw-r--r-- | dev/LibCompiler/Util/LCClUtils.h | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/dev/LibCompiler/Util/LCClUtils.h b/dev/LibCompiler/Util/LCClUtils.h index c88339d..8e7c4d7 100644 --- a/dev/LibCompiler/Util/LCClUtils.h +++ b/dev/LibCompiler/Util/LCClUtils.h @@ -9,6 +9,7 @@ #include <LibCompiler/CodeGen.h> #include <LibCompiler/ErrorID.h> #include <LibCompiler/Frontend.h> +#include <LibCompiler/Version.h> #include <Vendor/Dialogs.h> #define kZero64Section ".zero64" @@ -51,18 +52,59 @@ inline void print_warning(std::string reason, std::string file) noexcept { /// @internal /// @brief Handler for SIGSEGV signal. -inline void drv_segfault_handler(std::int32_t id) { +inline void drvi_crash_handler(std::int32_t id) { + LibCompiler::STLString verbose_header = "LIBCOMPILER CRASH REPORT - "; + verbose_header += kDistVersion; + verbose_header += " - "; + verbose_header += LibCompiler::current_date(); + + for (auto& ch : verbose_header) { + std::cout << '='; + } + + std::cout << std::endl; + + std::cout << verbose_header << std::endl; + + for (auto& ch : verbose_header) { + std::cout << '='; + } + + std::cout << std::endl; + + kStdOut << "DATE: " << LibCompiler::current_date() << std::endl; + kStdOut << "VERSION: " << kDistVersion << std::endl; + kStdOut << "ERRNO: " << errno << std::endl; + kStdOut << "ERRNO(STRING): " << strerror(errno) << std::endl; + + switch (id) { case SIGSEGV: { - kStdErr << "SIGSEGV: Please report this on the GitHub issues page." << kBlank << std::endl; + kStdOut << "SIGSEGV: Segmentation Fault." << kBlank << std::endl; break; } case SIGABRT: { - kStdErr << "SIGABRT: Please report this on the GitHub issues page." << kBlank << std::endl; + kStdOut << "SIGABRT: Aborted." << kBlank << std::endl; break; } } + std::cout << kWhite; + + for (auto& ch : verbose_header) { + std::cout << '='; + } + + std::cout << std::endl; + + std::cout << verbose_header << std::endl; + + for (auto& ch : verbose_header) { + std::cout << '='; + } + + std::cout << std::endl; + std::exit(LIBCOMPILER_EXEC_ERROR); } } // namespace Detail |
