Skip to content

CrashCatch

๐Ÿ’ฅ A modern, single-header crash reporting library for C++ on Windows and Linux.

License: MIT Header-only Platform

C++17 CI

---

๐Ÿš€ What is CrashCatch?

CrashCatch is a modern, single-header crash reporting library for C++ applications โ€” supporting both Windows and Linux.

It automatically captures crashes, logs diagnostic information, generates .dmp (Windows) or .txt (Windows & Linux) reports, and includes stack traces and environment metadata. From minimal CLI tools to full desktop apps, CrashCatch fits right in.

Key highlights: - No external dependencies โ€” just include the header - Full crash context (timestamp, platform, executable path, version, etc.) - Symbol resolution and demangling (platform-specific) - Configurable onCrash() and onCrashUpload() hooks - Optional crash dialog support (Windows GUI apps)

As of v1.2.0, CrashCatch offers complete Linux support with signal handling, demangled stack traces, and crash context generation.


โœ… Supported Platforms

OS Supported Crash Handling Method
Windows โœ… Yes SetUnhandledExceptionFilter + MiniDump
Linux โœ… Yes POSIX signals (signal()) + backtrace
macOS ๐Ÿšง Planned POSIX + Mach exceptions

โšก Quick Start

Zero Config (Auto-init)

#define CRASHCATCH_AUTO_INIT
#include "CrashCatch.hpp"

int main() {
    int* ptr = nullptr;
    *ptr = 42; // simulated crash
}

One-Liner Setup

#include "CrashCatch.hpp"

int main() {
    CrashCatch::enable();
    int* ptr = nullptr;
    *ptr = 42;
}

Full Config Example

#include "CrashCatch.hpp"

int main() {
    CrashCatch::Config config;
    config.appVersion = "1.1.0";
    config.buildConfig = "Release";
    config.additionalNotes = "Test build";
    config.showCrashDialog = true;
    config.onCrash = [] {
        std::cout << "Cleaning up before crash...\n";
    };

    CrashCatch::initialize(config);

    int* ptr = nullptr;
    *ptr = 42;
}

๐Ÿ“ฆ Installing with CMake

mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=./install
cmake --build . --target install

Then in another project:

find_package(CrashCatch REQUIRED)
target_link_libraries(MyApp PRIVATE CrashCatch::CrashCatch)

๐Ÿงช Examples

Explore working examples in the GitHub repo: - ZeroConfig - OneLiner - FullConfig - ThreadCrash - DivideByZero

View Examples Folder


๐Ÿ“ธ Screenshots

ZeroConfig OneLiner FullConfig CrashDialog


๐Ÿ›  Features

  • โœ… Header-only โ€” single .hpp, no external dependencies
  • โœ… Cross-platform โ€” Windows & Linux support out of the box
  • โœ… Automatic Crash Capture โ€” via SetUnhandledExceptionFilter (Windows) or POSIX signals (Linux)
  • โœ… Crash Context Info โ€” includes executable path, build config, version, and notes
  • โœ… Crash Reporting:
  • .dmp (Windows) or .txt (Linux/Windows) crash files
  • Detailed stack traces and environment info
  • โœ… Symbol Resolution:
  • Top frame symbols (Windows)
  • Demangled symbols (Linux)
  • โœ… onCrash Callback โ€” run custom cleanup or logging logic with full crash context
  • โœ… Optional Crash Dialog โ€” user-friendly message box (Windows only)
  • โœ… Configurable Dump Location, filename prefix, and timestamping
  • โœ… onCrashUpload Hook โ€” pass report data to your custom uploader
  • โœ… CMake + CI Friendly โ€” drop-in installation and build support

๐Ÿ“„ License

MIT License โ€” created and maintained by Keith Pottratz
GitHub Repo

Created by Keith Pottratz
MIT Licensed