-
-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
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
Segfault in unwind #422
Comments
I got stacktraces working with doctest by defining the main as follows: #define DOCTEST_CONFIG_NO_EXCEPTIONS
#define DOCTEST_CONFIG_NO_POSIX_SIGNALS
#define DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS
#define DOCTEST_CONFIG_IMPLEMENT
#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS
#include "doctest.h"
#include <lfortran/config.h>
#include <lfortran/stacktrace.h>
int main(int argc, char** argv)
{
#if defined(HAVE_LFORTRAN_STACKTRACE)
LFortran::print_stack_on_segfault();
#endif
return doctest::Context(argc, argv).run();
} And the test files look like: #define DOCTEST_CONFIG_NO_EXCEPTIONS
#define DOCTEST_CONFIG_NO_POSIX_SIGNALS
#define DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS
#define DOCTEST_CONFIG_SUPER_FAST_ASSERTS
#include <tests/doctest.h>
#define DOCTEST_CHECK_THROWS_AS(x, y)
#define DOCTEST_CHECK_THROWS_WITH(x, y)
... Then if the tests throw an exception, it looks like this:
One disadvantage of this approach is that I have to define my own So I think doctest itself works, and I am going to close this issue. Unfortunately, when the above is used with LLVM that segfaults / throws an exception, the above test program simply hangs. So there is still some problem, but it could be an interaction of LLVM, doctest and my stacktrace framework, and so it needs further debugging to figure out where the problem is. |
First of all, thank you for this excellent library. I have been using it for a few years and I have been very happy.
I collect stacktraces when exceptions are thrown. When executed inside a test with doctest, the following line will segfault:
_Unwind_Backtrace(unwind_callback, &d);
Here is the full stack when ran under
gdb
:I tried compiling
doctest
with:But it still happens.
When the
_Unwind_Backtrace
is called outside ofdoctest
then everything works.I would think this would happen when the stack is somehow corrupted. Any idea where I should look inside
doctest
?The text was updated successfully, but these errors were encountered: