From 5b32d08cb7d3c3563120366a1b508a325e8d5da3 Mon Sep 17 00:00:00 2001 From: mquinson Date: Mon, 3 Oct 2005 19:47:48 +0000 Subject: [PATCH] Get the simulated exceptions as verbose as real ones git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1749 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- include/xbt/ex.h | 2 ++ src/xbt/context.c | 5 +++-- src/xbt/ex.c | 10 ++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/xbt/ex.h b/include/xbt/ex.h index 3f1ecf38cb..48825880c4 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -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__ */ diff --git a/src/xbt/context.c b/src/xbt/context.c index e7106576ff..fd3c271766 100644 --- a/src/xbt/context.c +++ b/src/xbt/context.c @@ -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); } diff --git a/src/xbt/ex.c b/src/xbt/ex.c index 5ca8f9d2e9..5a9ad015fe 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -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(); } -- 2.20.1