Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Catch C/C++ program errors and print a stack trace before exiting

License

NotificationsYou must be signed in to change notification settings

dermojo/ooopsi

Repository files navigation

Travis-CI statusAppVeyor statuscodecov

This library installs C/C++ and OS hooks and handlers for events that would crash your program.Instead of silently printing a message before terminating or sending a bug report to your OS vendor,it allows to log a backtrace of the program's current stack and the reason why it terminates.

libooopsi currently catches:

  • unhandled C++ exceptions (leading tostd::terminate)
  • segmentation faults
  • stack overflows
  • illegal instructions
  • floating-point errors (e.g. division by zero)
  • std::abort
  • ...

Where does it log?

By default, the stack trace is logged to STDERR. To override this behavior, useooopsi::setAbortLogFunc() in your program to set a custom logging function. This function willbe called line-wise for every line in the stack trace, followed by a call with anullptrargument to indicate the end (to allow flushing etc.).

Please be aware that the log function will potentially be called from a signal handler, whichshould do only very restrictive things. Make sure to read up onman signal-safety (for Linux)before customizing log function.

Dependencies and supported platforms

The library needs a C++11 compiler and supports Linux and Windows, both in 64 bit only.

To build the library, you needlibunwind-dev on Linux andimagehlp on Windows as wellas CMake. The unit tests require GoogleTest, which is used as a git submodule.

How do I include it in my program?

It's sufficient to simply link the shared library against your program. No adaptations arerequired. On Linux, it's also possible to useLD_PRELOAD to "inject" the library withouthaving to modify the program at all.

Where does the name come from?

It's an acronym for:

  • Out
  • Of
  • Options
  • Print
  • Stack
  • Information

Because that's all we can do then ;-)

License

This project is licensed under the MIT License - see theLICENSE file for details.

tl;dr: Feel free to use and modify the code or to include it in your commercial application.

About

Catch C/C++ program errors and print a stack trace before exiting

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp