From bd8bf4edc00c6f56abb264a0ca77b3cd09abbfbd Mon Sep 17 00:00:00 2001 From: Ian MacLarty Date: Sat, 18 Mar 2006 15:57:58 +0000 Subject: [PATCH] Instead of just aborting when a "strange" segfault or bus error is Estimated hours taken: 0.5 Branches: main runtime/mercury_memory_handlers.c: Instead of just aborting when a "strange" segfault or bus error is caught, call MR_fatal_abort which will print a stack dump and display the last trace event in debugging grades. Call MR_fatal_abort instead of MR_fatal_error because the comment above MR_fatal_abort says it is safe to call from signal handlers. --- runtime/mercury_memory_handlers.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/runtime/mercury_memory_handlers.c b/runtime/mercury_memory_handlers.c index d38491e9c..1577482ec 100644 --- a/runtime/mercury_memory_handlers.c +++ b/runtime/mercury_memory_handlers.c @@ -2,7 +2,7 @@ ** vim: ts=4 sw=4 expandtab */ /* -** Copyright (C) 1998, 2000, 2002, 2005 The University of Melbourne. +** Copyright (C) 1998, 2000, 2002, 2005-2006 The University of Melbourne. ** This file may only be copied under the terms of the GNU Library General ** Public License - see the file COPYING.LIB in the Mercury distribution. */ @@ -407,9 +407,8 @@ complex_bushandler(int sig, siginfo_t *info, void *context) fflush(stdout); if (sig != SIGBUS || !info || info->si_signo != SIGBUS) { - fprintf(stderr, "\n*** Mercury runtime: "); - fprintf(stderr, "caught strange bus error ***\n"); - exit(1); + MR_fatal_abort(context, "\n*** Mercury runtime: " + "caught strange bus error ***\n", 1); } fprintf(stderr, "\n*** Mercury runtime: "); @@ -523,9 +522,8 @@ static void complex_segvhandler(int sig, siginfo_t *info, void *context) { if (sig != SIGSEGV || !info || info->si_signo != SIGSEGV) { - fprintf(stderr, "\n*** Mercury runtime: "); - fprintf(stderr, "caught strange segmentation violation ***\n"); - exit(1); + MR_fatal_abort(context, "\n*** Mercury runtime: " + "caught strange segmentation violation ***\n", 1); } /*