TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 229 subscribers
Post #24676 17
fault: a lightweight C++20 crash handler and panic library with signal-safe trace logging and visual popups.

Hello! I've been developing a lightweight tool to detect, alert, and log whenever a fatal condition has occurred. I'm sharing it here today in case it's useful for your own projects.

I started this as a utility for my own project because I wanted two things:
- Visibility Alert users with a fatal popup/dialog instead of silent crashes
- Reliability Be able to reliably save unresolved traces that can then be resolved later given original debug files.

I wanted this without adding heavy dependencies or injections.

fault is a Linux and Windows library for C and C++ users, implemented in C++20. Key features:

- Broad coverage Handles POSIX signals, Windows SEH exceptions, std::terminate, as well as having explicit panic and panic-based assertions
- Signal-safe by default: Prioritizes logging unresolved, safe traces within POSIX signal handlers. Safe trace cannot be written? If the user permits, fault will perform a best-effort attempt to do a regular trace while imposing safeguards against deadlocks and recursive signals.
- Concurrency Resilient: If multiple threads trigger a fatal condition simultaneously, fault ensures only the first one enters the mechanism. It prevents the system from shutting down prematurely during the microseconds needed to log and display the report or popup.
- Panic and Modern C++ assertions, backed with fault unified handling. Includes FAULT_ASSERT, fault::panic, fault::expect, with support for customizable strings, formatted arguments, and deferred callables. Wether debug only or also release, and wether you'll want source location or not, there's an equivalent expression present.
- Cpptrace integration: Whereas hidden by default, if you use cpptrace, fault can automatically log propagated traces from exceptions and saved requested traces whenever a panic or std::terminate trigger.

Additional Utilities:

- Explicit shutdown request API (atomics-backed).
- Automated optional handling for SIGINT / SIGTERM
- A Python script to resolve traces using addr2line

Link to repo: GitHub

fault is a work in progress (v0.1.2), and new features may happen in the coming weeks. Feedback is appreciated.

https://redd.it/1qbyaca
@r_cpp
GitHub GitHub - Ridrik/fault: fault is a lightweight crash reporting and panic library for C and C++, implemented in C++20. It provides… fault is a lightweight crash reporting and panic library for C and C++, implemented in C++20. It provides a unified interface for alerting users, saving fault context and trace information when thi...
More from @r_cpp
  1. Oct 8, 2026Profiles for simplicity and guarantees - Bjarne Stroustrup - CppCon 2026 https://youtu.be/…
  2. Oct 8, 2026How to Fix autoconf-style Configuration Probing https://build2.org/blog/fix-autoconf.xhtml…
  3. Oct 8, 2026owl – a header-only C++23 HTTP framework where route patterns and handler extractors are c…
  4. Oct 8, 2026Removed by Reddit Removed by Reddit on account of violating the [content policy. ] https:/…
  5. Oct 8, 2026Is there a way to search across all P and N papers throughout standardization history? It…
  6. Oct 8, 2026CppCast Episode 412 : Safety and Interoperability with Rust and C++ https://cppcast.com/sa…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →