diff --git a/M2/Macaulay2/bin/main.cpp b/M2/Macaulay2/bin/main.cpp index 41b3c392c9..fa4c8540cf 100644 --- a/M2/Macaulay2/bin/main.cpp +++ b/M2/Macaulay2/bin/main.cpp @@ -23,6 +23,7 @@ #include #include #include +#include // for flint_set_abort /* ######################################################################### */ @@ -54,6 +55,7 @@ bool interrupts_interruptShield; void* interpFunc(ArgCell* vargs); void* profFunc(ArgCell* p); void* testFunc(ArgCell* p); +void M2_flint_abort(void); static void * GC_start_performance_measurement_0(void *) { #ifdef GC_start_performance_measurement /* added in bdwgc 8 */ @@ -90,6 +92,8 @@ int main(/* const */ int argc, /* const */ char *argv[], /* const */ char *env[] signal(SIGPIPE,SIG_IGN); /* ignore the broken pipe signal */ + flint_set_abort(M2_flint_abort); + static struct ArgCell* M2_vargs; M2_vargs = (ArgCell*) GC_MALLOC_UNCOLLECTABLE(sizeof(struct ArgCell)); M2_vargs->argv = argv; /* argument vector */ @@ -134,6 +138,11 @@ void stack_trace(std::ostream &stream, bool M2) { } } +void M2_flint_abort(void) { + stack_trace(std::cerr, false); + abort(); +} + extern "C" { void M2_stack_trace() { stack_trace(std::cout, false); } #if PROFILING