Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove now unused support for remote exceptions.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 11 Dec 2012 14:48:02 +0000 (15:48 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 11 Dec 2012 14:48:38 +0000 (15:48 +0100)
Plus slight reindent in ex.h.

include/xbt/ex.h
src/xbt/backtrace_linux.c
src/xbt/ex.c
src/xbt/xbt_log_layout_format.c

index 909af2c..82573e0 100644 (file)
@@ -250,41 +250,34 @@ __ex_mctx_struct} __ex_mctx_t;
 
 /** @brief different kind of errors */
 typedef enum {
 
 /** @brief different kind of errors */
 typedef enum {
-  unknown_error = 0,/**< unknown error */
-  arg_error,        /**< Invalid argument */
-  bound_error,      /**< Out of bounds argument */
-  mismatch_error,   /**< The provided ID does not match */
-  not_found_error,  /**< The searched element was not found */
-
-  system_error,   /**< a syscall did fail */
-  network_error,  /**< error while sending/receiving data */
-  timeout_error,  /**< not quick enough, dude */
-  cancel_error,   /**< an action was canceled */
-  thread_error,    /**< error while [un]locking */
-  host_error,                            /**< host failed */
-  tracing_error,   /**< error during the simulation tracing */
-  io_error          /**< disk or file error */
+  unknown_error = 0,            /**< unknown error */
+  arg_error,                    /**< Invalid argument */
+  bound_error,                  /**< Out of bounds argument */
+  mismatch_error,               /**< The provided ID does not match */
+  not_found_error,              /**< The searched element was not found */
+  system_error,                 /**< a syscall did fail */
+  network_error,                /**< error while sending/receiving data */
+  timeout_error,                /**< not quick enough, dude */
+  cancel_error,                 /**< an action was canceled */
+  thread_error,                 /**< error while [un]locking */
+  host_error,                   /**< host failed */
+  tracing_error,                /**< error during the simulation tracing */
+  io_error                      /**< disk or file error */
 } xbt_errcat_t;
 
 XBT_PUBLIC(const char *) xbt_ex_catname(xbt_errcat_t cat);
 
 /** @brief Structure describing an exception */
 typedef struct {
 } xbt_errcat_t;
 
 XBT_PUBLIC(const char *) xbt_ex_catname(xbt_errcat_t cat);
 
 /** @brief Structure describing an exception */
 typedef struct {
-  char *msg;             /**< human readable message */
-  xbt_errcat_t category;
-                         /**< category like HTTP (what went wrong) */
-  int value;             /**< like errno (why did it went wrong) */
+  char *msg;                    /**< human readable message */
+  xbt_errcat_t category;        /**< category like HTTP (what went wrong) */
+  int value;                    /**< like errno (why did it went wrong) */
   /* throw point */
   /* throw point */
-  short int remote;
-                    /**< whether it was raised remotely */
-  char *host;     /**< NULL locally thrown exceptions; full hostname if remote ones */
-  /* FIXME: host should be hostname:port[#thread] */
-  char *procname;
-                  /**< Name of the process who thrown this */
-  int pid;        /**< PID of the process who thrown this */
-  char *file;     /**< Thrown point */
-  int line;       /**< Thrown point */
-  char *func;     /**< Thrown point */
+  char *procname;               /**< Name of the process who thrown this */
+  int pid;                      /**< PID of the process who thrown this */
+  char *file;                   /**< Thrown point */
+  int line;                     /**< Thrown point */
+  char *func;                   /**< Thrown point */
   /* Backtrace */
   int used;
   char **bt_strings;            /* only filed on display (or before the network propagation) */
   /* Backtrace */
   int used;
   char **bt_strings;            /* only filed on display (or before the network propagation) */
@@ -302,9 +295,9 @@ typedef struct {
 } xbt_running_ctx_t;
 
 /* the static and dynamic initializers for a context structure */
 } xbt_running_ctx_t;
 
 /* the static and dynamic initializers for a context structure */
-#define XBT_RUNNING_CTX_INITIALIZER \
-    { NULL, 0, { /* content */ NULL, unknown_error, 0, \
-                 /* throw point*/ 0,NULL, NULL,0, NULL, 0, NULL,\
+#define XBT_RUNNING_CTX_INITIALIZER                             \
+    { NULL, 0, { /* content */ NULL, unknown_error, 0,          \
+                 /* throw point*/ NULL, 0, NULL, 0, NULL,       \
                  /* backtrace */ 0, NULL, /* bt[] */ } }
 
 XBT_PUBLIC_DATA(const xbt_running_ctx_t) __xbt_ex_ctx_initializer;
                  /* backtrace */ 0, NULL, /* bt[] */ } }
 
 XBT_PUBLIC_DATA(const xbt_running_ctx_t) __xbt_ex_ctx_initializer;
@@ -426,8 +419,6 @@ XBT_PUBLIC( void )__xbt_ex_terminate_default(xbt_ex_t * e);
   _throw_ctx->exception.msg      = (m);                                 \
   _throw_ctx->exception.category = (xbt_errcat_t)(c);                   \
   _throw_ctx->exception.value    = (v);                                 \
   _throw_ctx->exception.msg      = (m);                                 \
   _throw_ctx->exception.category = (xbt_errcat_t)(c);                   \
   _throw_ctx->exception.value    = (v);                                 \
-  _throw_ctx->exception.remote   = 0;                                   \
-  _throw_ctx->exception.host     = (char*)NULL;                         \
   _throw_ctx->exception.procname = (char*)xbt_procname();               \
   _throw_ctx->exception.pid      = xbt_getpid();                        \
   _throw_ctx->exception.file     = (char*)__FILE__;                     \
   _throw_ctx->exception.procname = (char*)xbt_procname();               \
   _throw_ctx->exception.pid      = xbt_getpid();                        \
   _throw_ctx->exception.file     = (char*)__FILE__;                     \
index 04a26c7..d7e6d49 100644 (file)
@@ -80,7 +80,8 @@ void xbt_backtrace_current(xbt_ex_t * e)
   e->used = backtrace((void **) e->bt, XBT_BACKTRACE_SIZE);
   if (e->used == 0) {
     fprintf(stderr, "The backtrace() function failed, which probably means that the memory is exhausted. Here is a crude dump of the exception that I was trying to build:");
   e->used = backtrace((void **) e->bt, XBT_BACKTRACE_SIZE);
   if (e->used == 0) {
     fprintf(stderr, "The backtrace() function failed, which probably means that the memory is exhausted. Here is a crude dump of the exception that I was trying to build:");
-    fprintf(stderr, "%s:%s(%d) [%s:%d] %s", e->host,e->procname,e->pid, e->file,e->line,e->msg);
+    fprintf(stderr, "%s(%d) [%s:%d] %s",
+            e->procname, e->pid, e->file, e->line, e->msg);
     fprintf(stderr, "Bailing out now since there is nothing I can do without a decent amount of memory. Please go fix the memleaks\n");
     exit(1);
   }
     fprintf(stderr, "Bailing out now since there is nothing I can do without a decent amount of memory. Please go fix the memleaks\n");
     exit(1);
   }
index 1017b5f..c6e74bd 100644 (file)
@@ -103,7 +103,6 @@ void xbt_backtrace_display(xbt_ex_t * e)
 
   /* don't fool xbt_ex_free with uninitialized msg field */
   e->msg = NULL;
 
   /* don't fool xbt_ex_free with uninitialized msg field */
   e->msg = NULL;
-  e->remote = 0;
   xbt_ex_free(*e);
 #else
 
   xbt_ex_free(*e);
 #else
 
@@ -132,9 +131,6 @@ void xbt_ex_display(xbt_ex_t * e)
 {
   char *thrower = NULL;
 
 {
   char *thrower = NULL;
 
-  if (e->remote)
-    thrower = bprintf(" on host %s(%d)", e->host, e->pid);
-
   fprintf(stderr,
           "** SimGrid: UNCAUGHT EXCEPTION received on %s(%d): category: %s; value: %d\n"
           "** %s\n"
   fprintf(stderr,
           "** SimGrid: UNCAUGHT EXCEPTION received on %s(%d): category: %s; value: %d\n"
           "** %s\n"
@@ -145,7 +141,7 @@ void xbt_ex_display(xbt_ex_t * e)
   XBT_CRITICAL("%s", e->msg);
   xbt_free(thrower);
 
   XBT_CRITICAL("%s", e->msg);
   xbt_free(thrower);
 
-  if (!e->remote && !e->bt_strings)
+  if (!e->bt_strings)
     xbt_ex_setup_backtrace(e);
 
 #ifdef HAVE_BACKTRACE
     xbt_ex_setup_backtrace(e);
 
 #ifdef HAVE_BACKTRACE
@@ -187,12 +183,6 @@ void xbt_ex_free(xbt_ex_t e)
   int i;
 
   free(e.msg);
   int i;
 
   free(e.msg);
-  if (e.remote) {
-    free(e.procname);
-    free(e.file);
-    free(e.func);
-    free(e.host);
-  }
 
   if (e.bt_strings) {
     for (i = 0; i < e.used; i++)
 
   if (e.bt_strings) {
     for (i = 0; i < e.used; i++)
index 651a2ff..9801a74 100644 (file)
@@ -162,7 +162,6 @@ static int xbt_log_layout_format_doit(xbt_log_layout_t l,
           e.used = backtrace((void **) e.bt, XBT_BACKTRACE_SIZE);
           e.bt_strings = NULL;
           e.msg = NULL;
           e.used = backtrace((void **) e.bt, XBT_BACKTRACE_SIZE);
           e.bt_strings = NULL;
           e.msg = NULL;
-          e.remote = 0;
           xbt_ex_setup_backtrace(&e);
           if (*q == 'B') {
             show_string(e.bt_strings[1] + 8);
           xbt_ex_setup_backtrace(&e);
           if (*q == 'B') {
             show_string(e.bt_strings[1] + 8);