Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
put the replay stuff in its own directory
[simgrid.git] / src / xbt / backtrace_linux.c
index 084e668..4f246cc 100644 (file)
@@ -58,6 +58,11 @@ backtrace_helper (struct _Unwind_Context *ctx, void *a)
  * */
 
 int xbt_backtrace_no_malloc(void **array, int size) {
+
+  int i = 0;
+  for(i=0; i < size; i++)
+    array[i] = NULL;
+
   struct trace_arg arg = { .array = array, .size = size, .cnt = -1 };
 
   if (size >= 1)
@@ -74,10 +79,10 @@ void xbt_backtrace_current(xbt_ex_t * e)
 {
   e->used = backtrace((void **) e->bt, XBT_BACKTRACE_SIZE);
   if (e->used == 0) {
-    XBT_DEBUG("The backtrace() function failed.\n"
-              "Here is a crude dump of the exception that I was trying to build:\n"
-              "%s:%s(%d) [%s:%d] %s",
-              e->host, e->procname, e->pid, e->file, e->line, e->msg);
+    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, "Bailing out now since there is nothing I can do without a decent amount of memory. Please go fix the memleaks\n");
+    exit(1);
   }
 }