Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Also display the pid on backtraces
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 12 Apr 2006 14:16:42 +0000 (14:16 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 12 Apr 2006 14:16:42 +0000 (14:16 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2144 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/xbt/ex.h
src/gras/DataDesc/datadesc.c
src/gras/Msg/rpc.c

index 9699f6a..0d6c735 100644 (file)
@@ -242,6 +242,9 @@ typedef struct { __ex_mctx_struct } __ex_mctx_t;
  * @{
  */
 
+/* we need this symbol here, even if it breaks a bit the module separation */
+long int gras_os_getpid(void);
+
 /** @brief different kind of errors */
 typedef enum {
   unknown_error=0,  /**< unknown error */
@@ -267,6 +270,7 @@ typedef struct {
   char *host;     /* NULL for localhost; hostname if remote */
   /* FIXME: host should be hostname:port[#thread] */
   char *procname; 
+  long int pid;
   char *file;     /**< to be freed only for remote exceptions */
   int   line;     
   char *func;     /**< to be freed only for remote exceptions */
@@ -286,7 +290,7 @@ typedef struct {
 /* the static and dynamic initializers for a context structure */
 #define XBT_CTX_INITIALIZER \
     { NULL, 0, { /* content */ NULL, unknown_error, 0, \
-                 /* throw point*/ 0,NULL, NULL, NULL, 0, NULL,\
+                 /* throw point*/ 0,NULL, NULL,0, NULL, 0, NULL,\
                  /* backtrace */ 0,NULL,{NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL} } }
 #define XBT_CTX_INITIALIZE(ctx) \
     do { \
@@ -298,6 +302,7 @@ typedef struct {
         (ctx)->ctx_ex.remote     = 0;    \
         (ctx)->ctx_ex.host       = NULL; \
         (ctx)->ctx_ex.procname   = NULL; \
+        (ctx)->ctx_ex.pid        = 0;    \
         (ctx)->ctx_ex.file       = NULL; \
         (ctx)->ctx_ex.line       = 0;    \
         (ctx)->ctx_ex.func       = NULL; \
@@ -419,6 +424,7 @@ extern void __xbt_ex_terminate_default(xbt_ex_t *e);
      __xbt_ex_ctx()->ctx_ex.remote   = 0;                                     \
      __xbt_ex_ctx()->ctx_ex.host     = (char*)NULL;                           \
      __xbt_ex_ctx()->ctx_ex.procname = (char*)xbt_procname();                 \
+     __xbt_ex_ctx()->ctx_ex.pid      = gras_os_getpid();                      \
      __xbt_ex_ctx()->ctx_ex.file     = (char*)__FILE__;                       \
      __xbt_ex_ctx()->ctx_ex.line     = __LINE__;                              \
      __xbt_ex_ctx()->ctx_ex.func     = (char*)_XBT_FUNCTION;                  \
index de4d620..1589ecf 100644 (file)
@@ -122,6 +122,7 @@ gras_datadesc_init(void) {
 
   gras_datadesc_struct_append(ddt,"host",gras_datadesc_by_name("string"));
   gras_datadesc_struct_append(ddt,"procname",gras_datadesc_by_name("string"));
+  gras_datadesc_struct_append(ddt,"pid",gras_datadesc_by_name("long int"));
   gras_datadesc_struct_append(ddt,"file",gras_datadesc_by_name("string"));
   gras_datadesc_struct_append(ddt,"line",gras_datadesc_by_name("int"));
   gras_datadesc_struct_append(ddt,"func",gras_datadesc_by_name("string"));
index 85d30d2..14e774b 100644 (file)
@@ -121,6 +121,7 @@ void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx,
      __xbt_ex_ctx()->ctx_ex.remote   = 1;
      __xbt_ex_ctx()->ctx_ex.host     = e.host;
      __xbt_ex_ctx()->ctx_ex.procname = e.procname;
+     __xbt_ex_ctx()->ctx_ex.pid      = e.pid;
      __xbt_ex_ctx()->ctx_ex.file     = e.file;
      __xbt_ex_ctx()->ctx_ex.line     = e.line;
      __xbt_ex_ctx()->ctx_ex.func     = e.func;