I would like to use this stacktrace method #4 implementation upon assertion failure.
So if there are no signals triggered, could you suggest a way to detect an assertion failure before the executable exits?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
On Linux, an
assertfailure (if not disabled with-DNDEBUG) is doing (from/usr/include/assert.h)and the internal
__assert_failroutine is callingabort, which sends aSIGABRTto the process, which you might catch if you really wanted to.But a simpler way is to have your own “assert”-like macro. This is what many free software (GTK with
g_assert, GCC withgcc_assert, …) are actually doing.