We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An "assert with stacktrace" macro could be useful for times when debugging with GDB just isn't practical.
Here is one such possibility (may need tweaking) adapted from https://stackoverflow.com/questions/37473/how-can-i-assert-without-using-abort
#include <execinfo.h> void print_stack_trace(int fd) { void *array[256]; size_t size; size = backtrace (array, 256); backtrace_symbols_fd(array, size, fd); } #define ASSERT_STACKTRACE(expr) do { \ if (!(expr)) \ { \ fprintf(stderr, \ "file %s: line %d (%s): precondition `%s' failed.", \ __FILE__, \ __LINE__, \ __PRETTY_FUNCTION__, \ #expr); \ print_stack_trace(2); \ assert(expr); \ }; } while(0)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
An "assert with stacktrace" macro could be useful for times when debugging with GDB just isn't practical.
Here is one such possibility (may need tweaking) adapted from https://stackoverflow.com/questions/37473/how-can-i-assert-without-using-abort
The text was updated successfully, but these errors were encountered: