p Testing the remote exception raising feature
! output sort
-$ $SG_TEST_EXENV exception/exception ${srcdir:=.}/../platforms/platform.xml ${srcdir:=.}/exception/deployment_exception.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+$ $SG_TEST_EXENV exception/exception ${srcdir:=.}/../platforms/platform.xml ${srcdir:=.}/exception/deployment_exception.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" "--cfg=exception/cutpath:1"
> [ 0.000000] (1:terrorist@Jacquelin) Let's create a victim.
> [ 0.000000] (2:victim@Jacquelin) Let's work.
> [ 0.000000] (1:terrorist@Jacquelin) Going to sleep for 1 second
> ** SimGrid: UNCAUGHT EXCEPTION received on exception/exception(2): category: action canceled; value: 0
> ** Canceled
> ** Thrown by () on process 0
+> [ 0.000000] (0:@) Configuration change: Set 'exception/cutpath' to '1'
> [ 3.000000] (2:victim@Jacquelin) Canceled
->
-> ** In SIMIX_execution_finish() at /home/alegrand/Work/SimGrid/simgrid-git/src/simix/smx_host.c:557
-> ** In SIMIX_post_host_execute() at /home/alegrand/Work/SimGrid/simgrid-git/src/simix/smx_host.c:604
-> ** In SIMIX_simcall_exit() at /home/alegrand/Work/SimGrid/simgrid-git/src/simix/popping.c:39
-> ** In SIMIX_run() at /home/alegrand/Work/SimGrid/simgrid-git/src/simix/smx_global.c:410
-> ** In MSG_main() at /home/alegrand/Work/SimGrid/simgrid-git/src/msg/msg_global.c:129
-> ** In main() at /home/alegrand/Work/SimGrid/simgrid-git/examples/msg/exception/exception.c:156
+>
+> ** In SIMIX_execution_finish() at smx_host.c
+> ** In SIMIX_run() at smx_global.c
+> ** In MSG_main() at msg_global.c
+> ** In main() at exception.c
> [ 3.000000] (2:victim@Jacquelin) (end of the second exception) ----8<------------------------
> [ 3.000000] (2:victim@Jacquelin) Let's sleep for 10 seconds.
> [ 6.000000] (1:terrorist@Jacquelin) Send a third exception (cancellation)
xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce, NULL);
#endif // HAVE_SMPI
+ xbt_cfg_register(&_sg_cfg_set, "exception/cutpath",
+ "\"yes\" or \"no\". \"yes\" will cut all path information from call traces, used e.g. in exceptions.",
+ xbt_cfgelm_boolean, 1, 1, NULL, NULL);
+ xbt_cfg_setdefault_boolean(_sg_cfg_set, "exception/cutpath", "no");
+
xbt_cfg_register(&_sg_cfg_set, "clean_atexit",
"\"yes\" or \"no\". \"yes\" enables all the cleanups of SimGrid (XBT,SIMIX,MSG) to be registered with atexit. \"no\" may be useful if your code segfaults when calling the exit function.",
xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_clean_atexit, NULL);
#include "xbt_modinter.h" /* backtrace initialization headers */
#include "xbt/ex_interface.h"
+#include "simgrid/sg_config.h" /* Configuration mechanism of SimGrid */
+
#undef HAVE_BACKTRACE
#if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
int i;
fprintf(stderr, "\n");
- for (i = 0; i < e->used; i++)
- fprintf(stderr, "%s\n", e->bt_strings[i]);
+ for (i = 0; i < e->used; i++) {
+ if (sg_cfg_get_boolean("exception/cutpath")) {
+ char* p = e->bt_strings[i];
+ xbt_str_rtrim(p, ":0123456789");
+ char* filename = strrchr(p, '/')+1;
+ char* end_of_message = strrchr(p, ' ');
+
+ int length = strlen(p)-strlen(end_of_message);
+ char* dest = malloc(length);
+
+ memcpy(dest, &p[0], length);
+ dest[length] = 0;
+
+ fprintf(stderr, "%s %s\n", dest, filename);
+
+ free(dest);
+ }
+ else {
+ fprintf(stderr, "%s\n", e->bt_strings[i]);
+ }
+ }
} else
#endif