From 9c02c71b549fdb386bc38a1a9c7fcc7d456e3c09 Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 14 Dec 2010 05:19:51 +0000 Subject: [PATCH] Better error message if malloc gets a SIGSEGV. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167785 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/go-signal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c index 8f44970..3838ab9 100644 --- a/libgo/runtime/go-signal.c +++ b/libgo/runtime/go-signal.c @@ -133,6 +133,12 @@ sighandler (int sig) { sigset_t clear; + if (__sync_bool_compare_and_swap (&m->mallocing, 1, 1)) + { + fprintf (stderr, "caught signal while mallocing: %s\n", msg); + __go_assert (0); + } + /* The signal handler blocked signals; unblock them. */ i = sigfillset (&clear); __go_assert (i == 0); -- 2.7.4