#ifndef __XBT_EX_H__
#define __XBT_EX_H__
-#include <xbt/misc.h>
#include <xbt/sysdep.h>
+#include <xbt/misc.h>
/* do not include execinfo.h directly since it's not always available.
Instead, copy the parts we need (and fake when it's not there) */
* @{
*/
+/** @brief different kind of errors */
typedef enum {
unknown_error=0, /**< unknown error */
arg_error, /**< Invalid argument */
int line;
char *func; /**< to be freed only for remote exceptions */
/* Backtrace */
- void *bt[10];
+ void *bt[XBT_BACKTRACE_SIZE];
int used;
} xbt_ex_t;
(ctx)->ctx_mctx = NULL; \
(ctx)->ctx_caught = 0; \
(ctx)->ctx_ex.msg = NULL; \
- (ctx)->ctx_ex.category = 0; \
+ (ctx)->ctx_ex.category = unknown_error; \
(ctx)->ctx_ex.value = 0; \
(ctx)->ctx_ex.host = NULL; \
(ctx)->ctx_ex.procname = NULL; \
do { /* change this sequence into one block */ \
/* build the exception */ \
__xbt_ex_ctx()->ctx_ex.msg = (m); \
- __xbt_ex_ctx()->ctx_ex.category = (c); \
+ __xbt_ex_ctx()->ctx_ex.category = (xbt_errcat_t)(c); \
__xbt_ex_ctx()->ctx_ex.value = (v); \
__xbt_ex_ctx()->ctx_ex.host = (char*)NULL; \
__xbt_ex_ctx()->ctx_ex.procname = strdup(xbt_procname()); \
__xbt_ex_ctx()->ctx_ex.file = (char*)__FILE__; \
__xbt_ex_ctx()->ctx_ex.line = __LINE__; \
__xbt_ex_ctx()->ctx_ex.func = (char*)_XBT_FUNCTION; \
- __xbt_ex_ctx()->ctx_ex.used = backtrace((void**)__xbt_ex_ctx()->ctx_ex.bt,10);\
+ __xbt_ex_ctx()->ctx_ex.used = backtrace((void**)__xbt_ex_ctx()->ctx_ex.bt,XBT_BACKTRACE_SIZE);\
/* deal with the exception */ \
if (__xbt_ex_ctx()->ctx_mctx == NULL) \
__xbt_ex_terminate((xbt_ex_t *)&(__xbt_ex_ctx()->ctx_ex)); /* not catched */\