From: Arnaud Giersch Date: Thu, 31 May 2012 12:53:17 +0000 (+0200) Subject: Revert "Don't fail when backtrace() returns 0." X-Git-Tag: v3_8~654^2~16 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3c11bfaf6f2479fae9965f23d202d184627d2c8b Revert "Don't fail when backtrace() returns 0." This reverts commit 944109bb21e5dc635a47813a2adff0e16305d9c9. This commit is controversial, and was intended to fix build on systems where backtrace exists, but returns 0. The only known systems with such behavior are Debian on ARM (armel, armhf). Another workaround is to compile with the -funwind-tables gcc option. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=637360 for more information. --- diff --git a/src/xbt/backtrace_linux.c b/src/xbt/backtrace_linux.c index 084e668e1a..9704bc0560 100644 --- a/src/xbt/backtrace_linux.c +++ b/src/xbt/backtrace_linux.c @@ -74,10 +74,10 @@ void xbt_backtrace_current(xbt_ex_t * e) { e->used = backtrace((void **) e->bt, XBT_BACKTRACE_SIZE); if (e->used == 0) { - XBT_DEBUG("The backtrace() function failed.\n" - "Here is a crude dump of the exception that I was trying to build:\n" - "%s:%s(%d) [%s:%d] %s", - e->host, e->procname, e->pid, e->file, e->line, e->msg); + fprintf(stderr, "The backtrace() function failed, which probably means that the memory is exhausted. Here is a crude dump of the exception that I was trying to build:"); + fprintf(stderr, "%s:%s(%d) [%s:%d] %s", e->host,e->procname,e->pid, e->file,e->line,e->msg); + fprintf(stderr, "Bailing out now since there is nothing I can do without a decent amount of memory. Please go fix the memleaks\n"); + exit(1); } }