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' && lfields[5] == NULL){
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 void MC_init_memory_map_info(){
213 memory_map_t maps = MC_get_memory_map();
215 while (i < maps->mapsize) {
216 reg = maps->regions[i];
217 if ((reg.prot & PROT_WRITE)){
218 if (maps->regions[i].pathname != NULL){
219 if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
220 start_data_libsimgrid = reg.start_addr;
222 reg = maps->regions[i];
223 if(reg.pathname == NULL && (reg.prot & PROT_WRITE) && i < maps->mapsize)
224 start_bss_libsimgrid = reg.start_addr;
225 }else if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
226 start_data_binary = reg.start_addr;
228 reg = maps->regions[i];
229 if(reg.pathname == NULL && (reg.prot & PROT_WRITE) && reg.start_addr != std_heap && reg.start_addr != raw_heap && i < maps->mapsize){
230 start_bss_binary = reg.start_addr;
233 }else if(!memcmp(maps->regions[i].pathname, "[stack]", 7)){
234 maestro_stack_start = reg.start_addr;
235 maestro_stack_end = reg.end_addr;
239 }else if ((reg.prot & PROT_READ) && (reg.prot & PROT_EXEC)){
240 if (maps->regions[i].pathname != NULL){
241 if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
242 start_text_libsimgrid = reg.start_addr;
243 libsimgrid_path = strdup(maps->regions[i].pathname);
244 }else if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
245 start_text_binary = reg.start_addr;
252 MC_free_memory_map(maps);
256 void MC_get_libsimgrid_plt_section(){
259 char *line = NULL; /* Temporal storage for each line that is readed */
260 ssize_t read; /* Number of bytes readed */
261 size_t n = 0; /* Amount of bytes to read by xbt_getline */
264 int i, plt_found = 0;
265 unsigned long int size, offset;
267 char *command = bprintf("objdump --section-headers %s", libsimgrid_path);
269 fp = popen(command, "r");
272 perror("popen failed");
276 while ((read = xbt_getline(&line, &n, fp)) != -1 && plt_found != 2) {
281 /* Wipeout the new line character */
282 line[read - 1] = '\0';
284 lfields[0] = strtok(line, " ");
286 if(lfields[0] == NULL)
289 if(strcmp(lfields[0], "Sections:") == 0 || strcmp(lfields[0], "Idx") == 0 || strncmp(lfields[0], libsimgrid_path, strlen(libsimgrid_path)) == 0)
292 for (i = 1; i < 7 && lfields[i - 1] != NULL; i++) {
293 lfields[i] = strtok(NULL, " ");
297 if(strcmp(lfields[1], ".plt") == 0){
298 size = strtoul(lfields[2], NULL, 16);
299 offset = strtoul(lfields[5], NULL, 16);
300 start_plt_libsimgrid = (char *)start_text_libsimgrid + offset;
301 end_plt_libsimgrid = (char *)start_plt_libsimgrid + size;
303 }else if(strcmp(lfields[1], ".got.plt") == 0){
304 size = strtoul(lfields[2], NULL, 16);
305 offset = strtoul(lfields[5], NULL, 16);
306 start_got_plt_libsimgrid = (char *)start_text_libsimgrid + offset;
307 end_got_plt_libsimgrid = (char *)start_got_plt_libsimgrid + size;
321 void MC_get_binary_plt_section(){
324 char *line = NULL; /* Temporal storage for each line that is readed */
325 ssize_t read; /* Number of bytes readed */
326 size_t n = 0; /* Amount of bytes to read by xbt_getline */
329 int i, plt_found = 0;
330 unsigned long int size;
332 char *command = bprintf( "objdump --section-headers %s", xbt_binary_name);
334 fp = popen(command, "r");
337 perror("popen failed");
341 while ((read = xbt_getline(&line, &n, fp)) != -1 && plt_found != 2) {
346 /* Wipeout the new line character */
347 line[read - 1] = '\0';
349 lfields[0] = strtok(line, " ");
351 if(lfields[0] == NULL)
354 if(strcmp(lfields[0], "Sections:") == 0 || strcmp(lfields[0], "Idx") == 0 || strncmp(lfields[0], basename(xbt_binary_name), strlen(xbt_binary_name)) == 0)
357 for (i = 1; i < 7 && lfields[i - 1] != NULL; i++) {
358 lfields[i] = strtok(NULL, " ");
362 if(strcmp(lfields[1], ".plt") == 0){
363 size = strtoul(lfields[2], NULL, 16);
364 start_plt_binary = (void *)strtoul(lfields[3], NULL, 16);
365 end_plt_binary = (char *)start_plt_binary + size;
367 }else if(strcmp(lfields[1], ".got.plt") == 0){
368 size = strtoul(lfields[2], NULL, 16);
369 start_got_plt_binary = (char *)strtoul(lfields[3], NULL, 16);
370 end_got_plt_binary = (char *)start_got_plt_binary + size;
384 /************************************* Take Snapshot ************************************/
385 /****************************************************************************************/
387 static void MC_get_hash_global(char *snapshot_hash, void *data1, void *data2){
389 /* unsigned int cursor = 0; */
391 /* global_variable_t current_var; */
392 /* void *addr_pointed = NULL; */
393 /* void *res = NULL; */
395 /* xbt_strbuff_t clear = xbt_strbuff_new(); */
397 /* xbt_dynar_foreach(mc_global_variables, cursor, current_var){ */
398 /* if(current_var->address < start_data_libsimgrid){ /\* binary *\/ */
399 /* offset = (char *)current_var->address - (char *)start_data_binary; */
400 /* addr_pointed = *((void **)((char *)data2 + offset)); */
401 /* if(((addr_pointed >= start_plt_binary && addr_pointed <= end_plt_binary)) || ((addr_pointed >= std_heap && (char *)addr_pointed <= (char *)std_heap + STD_HEAP_SIZE ))) */
403 /* res = xbt_malloc0(current_var->size + 1); */
404 /* memset(res, 0, current_var->size + 1); */
405 /* memcpy(res, (char*)data2 + offset, current_var->size); */
406 /* }else{ /\* libsimgrid *\/ */
407 /* offset = (char *)current_var->address - (char *)start_data_libsimgrid; */
408 /* addr_pointed = *((void **)((char *)data1 + offset)); */
409 /* if((addr_pointed >= start_plt_libsimgrid && addr_pointed <= end_plt_libsimgrid) || (addr_pointed >= std_heap && (char *)addr_pointed <= (char *)std_heap + STD_HEAP_SIZE )) */
411 /* res = xbt_malloc0(current_var->size + 1); */
412 /* memset(res, 0, current_var->size + 1); */
413 /* memcpy(res, (char*)data1 + offset, current_var->size); */
415 /* if(res != NULL){ */
416 /* xbt_strbuff_append(clear, (const char*)res); */
422 /* xbt_sha(clear->data, snapshot_hash); */
424 /* xbt_strbuff_free(clear); */
428 static void MC_get_hash_local(char *snapshot_hash, xbt_dynar_t stacks){
430 /* xbt_dynar_t tokens = NULL, s_tokens = NULL; */
431 /* unsigned int cursor1 = 0, cursor2 = 0; */
432 /* mc_snapshot_stack_t current_stack; */
433 /* char *frame_name = NULL; */
436 /* xbt_strbuff_t clear = xbt_strbuff_new(); */
438 /* while(cursor1 < xbt_dynar_length(stacks)){ */
439 /* current_stack = xbt_dynar_get_as(stacks, cursor1, mc_snapshot_stack_t); */
440 /* tokens = xbt_str_split(current_stack->local_variables->data, NULL); */
442 /* while(cursor2 < xbt_dynar_length(tokens)){ */
443 /* s_tokens = xbt_str_split(xbt_dynar_get_as(tokens, cursor2, char *), "="); */
444 /* if(xbt_dynar_length(s_tokens) > 1){ */
445 /* if(strcmp(xbt_dynar_get_as(s_tokens, 0, char *), "frame_name") == 0){ */
446 /* xbt_free(frame_name); */
447 /* frame_name = xbt_strdup(xbt_dynar_get_as(s_tokens, 1, char *)); */
448 /* xbt_strbuff_append(clear, (const char*)xbt_dynar_get_as(tokens, cursor2, char *)); */
450 /* xbt_dynar_free(&s_tokens); */
453 /* addr = (void *) strtoul(xbt_dynar_get_as(s_tokens, 1, char *), NULL, 16); */
454 /* if(addr > std_heap && (char *)addr <= (char *)std_heap + STD_HEAP_SIZE){ */
456 /* xbt_dynar_free(&s_tokens); */
459 /* if(is_stack_ignore_variable(frame_name, xbt_dynar_get_as(s_tokens, 0, char *))){ */
461 /* xbt_dynar_free(&s_tokens); */
464 /* xbt_strbuff_append(clear, (const char *)xbt_dynar_get_as(tokens, cursor2, char *)); */
466 /* xbt_dynar_free(&s_tokens); */
469 /* xbt_dynar_free(&tokens); */
473 /* xbt_free(frame_name); */
475 /* xbt_sha(clear->data, snapshot_hash); */
477 /* xbt_strbuff_free(clear); */
481 static xbt_dynar_t MC_get_local_variables_values(void *stack_context){
486 char frame_name[256];
488 ret = unw_init_local(&c, (unw_context_t *)stack_context);
490 XBT_INFO("unw_init_local failed");
494 unw_word_t ip, sp, off;
497 unsigned int cursor = 0;
498 dw_variable_t current_variable;
499 dw_location_entry_t entry = NULL;
500 dw_location_t location_entry = NULL;
502 int frame_found = 0, region_type;
503 void *frame_pointer_address = NULL;
507 xbt_dynar_t variables = xbt_dynar_new(sizeof(local_variable_t), local_variable_free_voidp);
509 while(ret >= 0 && !stop){
511 unw_get_reg(&c, UNW_REG_IP, &ip);
512 unw_get_reg(&c, UNW_REG_SP, &sp);
514 unw_get_proc_name(&c, frame_name, sizeof (frame_name), &off);
516 if(!strcmp(frame_name, "smx_ctx_sysv_wrapper")) /* Stop before context switch with maestro */
519 if((long)ip > (long)start_text_libsimgrid)
520 frame = xbt_dict_get_or_null(mc_local_variables_libsimgrid, frame_name);
522 frame = xbt_dict_get_or_null(mc_local_variables_binary, frame_name);
529 true_ip = (long)frame->low_pc + (long)off;
530 frame_pointer_address = NULL;
532 /* Get frame pointer */
533 switch(frame->frame_base->type){
536 while(cursor < xbt_dynar_length(frame->frame_base->location.loclist) && !frame_found){
537 entry = xbt_dynar_get_as(frame->frame_base->location.loclist, cursor, dw_location_entry_t);
538 if((true_ip >= entry->lowpc) && (true_ip < entry->highpc)){
540 switch(entry->location->type){
542 if(xbt_dynar_length(entry->location->location.compose) > 1){
543 frame_pointer_address = NULL; /* TODO : location list with optimizations enabled */
545 location_entry = xbt_dynar_get_as(entry->location->location.compose, 0, dw_location_t);
546 switch(location_entry->type){
548 unw_get_reg(&c, location_entry->location.reg, &res);
549 frame_pointer_address = (void*)(long)res;
551 case e_dw_bregister_op:
552 unw_get_reg(&c, location_entry->location.breg_op.reg, &res);
553 frame_pointer_address = (void*)((long)res + location_entry->location.breg_op.offset);
556 frame_pointer_address = NULL; /* FIXME : implement other cases (with optimizations enabled) */
562 frame_pointer_address = NULL; /* FIXME : implement other cases (with optimizations enabled) */
570 frame_pointer_address = NULL; /* FIXME : implement other cases (with optimizations enabled)*/
577 xbt_dynar_foreach(frame->variables, cursor, current_variable){
579 if((long)ip > (long)start_text_libsimgrid)
584 local_variable_t new_var = xbt_new0(s_local_variable_t, 1);
585 new_var->frame = xbt_strdup(frame_name);
586 new_var->ip = (unsigned long)ip;
587 new_var->name = xbt_strdup(current_variable->name);
588 new_var->type = strdup(current_variable->type_origin);
589 new_var->region= region_type;
591 if(current_variable->address.location != NULL){
592 switch(current_variable->address.location->type){
594 if(xbt_dynar_length(current_variable->address.location->location.compose) > 1){
595 /* TODO : location list with optimizations enabled */
597 location_entry = xbt_dynar_get_as(current_variable->address.location->location.compose, 0, dw_location_t);
599 switch(location_entry->type){
601 unw_get_reg(&c, location_entry->location.reg, &res);
604 case e_dw_bregister_op:
605 unw_get_reg(&c, location_entry->location.breg_op.reg, &res);
606 value = (long)res + location_entry->location.breg_op.offset;
608 case e_dw_fbregister_op:
609 if(frame_pointer_address != NULL)
610 value = (long)((char *)frame_pointer_address + location_entry->location.fbreg_op);
615 value = 0; /* FIXME : implement other cases (with optimizations enabled)*/
620 new_var->address = (void *)value;
622 new_var->address = NULL;
630 xbt_dynar_push(variables, &new_var);
643 static void *MC_get_stack_pointer(void *stack_context, void *heap){
649 ret = unw_init_local(&c, (unw_context_t *)stack_context);
651 XBT_INFO("unw_init_local failed");
655 unw_get_reg(&c, UNW_REG_SP, &sp);
657 return ((char *)heap + (size_t)(((char *)((long)sp) - (char*)std_heap)));
661 static xbt_dynar_t MC_take_snapshot_stacks(mc_snapshot_t *snapshot, void *heap){
663 xbt_dynar_t res = xbt_dynar_new(sizeof(s_mc_snapshot_stack_t), MC_snapshot_stack_free_voidp);
665 unsigned int cursor = 0;
666 stack_region_t current_stack;
668 xbt_dynar_foreach(stacks_areas, cursor, current_stack){
669 mc_snapshot_stack_t st = xbt_new(s_mc_snapshot_stack_t, 1);
670 st->local_variables = MC_get_local_variables_values(current_stack->context);
671 st->stack_pointer = MC_get_stack_pointer(current_stack->context, heap);
672 st->real_address = current_stack->address;
673 xbt_dynar_push(res, &st);
674 (*snapshot)->stack_sizes = xbt_realloc((*snapshot)->stack_sizes, (cursor + 1) * sizeof(size_t));
675 (*snapshot)->stack_sizes[cursor] = current_stack->size - ((char *)st->stack_pointer - (char *)((char *)heap + ((char *)current_stack->address - (char *)std_heap)));
682 static xbt_dynar_t MC_take_snapshot_ignore(){
684 if(mc_heap_comparison_ignore == NULL)
687 xbt_dynar_t cpy = xbt_dynar_new(sizeof(mc_heap_ignore_region_t), heap_ignore_region_free_voidp);
689 unsigned int cursor = 0;
690 mc_heap_ignore_region_t current_region;
692 xbt_dynar_foreach(mc_heap_comparison_ignore, cursor, current_region){
693 mc_heap_ignore_region_t new_region = NULL;
694 new_region = xbt_new0(s_mc_heap_ignore_region_t, 1);
695 new_region->address = current_region->address;
696 new_region->size = current_region->size;
697 new_region->block = current_region->block;
698 new_region->fragment = current_region->fragment;
699 xbt_dynar_push(cpy, &new_region);
706 static void MC_dump_checkpoint_ignore(mc_snapshot_t snapshot){
708 unsigned int cursor = 0;
709 mc_checkpoint_ignore_region_t region;
712 xbt_dynar_foreach(mc_checkpoint_ignore, cursor, region){
713 if(region->addr > snapshot->regions[0]->start_addr && (char *)(region->addr) < (char *)snapshot->regions[0]->start_addr + STD_HEAP_SIZE){
714 offset = (char *)region->addr - (char *)snapshot->regions[0]->start_addr;
715 memset((char *)snapshot->regions[0]->data + offset, 0, region->size);
716 }else if(region->addr > snapshot->regions[2]->start_addr && (char *)(region->addr) < (char*)snapshot->regions[2]->start_addr + snapshot->regions[2]->size){
717 offset = (char *)region->addr - (char *)snapshot->regions[2]->start_addr;
718 memset((char *)snapshot->regions[2]->data + offset, 0, region->size);
719 }else if(region->addr > snapshot->regions[1]->start_addr && (char *)(region->addr) < (char*)snapshot->regions[1]->start_addr + snapshot->regions[1]->size){
720 offset = (char *)region->addr - (char *)snapshot->regions[1]->start_addr;
721 memset((char *)snapshot->regions[1]->data + offset, 0, region->size);
728 mc_snapshot_t MC_take_snapshot(int num_state){
730 mc_snapshot_t snapshot = xbt_new0(s_mc_snapshot_t, 1);
731 snapshot->nb_processes = xbt_swag_size(simix_global->process_list);
733 /* Save the std heap and the writable mapped pages of libsimgrid and binary */
734 MC_get_memory_regions(snapshot);
736 snapshot->to_ignore = MC_take_snapshot_ignore();
738 if(_sg_mc_visited > 0 || strcmp(_sg_mc_property_file,"")){
739 snapshot->stacks = MC_take_snapshot_stacks(&snapshot, snapshot->regions[0]->data);
740 //MC_get_hash_global(snapshot->hash_global, snapshot->regions[1]->data, snapshot->regions[2]->data);
741 //MC_get_hash_local(snapshot->hash_local, snapshot->stacks);
745 MC_dump_checkpoint_ignore(snapshot);
751 void MC_restore_snapshot(mc_snapshot_t snapshot){
753 for(i=0; i < NB_REGIONS; i++){
754 MC_region_restore(snapshot->regions[i]);
759 mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall){
760 return MC_take_snapshot(1);
763 void *MC_snapshot(void){
764 return simcall_mc_snapshot();