X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/daf9d10c7877d35670e36e52be8a5207706d3bb1..0e915279248827ec47926e0e9dd77b486bd6c445:/src/mc/memory_map.c diff --git a/src/mc/memory_map.c b/src/mc/memory_map.c index 9e987f0f07..1fe0b1ad95 100644 --- a/src/mc/memory_map.c +++ b/src/mc/memory_map.c @@ -18,12 +18,13 @@ memory_map_t get_memory_map(void) char *lfields[6], *tok, *endptr; int i; - char *backup_line = NULL; - /* Open the actual process's proc maps file and create the memory_map_t */ /* to be returned. */ fp = fopen("/proc/self/maps", "r"); + if(fp == NULL) + perror("fopen failed"); + xbt_assert(fp, "Cannot open /proc/self/maps to investigate the memory map of the process. Please report this bug."); @@ -34,9 +35,7 @@ memory_map_t get_memory_map(void) /* Read one line at the time, parse it and add it to the memory map to be returned */ while ((read = getline(&line, &n, fp)) != -1) { - //XBT_INFO("%s", line); - if(XBT_LOG_ISENABLED(mc_memory_map, xbt_log_priority_debug)) - backup_line = strdup(line); + XBT_DEBUG("%s", line); /* Wipeout the new line character */ line[read - 1] = '\0'; @@ -143,25 +142,11 @@ memory_map_t get_memory_map(void) memcpy(ret->regions + ret->mapsize, &memreg, sizeof(memreg)); ret->mapsize++; - if(XBT_LOG_ISENABLED(mc_memory_map, xbt_log_priority_debug)){ - if ((memreg.prot & PROT_WRITE)){ - if (memreg.pathname == NULL){ - if (memreg.start_addr == std_heap){ - XBT_DEBUG("New region in snapshot : %s", backup_line); - } - } else { - if (!memcmp(basename(memreg.pathname), "libsimgrid", 10)){ - XBT_DEBUG("New region in snapshot : %s", backup_line); - } - } - } - } - - } - if (line) - free(line); + free(line); + + fclose(fp); return ret; }