From: mquinson Date: Tue, 7 Dec 2010 08:46:46 +0000 (+0000) Subject: don't try to compute the backtrace if we have no process name (only occure with ... X-Git-Tag: v3.6_beta2~903 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/34f2f42cccff62773dd710b695bdfd1363b85d45?hp=ab3b0dcebcadbe3da395e9e8f73aefadb88b3924;ds=sidebyside don't try to compute the backtrace if we have no process name (only occure with *badly* written bindings, but saves a segfault then) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9020 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/xbt/backtrace_linux.c b/src/xbt/backtrace_linux.c index be2ebc476b..0401eebb7d 100644 --- a/src/xbt/backtrace_linux.c +++ b/src/xbt/backtrace_linux.c @@ -60,6 +60,9 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) && e->used, "Backtrace not setup yet, cannot set it up for display"); + if (!xbt_binary_name) /* no binary name, nothing to do */ + return; + backtrace_syms = backtrace_symbols(e->bt, e->used); /* ignore first one, which is this xbt_backtrace_current() */ e->used--; diff --git a/src/xbt/ex.c b/src/xbt/ex.c index cd6d584573..1b141a4d9b 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -153,6 +153,10 @@ void xbt_ex_display(xbt_ex_t * e) { int i; + if (!xbt_binary_name) { + fprintf(stderr, "variable 'xbt_binary_name' set to NULL. Cannot compute the backtrace\n"); + return; + } fprintf(stderr, "\n"); for (i = 0; i < e->used; i++) fprintf(stderr, "%s\n", e->bt_strings[i]);