From ddf5b93f08c793fed357c61e9e8486fbd8084b56 Mon Sep 17 00:00:00 2001 From: mquinson Date: Mon, 6 Aug 2007 11:31:56 +0000 Subject: [PATCH 1/1] Add an explanation in the default exception fetcher to avoid scream in the future as loud as I did yesterday; plus also display the current thread when displaying a backtrace. These messages often get desynchronized with other logs, making it harder to see which backtrace matches which log (which thread) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3978 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/xbt/ex.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/xbt/ex.c b/src/xbt/ex.c index c2e2e59933..8abd459981 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -17,6 +17,7 @@ #include "portable.h" /* execinfo when available */ #include "xbt/ex.h" #include "xbt/module.h" /* xbt_binary_name */ +#include "xbt/synchro.h" /* xbt_thread_self */ #include "gras/Virtu/virtu_interface.h" /* gras_os_myname */ #include "xbt/ex_interface.h" @@ -25,6 +26,16 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ex,xbt,"Exception mecanism"); /* default __ex_ctx callback function */ ex_ctx_t *__xbt_ex_ctx_default(void) { + /* Don't scream: this is a default which is never used (so, yes, + there is one setjump container by running entity). + + This default gets overriden in xbt/xbt_os_thread.c so that it works in + real life and in simulation when using threads to implement the simulation + processes (ie, with pthreads and on windows). + + It also gets overriden in xbt/context.c when using ucontextes (as well as + in Java for now, but after the java overhaul, it will get cleaned out) + */ static ex_ctx_t ctx = XBT_CTX_INITIALIZER; return &ctx; @@ -48,7 +59,8 @@ void xbt_backtrace_display(xbt_ex_t *e) { if (e->used == 0) { fprintf(stderr,"(backtrace not set)\n"); } else { - fprintf(stderr,"Backtrace:\n"); + fprintf(stderr,"Backtrace (displayed in thread %p):\n", + (void*)xbt_thread_self()); for (i=1; iused; i++) /* no need to display "xbt_display_backtrace" */ fprintf(stderr,"---> %s\n",e->bt_strings[i] +4); } -- 2.20.1