X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b72e8264dccedfa1c53042e99f94d3a8e5387316..0275d08cbb6554fc92eff095847ea32f049e37e9:/src/mc/mc_checkpoint.c diff --git a/src/mc/mc_checkpoint.c b/src/mc/mc_checkpoint.c index 5384c3893f..984323bf3b 100644 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@ -112,9 +112,50 @@ void MC_take_snapshot(mc_snapshot_t snapshot) free_memory_map(maps); } -void MC_take_snapshot_liveness(mc_snapshot_t snapshot) +void MC_init_memory_map_info(){ + + unsigned int i = 0; + s_map_region_t reg; + memory_map_t maps = get_memory_map(); + + while (i < maps->mapsize) { + reg = maps->regions[i]; + if ((reg.prot & PROT_WRITE)){ + if (maps->regions[i].pathname == NULL){ + if(reg.start_addr == raw_heap){ + end_raw_heap = reg.end_addr; + } + } else { + if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){ + start_data_libsimgrid = reg.start_addr; + } + } + }else if ((reg.prot & PROT_READ)){ + if (maps->regions[i].pathname != NULL){ + if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){ + start_text_libsimgrid = reg.start_addr; + libsimgrid_path = strdup(maps->regions[i].pathname); + }else{ + if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){ + start_text_binary = reg.start_addr; + } + } + } + } + i++; + } + +} + +mc_snapshot_t MC_take_snapshot_liveness() { + raw_mem_set = (mmalloc_get_current_heap() == raw_heap); + + MC_SET_RAW_MEM; + + mc_snapshot_t snapshot = xbt_new0(s_mc_snapshot_t, 1); + unsigned int i = 0; s_map_region_t reg; memory_map_t maps = get_memory_map(); @@ -176,6 +217,13 @@ void MC_take_snapshot_liveness(mc_snapshot_t snapshot) free_memory_map(maps); + MC_UNSET_RAW_MEM; + + if(raw_mem_set) + MC_SET_RAW_MEM; + + return snapshot; + } void MC_restore_snapshot(mc_snapshot_t snapshot) @@ -209,7 +257,10 @@ void get_libsimgrid_plt_section(){ int i, plt_not_found = 1; unsigned long int size, offset; - char *command = bprintf( "objdump --section-headers %s", libsimgrid_path); + if(libsimgrid_path == NULL) + libsimgrid_path = get_libsimgrid_path(); + + char *command = bprintf("objdump --section-headers %s", libsimgrid_path); fp = popen(command, "r"); @@ -246,7 +297,6 @@ void get_libsimgrid_plt_section(){ } } - } free(command); @@ -365,7 +415,7 @@ static xbt_strbuff_t get_local_variables_values(void *stack_context, void *heap) int ret; //char *stack_name; - char buf[512], frame_name[256]; + char frame_name[256]; ret = unw_init_local(&c, (unw_context_t *)stack_context); if(ret < 0){ @@ -397,16 +447,9 @@ static xbt_strbuff_t get_local_variables_values(void *stack_context, void *heap) unw_get_reg(&c, UNW_REG_IP, &ip); unw_get_reg(&c, UNW_REG_SP, &sp); - buf[0] = '\0'; - if (unw_get_proc_name (&c, frame_name, sizeof (frame_name), &off) == 0){ - if (off) - snprintf (buf, sizeof (buf), "<%s+0x%lx>", frame_name, (long) off); - else - snprintf (buf, sizeof (buf), "<%s>", frame_name); - - } + unw_get_proc_name (&c, frame_name, sizeof (frame_name), &off); - xbt_strbuff_append(variables, bprintf("ip=%-32s\n", buf)); + xbt_strbuff_append(variables, bprintf("ip=%s\n", frame_name)); frame = xbt_dict_get_or_null(mc_local_variables, frame_name);