Chillout is a simple cross-platform crash handling library.
This library can be used on Windows, OS X and Linux to catch various unhandled exceptions (access violation, signals, alloc errors etc.), generate backtraces for logs and possibly crash dump (the latter currently only for Windows).
The API is very simple - you provide your callbacks for crash and/or backtracing. Chillout makes sure your handlers will be executed in the event of a crash.
auto &chillout = Debug::Chillout::getInstance();
// install various crash handlers
chillout.init("my_app_name", "/path/to/crash/or/backtraces/dir");
chillout.setBacktraceCallback([](const char * const stackEntry) {
fprintf(stderr, "my trace: %s", stackEntry);
});
chillout.setCrashCallback([&chillout]() {
chillout.backtrace();
chillout.createCrashDump();
});
Yes, Breakpad Crashpad exists, but sometimes it is too big or too complicated to setup (e.g. for small project). This library is definitely less reliable and featured than age-tested Breakpad/Crashpad, but it is simple, small and covered by tests.
- Linux/Mac - no core dumps and any other type of crash dumps
- stacktrace only of the thread which crashed
This project won't be possible without:
- CrashRpt - most full collection of information about Windows crash handlers
- DeathHandler - ideas to preallocate buffer in case of broken heap on 'nix systems
- gist by @fmela - idea to use
dladdr()
instead of parsing raw/mangled line myself - stacktrace in Chromium - just useful information how demangling works in Chromium