Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Get the simulated exceptions as verbose as real ones
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 3 Oct 2005 19:47:48 +0000 (19:47 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 3 Oct 2005 19:47:48 +0000 (19:47 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1749 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/xbt/ex.h
src/xbt/context.c
src/xbt/ex.c

index 3f1ecf3..4882588 100644 (file)
@@ -415,6 +415,8 @@ extern void __xbt_ex_terminate_default(xbt_ex_t *e);
 void xbt_ex_free(xbt_ex_t e);
 const char * xbt_ex_catname(xbt_errcat_t cat);
 
+void xbt_ex_display(xbt_ex_t *e);
+
 /** @} */
 #endif /* __XBT_EX_H__ */
  
index e710657..fd3c271 100644 (file)
@@ -172,8 +172,9 @@ static ex_ctx_t *__context_ex_ctx(void)
 }
 
 /* callback: termination */
-static void __context_ex_terminate(xbt_ex_t *e)
-{
+static void __context_ex_terminate(xbt_ex_t *e) {
+  xbt_ex_display(e);
+
   __context_exit(current_context, e->value);
 }
 
index 5ca8f9d..5a9ad01 100644 (file)
@@ -42,8 +42,8 @@ ex_ctx_t *__xbt_ex_ctx_default(void) {
     return &ctx;
 }
 
-/* default __ex_terminate callback function */
-void __xbt_ex_terminate_default(xbt_ex_t *e)  {
+/** @brief shows an exception content and the associated stack if available */
+void xbt_ex_display(xbt_ex_t *e)  {
 
   fprintf(stderr,
          "** SimGrid: UNCAUGHT EXCEPTION: category: %s; value: %d\n"
@@ -67,6 +67,12 @@ void __xbt_ex_terminate_default(xbt_ex_t *e)  {
   free (strings);
  }
 #endif
+}
+
+
+/* default __ex_terminate callback function */
+void __xbt_ex_terminate_default(xbt_ex_t *e)  {
+  xbt_ex_display(e);
 
   abort();
 }