Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Replace some xbt_abort with xbt_die + error msg
[simgrid.git] / src / xbt / memory_map.cpp
index 56349c4..ea28244 100644 (file)
@@ -34,9 +34,10 @@ XBT_PRIVATE std::vector<VmMap> get_memory_map(pid_t pid)
   /* to be returned. */
   char* path = bprintf("/proc/%i/maps", (int) pid);
   FILE *fp = std::fopen(path, "r");
-  if(fp == nullptr)
+  if (fp == nullptr) {
     std::perror("fopen failed");
-  xbt_assert(fp, "Cannot open %s to investigate the memory map of the process.", path);
+    xbt_die("Cannot open %s to investigate the memory map of the process.", path);
+  }
   free(path);
   setbuf(fp, nullptr);
 
@@ -64,13 +65,13 @@ XBT_PRIVATE std::vector<VmMap> get_memory_map(pid_t pid)
 
     /* Check to see if we got the expected amount of columns */
     if (i < 6)
-      xbt_abort();
+      xbt_die("The memory map apparently only supplied less than 6 columns. Recovery impossible.");
 
     /* Ok we are good enough to try to get the info we need */
     /* First get the start and the end address of the map   */
     char *tok = std::strtok(lfields[0], "-");
     if (tok == nullptr)
-      xbt_abort();
+      xbt_die("Start and end address of the map are not concatenated by a hyphen (-). Recovery impossible.");
 
     VmMap memreg;
     char *endptr;