From: Marion Guthmuller Date: Wed, 23 May 2012 09:47:21 +0000 (+0200) Subject: compilation errors (optimizations and model checking on) fixed in function ‘get_addr_... X-Git-Tag: v3_8~695 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3187f0cf6163ddd170510f8aea2a6b9fc9dd3e46 compilation errors (optimizations and model checking on) fixed in function ‘get_addr_memory_map’ --- diff --git a/src/mc/mc_liveness.c b/src/mc/mc_liveness.c index ae15bbfcef..b93a56cf18 100644 --- a/src/mc/mc_liveness.c +++ b/src/mc/mc_liveness.c @@ -48,7 +48,7 @@ const char* get_memory_map_addr(void *addr){ if(addr == NULL) return "nil"; - char *lfields[6], *start, *end, *endptr; + char *lfields[6], *start, *end, *endptr, *map; int i; void *start_addr; void *end_addr; @@ -59,10 +59,16 @@ const char* get_memory_map_addr(void *addr){ lfields[0] = strtok(line, " "); - for (i = 1; i < 6 && lfields[i - 1] != NULL; i++) { + for (i = 1; i < 5 && lfields[i - 1] != NULL; i++) { lfields[i] = strtok(NULL, " "); } + map = strtok(NULL, " "); + if(map != NULL) + lfields[5] = strdup(map); + else + lfields[5] = strdup("Anonymous"); + start = strtok(lfields[0], "-"); start_addr = (void *) strtoul(start, &endptr, 16); @@ -930,9 +936,6 @@ void MC_ddfs_init(void){ XBT_DEBUG("Double-DFS init"); XBT_DEBUG("**************************************************"); - XBT_DEBUG("Std heap : %p", std_heap); - XBT_DEBUG("Raw heap : %p", raw_heap); - mc_pair_stateless_t mc_initial_pair = NULL; mc_state_t initial_graph_state = NULL; smx_process_t process; diff --git a/src/xbt/mmalloc/mm_diff.c b/src/xbt/mmalloc/mm_diff.c index a2e29b6f6d..45f6d7cf98 100644 --- a/src/xbt/mmalloc/mm_diff.c +++ b/src/xbt/mmalloc/mm_diff.c @@ -6,6 +6,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "xbt/ex_interface.h" /* internals of backtrace setup */ +#include "xbt/str.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mm_diff, xbt, "Logging specific to mm_diff in mmalloc"); @@ -342,10 +343,10 @@ const char* get_addr_memory_map(void *addr, void* s_heap, void* r_heap){ if(addr == NULL) return "nil"; - char *lfields[6], *start, *end, *endptr; - int i; + char *lfields[6], *start, *end, *endptr, *map; void *start_addr; void *end_addr; + int i; while ((read = getline(&line, &n, fp)) != -1) { @@ -353,10 +354,16 @@ const char* get_addr_memory_map(void *addr, void* s_heap, void* r_heap){ lfields[0] = strtok(line, " "); - for (i = 1; i < 6; i++) { - lfields[i] = strtok(NULL, " "); + for (i = 1; i < 5 && lfields[i - 1] != NULL ; i++) { + lfields[i] = strdup(strtok(NULL, " ")); } + map = strtok(NULL, " "); + if(map != NULL) + lfields[5] = strdup(map); + else + lfields[5] = strdup("Anonymous"); + start = strtok(lfields[0], "-"); start_addr = (void *) strtoul(start, &endptr, 16); @@ -364,21 +371,20 @@ const char* get_addr_memory_map(void *addr, void* s_heap, void* r_heap){ lfields[5] = strdup("std_heap"); if(start_addr == r_heap) lfields[5] = strdup("raw_heap"); + end = strtok(NULL, "-"); end_addr = (void *) strtoul(end, &endptr, 16); if((addr > start_addr) && ( addr < end_addr)){ free(line); fclose(fp); - if(lfields[5] != NULL){ - return lfields[5]; - }else{ - return "Anonymous"; - } + return lfields[5]; } } + free(line); + fclose(fp); return "Unknown area"; }