Skip to content

Latest commit

 

History

History
53 lines (36 loc) · 2.72 KB

README.md

File metadata and controls

53 lines (36 loc) · 2.72 KB

chillout

Build status Build Status Codacy Badge

os windows os mac os linux

license copyright language c++

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.

Basic usage

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();
});

Disclaimer

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.

Limitations

  • Linux/Mac - no core dumps and any other type of crash dumps
  • stacktrace only of the thread which crashed

References

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