1 /* Copyright (c) 2008-2013. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
8 #include "mc_private.h"
9 #include "xbt/module.h"
11 #include "../simix/smx_private.h"
13 #include <libunwind.h>
15 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_checkpoint, mc,
16 "Logging specific to mc_checkpoint");
18 void *start_text_libsimgrid;
19 void *start_plt_libsimgrid, *end_plt_libsimgrid;
20 void *start_got_plt_libsimgrid, *end_got_plt_libsimgrid;
21 void *start_plt_binary, *end_plt_binary;
22 void *start_got_plt_binary, *end_got_plt_binary;
23 char *libsimgrid_path;
24 void *start_data_libsimgrid, *start_bss_libsimgrid;
25 void *start_data_binary, *start_bss_binary;
26 void *start_text_binary;
28 /************************************ Free functions **************************************/
29 /*****************************************************************************************/
31 static void MC_snapshot_stack_free(mc_snapshot_stack_t s){
33 xbt_dynar_free(&(s->local_variables));
38 static void MC_snapshot_stack_free_voidp(void *s){
39 MC_snapshot_stack_free((mc_snapshot_stack_t) * (void **) s);
42 static void local_variable_free(local_variable_t v){
49 static void local_variable_free_voidp(void *v){
50 local_variable_free((local_variable_t) * (void **) v);
53 static void MC_region_destroy(mc_mem_region_t reg)
59 void MC_free_snapshot(mc_snapshot_t snapshot){
61 for(i=0; i < NB_REGIONS; i++)
62 MC_region_destroy(snapshot->regions[i]);
64 xbt_free(snapshot->stack_sizes);
65 xbt_dynar_free(&(snapshot->stacks));
66 xbt_dynar_free(&(snapshot->to_ignore));
71 /******************************* Snapshot regions ********************************/
72 /*********************************************************************************/
74 static mc_mem_region_t MC_region_new(int type, void *start_addr, size_t size)
76 mc_mem_region_t new_reg = xbt_new0(s_mc_mem_region_t, 1);
77 new_reg->start_addr = start_addr;
79 new_reg->data = xbt_malloc0(size);
80 memcpy(new_reg->data, start_addr, size);
82 XBT_DEBUG("New region : type : %d, data : %p (real addr %p), size : %zu", type, new_reg->data, start_addr, size);
87 static void MC_region_restore(mc_mem_region_t reg)
89 /*FIXME: check if start_addr is still mapped, if it is not, then map it
90 before copying the data */
92 memcpy(reg->start_addr, reg->data, reg->size);
96 static void MC_snapshot_add_region(mc_snapshot_t snapshot, int type, void *start_addr, size_t size)
98 mc_mem_region_t new_reg = MC_region_new(type, start_addr, size);
99 snapshot->regions[type] = new_reg;
103 static void MC_get_memory_regions(mc_snapshot_t snapshot){
110 char *lfields[6] = {0}, *tok;
111 void *start_addr, *start_addr1, *end_addr;
115 fp = fopen("/proc/self/maps", "r");
118 "Cannot open /proc/self/maps to investigate the memory map of the process. Please report this bug.");
122 while((read = xbt_getline(&line, &n, fp)) != -1){
124 /* Wipeout the new line character */
125 line[read - 1] = '\0';
127 /* Tokenize the line using spaces as delimiters and store each token */
128 lfields[0] = strtok(line, " ");
130 for (i = 1; i < 6 && lfields[i - 1] != NULL; i++) {
131 lfields[i] = strtok(NULL, " ");
134 /* First get the permissions flags, need write permission */
135 if(lfields[1][1] == 'w'){
137 /* Get the start address of the map */
138 tok = strtok(lfields[0], "-");
139 start_addr = (void *)strtoul(tok, NULL, 16);
141 if(start_addr == std_heap){ /* Std_heap ? */
142 tok = strtok(NULL, "-");
143 end_addr = (void *)strtoul(tok, NULL, 16);
144 MC_snapshot_add_region(snapshot, 0, start_addr, (char*)end_addr - (char*)start_addr);
145 snapshot->heap_bytes_used = mmalloc_get_bytes_used(std_heap);
146 }else{ /* map name == libsimgrid || binary_name ? */
147 if(lfields[5] != NULL){
148 if(!memcmp(basename(lfields[5]), "libsimgrid", 10)){
149 tok = strtok(NULL, "-");
150 end_addr = (void *)strtoul(tok, NULL, 16);
151 size = (char*)end_addr - (char*)start_addr;
152 /* BSS and data segments may be separated according to the OS */
153 if((read = xbt_getline(&line, &n, fp)) != -1){
154 line[read - 1] = '\0';
155 lfields[0] = strtok(line, " ");
156 for (i = 1; i < 6 && lfields[i - 1] != NULL; i++) {
157 lfields[i] = strtok(NULL, " ");
159 if(lfields[1][1] == 'w' && lfields[5] == NULL){
160 tok = strtok(lfields[0], "-");
161 start_addr1 = (void *)strtoul(tok, NULL, 16);
162 tok = strtok(NULL, "-");
163 size += (char *)(void *)strtoul(tok, NULL, 16) - (char*)start_addr1;
166 MC_snapshot_add_region(snapshot, 1, start_addr, size);
167 }else if(!memcmp(basename(lfields[5]), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
168 tok = strtok(NULL, "-");
169 end_addr = (void *)strtoul(tok, NULL, 16);
170 size = (char*)end_addr - (char*)start_addr;
171 /* BSS and data segments may be separated according to the OS */
172 if((read = xbt_getline(&line, &n, fp)) != -1){
173 line[read - 1] = '\0';
174 lfields[0] = strtok(line, " ");
175 for (i = 1; i < 6 && lfields[i - 1] != NULL; i++) {
176 lfields[i] = strtok(NULL, " ");
178 tok = strtok(lfields[0], "-");
179 start_addr1 = (void *)strtoul(tok, NULL, 16);
180 if(lfields[1][1] == 'w'){
181 if(start_addr1 == std_heap){ /* Std_heap ? */
182 tok = strtok(NULL, "-");
183 end_addr = (void *)strtoul(tok, NULL, 16);
184 MC_snapshot_add_region(snapshot, 0, start_addr1, (char*)end_addr - (char*)start_addr1);
185 snapshot->heap_bytes_used = mmalloc_get_bytes_used(std_heap);
186 }else if(start_addr1 != raw_heap){
187 tok = strtok(NULL, "-");
188 size += (char *)(void *)strtoul(tok, NULL, 16) - (char *)start_addr1;
192 MC_snapshot_add_region(snapshot, 2, start_addr, size);
193 }else if (!memcmp(lfields[5], "[stack]", 7)){
194 maestro_stack_start = start_addr;
195 tok = strtok(NULL, "-");
196 maestro_stack_end = (void *)strtoul(tok, NULL, 16);
209 /** @brief Find the range of the different memory segments and binary paths */
210 void MC_init_memory_map_info(){
214 memory_map_t maps = MC_get_memory_map();
216 while (i < maps->mapsize) {
217 reg = maps->regions[i];
218 if ((reg.prot & PROT_WRITE)){
219 if (maps->regions[i].pathname != NULL){
220 if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
221 start_data_libsimgrid = reg.start_addr;
223 reg = maps->regions[i];
224 if(reg.pathname == NULL && (reg.prot & PROT_WRITE) && i < maps->mapsize)
225 start_bss_libsimgrid = reg.start_addr;
226 }else if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
227 start_data_binary = reg.start_addr;
229 reg = maps->regions[i];
230 if(reg.pathname == NULL && (reg.prot & PROT_WRITE) && reg.start_addr != std_heap && reg.start_addr != raw_heap && i < maps->mapsize){
231 start_bss_binary = reg.start_addr;
234 }else if(!memcmp(maps->regions[i].pathname, "[stack]", 7)){
235 maestro_stack_start = reg.start_addr;
236 maestro_stack_end = reg.end_addr;
240 }else if ((reg.prot & PROT_READ) && (reg.prot & PROT_EXEC)){
241 if (maps->regions[i].pathname != NULL){
242 if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
243 start_text_libsimgrid = reg.start_addr;
244 libsimgrid_path = strdup(maps->regions[i].pathname);
245 }else if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
246 start_text_binary = reg.start_addr;
253 MC_free_memory_map(maps);
257 void MC_get_libsimgrid_plt_section(){
260 char *line = NULL; /* Temporal storage for each line that is readed */
261 ssize_t read; /* Number of bytes readed */
262 size_t n = 0; /* Amount of bytes to read by xbt_getline */
265 int i, plt_found = 0;
266 unsigned long int size, offset;
268 char *command = bprintf("LANG=C objdump --section-headers %s", libsimgrid_path);
270 fp = popen(command, "r");
273 perror("popen failed");
277 while ((read = xbt_getline(&line, &n, fp)) != -1 && plt_found != 2) {
282 /* Wipeout the new line character */
283 line[read - 1] = '\0';
285 lfields[0] = strtok(line, " ");
287 if(lfields[0] == NULL)
290 if(strcmp(lfields[0], "Sections:") == 0 || strcmp(lfields[0], "Idx") == 0 || strncmp(lfields[0], libsimgrid_path, strlen(libsimgrid_path)) == 0)
293 for (i = 1; i < 7 && lfields[i - 1] != NULL; i++) {
294 lfields[i] = strtok(NULL, " ");
298 if(strcmp(lfields[1], ".plt") == 0){
299 size = strtoul(lfields[2], NULL, 16);
300 offset = strtoul(lfields[5], NULL, 16);
301 start_plt_libsimgrid = (char *)start_text_libsimgrid + offset;
302 end_plt_libsimgrid = (char *)start_plt_libsimgrid + size;
304 }else if(strcmp(lfields[1], ".got.plt") == 0){
305 size = strtoul(lfields[2], NULL, 16);
306 offset = strtoul(lfields[5], NULL, 16);
307 start_got_plt_libsimgrid = (char *)start_text_libsimgrid + offset;
308 end_got_plt_libsimgrid = (char *)start_got_plt_libsimgrid + size;
322 void MC_get_binary_plt_section(){
325 char *line = NULL; /* Temporal storage for each line that is readed */
326 ssize_t read; /* Number of bytes readed */
327 size_t n = 0; /* Amount of bytes to read by xbt_getline */
330 int i, plt_found = 0;
331 unsigned long int size;
333 char *command = bprintf("LANG=C objdump --section-headers %s", xbt_binary_name);
335 fp = popen(command, "r");
338 perror("popen failed");
342 while ((read = xbt_getline(&line, &n, fp)) != -1 && plt_found != 2) {
347 /* Wipeout the new line character */
348 line[read - 1] = '\0';
350 lfields[0] = strtok(line, " ");
352 if(lfields[0] == NULL)
355 if(strcmp(lfields[0], "Sections:") == 0 || strcmp(lfields[0], "Idx") == 0 || strncmp(lfields[0], basename(xbt_binary_name), strlen(xbt_binary_name)) == 0)
358 for (i = 1; i < 7 && lfields[i - 1] != NULL; i++) {
359 lfields[i] = strtok(NULL, " ");
363 if(strcmp(lfields[1], ".plt") == 0){
364 size = strtoul(lfields[2], NULL, 16);
365 start_plt_binary = (void *)strtoul(lfields[3], NULL, 16);
366 end_plt_binary = (char *)start_plt_binary + size;
368 }else if(strcmp(lfields[1], ".got.plt") == 0){
369 size = strtoul(lfields[2], NULL, 16);
370 start_got_plt_binary = (char *)strtoul(lfields[3], NULL, 16);
371 end_got_plt_binary = (char *)start_got_plt_binary + size;
385 /************************************* Take Snapshot ************************************/
386 /****************************************************************************************/
388 static void MC_get_hash_global(char *snapshot_hash, void *data1, void *data2){
390 /* unsigned int cursor = 0; */
392 /* global_variable_t current_var; */
393 /* void *addr_pointed = NULL; */
394 /* void *res = NULL; */
396 /* xbt_strbuff_t clear = xbt_strbuff_new(); */
398 /* xbt_dynar_foreach(mc_global_variables, cursor, current_var){ */
399 /* if(current_var->address < start_data_libsimgrid){ /\* binary *\/ */
400 /* offset = (char *)current_var->address - (char *)start_data_binary; */
401 /* addr_pointed = *((void **)((char *)data2 + offset)); */
402 /* if(((addr_pointed >= start_plt_binary && addr_pointed <= end_plt_binary)) || ((addr_pointed >= std_heap && (char *)addr_pointed <= (char *)std_heap + STD_HEAP_SIZE ))) */
404 /* res = xbt_malloc0(current_var->size + 1); */
405 /* memset(res, 0, current_var->size + 1); */
406 /* memcpy(res, (char*)data2 + offset, current_var->size); */
407 /* }else{ /\* libsimgrid *\/ */
408 /* offset = (char *)current_var->address - (char *)start_data_libsimgrid; */
409 /* addr_pointed = *((void **)((char *)data1 + offset)); */
410 /* if((addr_pointed >= start_plt_libsimgrid && addr_pointed <= end_plt_libsimgrid) || (addr_pointed >= std_heap && (char *)addr_pointed <= (char *)std_heap + STD_HEAP_SIZE )) */
412 /* res = xbt_malloc0(current_var->size + 1); */
413 /* memset(res, 0, current_var->size + 1); */
414 /* memcpy(res, (char*)data1 + offset, current_var->size); */
416 /* if(res != NULL){ */
417 /* xbt_strbuff_append(clear, (const char*)res); */
423 /* xbt_sha(clear->data, snapshot_hash); */
425 /* xbt_strbuff_free(clear); */
429 static void MC_get_hash_local(char *snapshot_hash, xbt_dynar_t stacks){
431 /* xbt_dynar_t tokens = NULL, s_tokens = NULL; */
432 /* unsigned int cursor1 = 0, cursor2 = 0; */
433 /* mc_snapshot_stack_t current_stack; */
434 /* char *frame_name = NULL; */
437 /* xbt_strbuff_t clear = xbt_strbuff_new(); */
439 /* while(cursor1 < xbt_dynar_length(stacks)){ */
440 /* current_stack = xbt_dynar_get_as(stacks, cursor1, mc_snapshot_stack_t); */
441 /* tokens = xbt_str_split(current_stack->local_variables->data, NULL); */
443 /* while(cursor2 < xbt_dynar_length(tokens)){ */
444 /* s_tokens = xbt_str_split(xbt_dynar_get_as(tokens, cursor2, char *), "="); */
445 /* if(xbt_dynar_length(s_tokens) > 1){ */
446 /* if(strcmp(xbt_dynar_get_as(s_tokens, 0, char *), "frame_name") == 0){ */
447 /* xbt_free(frame_name); */
448 /* frame_name = xbt_strdup(xbt_dynar_get_as(s_tokens, 1, char *)); */
449 /* xbt_strbuff_append(clear, (const char*)xbt_dynar_get_as(tokens, cursor2, char *)); */
451 /* xbt_dynar_free(&s_tokens); */
454 /* addr = (void *) strtoul(xbt_dynar_get_as(s_tokens, 1, char *), NULL, 16); */
455 /* if(addr > std_heap && (char *)addr <= (char *)std_heap + STD_HEAP_SIZE){ */
457 /* xbt_dynar_free(&s_tokens); */
460 /* if(is_stack_ignore_variable(frame_name, xbt_dynar_get_as(s_tokens, 0, char *))){ */
462 /* xbt_dynar_free(&s_tokens); */
465 /* xbt_strbuff_append(clear, (const char *)xbt_dynar_get_as(tokens, cursor2, char *)); */
467 /* xbt_dynar_free(&s_tokens); */
470 /* xbt_dynar_free(&tokens); */
474 /* xbt_free(frame_name); */
476 /* xbt_sha(clear->data, snapshot_hash); */
478 /* xbt_strbuff_free(clear); */
482 static xbt_dynar_t MC_get_local_variables_values(void *stack_context){
487 char frame_name[256];
489 ret = unw_init_local(&c, (unw_context_t *)stack_context);
491 XBT_INFO("unw_init_local failed");
495 unw_word_t ip, sp, off;
498 unsigned int cursor = 0;
499 dw_variable_t current_variable;
500 dw_location_entry_t entry = NULL;
501 dw_location_t location_entry = NULL;
503 int frame_found = 0, region_type;
504 void *frame_pointer_address = NULL;
508 xbt_dynar_t variables = xbt_dynar_new(sizeof(local_variable_t), local_variable_free_voidp);
510 while(ret >= 0 && !stop){
512 unw_get_reg(&c, UNW_REG_IP, &ip);
513 unw_get_reg(&c, UNW_REG_SP, &sp);
515 unw_get_proc_name(&c, frame_name, sizeof (frame_name), &off);
517 if(!strcmp(frame_name, "smx_ctx_sysv_wrapper")) /* Stop before context switch with maestro */
520 if((long)ip > (long)start_text_libsimgrid)
521 frame = xbt_dict_get_or_null(mc_local_variables_libsimgrid, frame_name);
523 frame = xbt_dict_get_or_null(mc_local_variables_binary, frame_name);
530 true_ip = (long)frame->low_pc + (long)off;
531 frame_pointer_address = NULL;
533 /* Get frame pointer */
534 switch(frame->frame_base->type){
537 while(cursor < xbt_dynar_length(frame->frame_base->location.loclist) && !frame_found){
538 entry = xbt_dynar_get_as(frame->frame_base->location.loclist, cursor, dw_location_entry_t);
539 if((true_ip >= entry->lowpc) && (true_ip < entry->highpc)){
541 switch(entry->location->type){
543 if(xbt_dynar_length(entry->location->location.compose) > 1){
544 frame_pointer_address = NULL; /* TODO : location list with optimizations enabled */
546 location_entry = xbt_dynar_get_as(entry->location->location.compose, 0, dw_location_t);
547 switch(location_entry->type){
549 unw_get_reg(&c, location_entry->location.reg, &res);
550 frame_pointer_address = (void*)(long)res;
552 case e_dw_bregister_op:
553 unw_get_reg(&c, location_entry->location.breg_op.reg, &res);
554 frame_pointer_address = (void*)((long)res + location_entry->location.breg_op.offset);
557 frame_pointer_address = NULL; /* FIXME : implement other cases (with optimizations enabled) */
563 frame_pointer_address = NULL; /* FIXME : implement other cases (with optimizations enabled) */
571 frame_pointer_address = NULL; /* FIXME : implement other cases (with optimizations enabled)*/
578 xbt_dynar_foreach(frame->variables, cursor, current_variable){
580 if((long)ip > (long)start_text_libsimgrid)
585 local_variable_t new_var = xbt_new0(s_local_variable_t, 1);
586 new_var->frame = xbt_strdup(frame_name);
587 new_var->ip = (unsigned long)ip;
588 new_var->name = xbt_strdup(current_variable->name);
589 new_var->type = strdup(current_variable->type_origin);
590 new_var->region= region_type;
592 if(current_variable->address.location != NULL){
593 switch(current_variable->address.location->type){
595 if(xbt_dynar_length(current_variable->address.location->location.compose) > 1){
596 /* TODO : location list with optimizations enabled */
598 location_entry = xbt_dynar_get_as(current_variable->address.location->location.compose, 0, dw_location_t);
600 switch(location_entry->type){
602 unw_get_reg(&c, location_entry->location.reg, &res);
605 case e_dw_bregister_op:
606 unw_get_reg(&c, location_entry->location.breg_op.reg, &res);
607 value = (long)res + location_entry->location.breg_op.offset;
609 case e_dw_fbregister_op:
610 if(frame_pointer_address != NULL)
611 value = (long)((char *)frame_pointer_address + location_entry->location.fbreg_op);
616 value = 0; /* FIXME : implement other cases (with optimizations enabled)*/
621 new_var->address = (void *)value;
623 new_var->address = NULL;
631 xbt_dynar_push(variables, &new_var);
644 static void *MC_get_stack_pointer(void *stack_context, void *heap){
650 ret = unw_init_local(&c, (unw_context_t *)stack_context);
652 XBT_INFO("unw_init_local failed");
656 unw_get_reg(&c, UNW_REG_SP, &sp);
658 return ((char *)heap + (size_t)(((char *)((long)sp) - (char*)std_heap)));
662 static xbt_dynar_t MC_take_snapshot_stacks(mc_snapshot_t *snapshot, void *heap){
664 xbt_dynar_t res = xbt_dynar_new(sizeof(s_mc_snapshot_stack_t), MC_snapshot_stack_free_voidp);
666 unsigned int cursor = 0;
667 stack_region_t current_stack;
669 xbt_dynar_foreach(stacks_areas, cursor, current_stack){
670 mc_snapshot_stack_t st = xbt_new(s_mc_snapshot_stack_t, 1);
671 st->local_variables = MC_get_local_variables_values(current_stack->context);
672 st->stack_pointer = MC_get_stack_pointer(current_stack->context, heap);
673 st->real_address = current_stack->address;
674 xbt_dynar_push(res, &st);
675 (*snapshot)->stack_sizes = xbt_realloc((*snapshot)->stack_sizes, (cursor + 1) * sizeof(size_t));
676 (*snapshot)->stack_sizes[cursor] = current_stack->size - ((char *)st->stack_pointer - (char *)((char *)heap + ((char *)current_stack->address - (char *)std_heap)));
683 static xbt_dynar_t MC_take_snapshot_ignore(){
685 if(mc_heap_comparison_ignore == NULL)
688 xbt_dynar_t cpy = xbt_dynar_new(sizeof(mc_heap_ignore_region_t), heap_ignore_region_free_voidp);
690 unsigned int cursor = 0;
691 mc_heap_ignore_region_t current_region;
693 xbt_dynar_foreach(mc_heap_comparison_ignore, cursor, current_region){
694 mc_heap_ignore_region_t new_region = NULL;
695 new_region = xbt_new0(s_mc_heap_ignore_region_t, 1);
696 new_region->address = current_region->address;
697 new_region->size = current_region->size;
698 new_region->block = current_region->block;
699 new_region->fragment = current_region->fragment;
700 xbt_dynar_push(cpy, &new_region);
707 static void MC_dump_checkpoint_ignore(mc_snapshot_t snapshot){
709 unsigned int cursor = 0;
710 mc_checkpoint_ignore_region_t region;
713 xbt_dynar_foreach(mc_checkpoint_ignore, cursor, region){
714 if(region->addr > snapshot->regions[0]->start_addr && (char *)(region->addr) < (char *)snapshot->regions[0]->start_addr + STD_HEAP_SIZE){
715 offset = (char *)region->addr - (char *)snapshot->regions[0]->start_addr;
716 memset((char *)snapshot->regions[0]->data + offset, 0, region->size);
717 }else if(region->addr > snapshot->regions[2]->start_addr && (char *)(region->addr) < (char*)snapshot->regions[2]->start_addr + snapshot->regions[2]->size){
718 offset = (char *)region->addr - (char *)snapshot->regions[2]->start_addr;
719 memset((char *)snapshot->regions[2]->data + offset, 0, region->size);
720 }else if(region->addr > snapshot->regions[1]->start_addr && (char *)(region->addr) < (char*)snapshot->regions[1]->start_addr + snapshot->regions[1]->size){
721 offset = (char *)region->addr - (char *)snapshot->regions[1]->start_addr;
722 memset((char *)snapshot->regions[1]->data + offset, 0, region->size);
729 mc_snapshot_t MC_take_snapshot(int num_state){
731 mc_snapshot_t snapshot = xbt_new0(s_mc_snapshot_t, 1);
732 snapshot->nb_processes = xbt_swag_size(simix_global->process_list);
734 /* Save the std heap and the writable mapped pages of libsimgrid and binary */
735 MC_get_memory_regions(snapshot);
737 snapshot->to_ignore = MC_take_snapshot_ignore();
739 if(_sg_mc_visited > 0 || strcmp(_sg_mc_property_file,"")){
740 snapshot->stacks = MC_take_snapshot_stacks(&snapshot, snapshot->regions[0]->data);
741 //MC_get_hash_global(snapshot->hash_global, snapshot->regions[1]->data, snapshot->regions[2]->data);
742 //MC_get_hash_local(snapshot->hash_local, snapshot->stacks);
746 MC_dump_checkpoint_ignore(snapshot);
752 void MC_restore_snapshot(mc_snapshot_t snapshot){
754 for(i=0; i < NB_REGIONS; i++){
755 MC_region_restore(snapshot->regions[i]);
760 mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall){
761 return MC_take_snapshot(1);
764 void *MC_snapshot(void){
765 return simcall_mc_snapshot();