From 8c0a8b86fcd472830e5eb55b27f5946b4538aa8a Mon Sep 17 00:00:00 2001 From: mquinson Date: Wed, 12 Apr 2006 14:16:42 +0000 Subject: [PATCH] Also display the pid on backtraces git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2144 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- include/xbt/ex.h | 8 +++++++- src/gras/DataDesc/datadesc.c | 1 + src/gras/Msg/rpc.c | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/xbt/ex.h b/include/xbt/ex.h index 9699f6a41a..0d6c735418 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -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; \ diff --git a/src/gras/DataDesc/datadesc.c b/src/gras/DataDesc/datadesc.c index de4d620158..1589ecf26f 100644 --- a/src/gras/DataDesc/datadesc.c +++ b/src/gras/DataDesc/datadesc.c @@ -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")); diff --git a/src/gras/Msg/rpc.c b/src/gras/Msg/rpc.c index 85d30d2b02..14e774bd55 100644 --- a/src/gras/Msg/rpc.c +++ b/src/gras/Msg/rpc.c @@ -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; -- 2.20.1