1 /* Copyright (c) 2008-2013 Da SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "mc_private.h"
8 #include "xbt/module.h"
10 #include "../simix/smx_private.h"
12 #include <libunwind.h>
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_checkpoint, mc,
15 "Logging specific to mc_checkpoint");
17 void *start_text_libsimgrid;
18 void *start_plt_libsimgrid, *end_plt_libsimgrid;
19 void *start_got_plt_libsimgrid, *end_got_plt_libsimgrid;
20 void *start_plt_binary, *end_plt_binary;
21 void *start_got_plt_binary, *end_got_plt_binary;
22 char *libsimgrid_path;
23 void *start_data_libsimgrid, *start_bss_libsimgrid;
24 void *start_data_binary, *start_bss_binary;
25 void *start_text_binary;
27 /************************************ Free functions **************************************/
28 /*****************************************************************************************/
30 static void MC_snapshot_stack_free(mc_snapshot_stack_t s){
32 xbt_dynar_free(&(s->local_variables));
37 static void MC_snapshot_stack_free_voidp(void *s){
38 MC_snapshot_stack_free((mc_snapshot_stack_t) * (void **) s);
41 static void local_variable_free(local_variable_t v){
48 static void local_variable_free_voidp(void *v){
49 local_variable_free((local_variable_t) * (void **) v);
52 static void MC_region_destroy(mc_mem_region_t reg)
58 void MC_free_snapshot(mc_snapshot_t snapshot){
60 for(i=0; i < NB_REGIONS; i++)
61 MC_region_destroy(snapshot->regions[i]);
63 xbt_free(snapshot->stack_sizes);
64 xbt_dynar_free(&(snapshot->stacks));
65 xbt_dynar_free(&(snapshot->to_ignore));
70 /******************************* Snapshot regions ********************************/
71 /*********************************************************************************/
73 static mc_mem_region_t MC_region_new(int type, void *start_addr, size_t size)
75 mc_mem_region_t new_reg = xbt_new0(s_mc_mem_region_t, 1);
76 new_reg->start_addr = start_addr;
78 new_reg->data = xbt_malloc0(size);
79 memcpy(new_reg->data, start_addr, size);
81 XBT_DEBUG("New region : type : %d, data : %p (real addr %p), size : %zu", type, new_reg->data, start_addr, size);
86 static void MC_region_restore(mc_mem_region_t reg)
88 /*FIXME: check if start_addr is still mapped, if it is not, then map it
89 before copying the data */
91 memcpy(reg->start_addr, reg->data, reg->size);
95 static void MC_snapshot_add_region(mc_snapshot_t snapshot, int type, void *start_addr, size_t size)
97 mc_mem_region_t new_reg = MC_region_new(type, start_addr, size);
98 snapshot->regions[type] = new_reg;
102 static void MC_get_memory_regions(mc_snapshot_t snapshot){
109 char *lfields[6] = {0}, *tok;
110 void *start_addr, *start_addr1, *end_addr;
114 fp = fopen("/proc/self/maps", "r");
117 "Cannot open /proc/self/maps to investigate the memory map of the process. Please report this bug.");
121 while((read = xbt_getline(&line, &n, fp)) != -1){
123 /* Wipeout the new line character */
124 line[read - 1] = '\0';
126 /* Tokenize the line using spaces as delimiters and store each token */
127 lfields[0] = strtok(line, " ");
129 for (i = 1; i < 6 && lfields[i - 1] != NULL; i++) {
130 lfields[i] = strtok(NULL, " ");
133 /* First get the permissions flags, need write permission */
134 if(lfields[1][1] == 'w'){
136 /* Get the start address of the map */
137 tok = strtok(lfields[0], "-");
138 start_addr = (void *)strtoul(tok, NULL, 16);
140 if(start_addr == std_heap){ /* Std_heap ? */
141 tok = strtok(NULL, "-");
142 end_addr = (void *)strtoul(tok, NULL, 16);
143 MC_snapshot_add_region(snapshot, 0, start_addr, (char*)end_addr - (char*)start_addr);
144 snapshot->heap_bytes_used = mmalloc_get_bytes_used(std_heap);
145 }else{ /* map name == libsimgrid || binary_name ? */
146 if(lfields[5] != NULL){
147 if(!memcmp(basename(lfields[5]), "libsimgrid", 10)){
148 tok = strtok(NULL, "-");
149 end_addr = (void *)strtoul(tok, NULL, 16);
150 size = (char*)end_addr - (char*)start_addr;
151 /* BSS and data segments may be separated according to the OS */
152 if((read = xbt_getline(&line, &n, fp)) != -1){
153 line[read - 1] = '\0';
154 lfields[0] = strtok(line, " ");
155 for (i = 1; i < 6 && lfields[i - 1] != NULL; i++) {
156 lfields[i] = strtok(NULL, " ");
158 if(lfields[1][1] == 'w' && lfields[5] == NULL){
159 tok = strtok(lfields[0], "-");
160 start_addr1 = (void *)strtoul(tok, NULL, 16);
161 tok = strtok(NULL, "-");
162 size += (char *)(void *)strtoul(tok, NULL, 16) - (char*)start_addr1;
165 MC_snapshot_add_region(snapshot, 1, start_addr, size);
166 }else if(!memcmp(basename(lfields[5]), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
167 tok = strtok(NULL, "-");
168 end_addr = (void *)strtoul(tok, NULL, 16);
169 size = (char*)end_addr - (char*)start_addr;
170 /* BSS and data segments may be separated according to the OS */
171 if((read = xbt_getline(&line, &n, fp)) != -1){
172 line[read - 1] = '\0';
173 lfields[0] = strtok(line, " ");
174 for (i = 1; i < 6 && lfields[i - 1] != NULL; i++) {
175 lfields[i] = strtok(NULL, " ");
177 tok = strtok(lfields[0], "-");
178 start_addr1 = (void *)strtoul(tok, NULL, 16);
179 if(lfields[1][1] == 'w' && lfields[5] == NULL){
180 if(start_addr1 == std_heap){ /* Std_heap ? */
181 tok = strtok(NULL, "-");
182 end_addr = (void *)strtoul(tok, NULL, 16);
183 MC_snapshot_add_region(snapshot, 0, start_addr1, (char*)end_addr - (char*)start_addr1);
184 snapshot->heap_bytes_used = mmalloc_get_bytes_used(std_heap);
185 }else if(start_addr1 != raw_heap){
186 tok = strtok(NULL, "-");
187 size += (char *)(void *)strtoul(tok, NULL, 16) - (char *)start_addr1;
191 MC_snapshot_add_region(snapshot, 2, start_addr, size);
192 }else if (!memcmp(lfields[5], "[stack]", 7)){
193 maestro_stack_start = start_addr;
194 tok = strtok(NULL, "-");
195 maestro_stack_end = (void *)strtoul(tok, NULL, 16);
208 void MC_init_memory_map_info(){
212 memory_map_t maps = MC_get_memory_map();
214 while (i < maps->mapsize) {
215 reg = maps->regions[i];
216 if ((reg.prot & PROT_WRITE)){
217 if (maps->regions[i].pathname != NULL){
218 if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
219 start_data_libsimgrid = reg.start_addr;
221 reg = maps->regions[i];
222 if(reg.pathname == NULL && (reg.prot & PROT_WRITE) && i < maps->mapsize)
223 start_bss_libsimgrid = reg.start_addr;
224 }else if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
225 start_data_binary = reg.start_addr;
227 reg = maps->regions[i];
228 if(reg.pathname == NULL && (reg.prot & PROT_WRITE) && reg.start_addr != std_heap && reg.start_addr != raw_heap && i < maps->mapsize){
229 start_bss_binary = reg.start_addr;
232 }else if(!memcmp(maps->regions[i].pathname, "[stack]", 7)){
233 maestro_stack_start = reg.start_addr;
234 maestro_stack_end = reg.end_addr;
238 }else if ((reg.prot & PROT_READ) && (reg.prot & PROT_EXEC)){
239 if (maps->regions[i].pathname != NULL){
240 if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){
241 start_text_libsimgrid = reg.start_addr;
242 libsimgrid_path = strdup(maps->regions[i].pathname);
243 }else if (!memcmp(basename(maps->regions[i].pathname), basename(xbt_binary_name), strlen(basename(xbt_binary_name)))){
244 start_text_binary = reg.start_addr;
251 MC_free_memory_map(maps);
255 void MC_get_libsimgrid_plt_section(){
258 char *line = NULL; /* Temporal storage for each line that is readed */
259 ssize_t read; /* Number of bytes readed */
260 size_t n = 0; /* Amount of bytes to read by xbt_getline */
263 int i, plt_found = 0;
264 unsigned long int size, offset;
266 char *command = bprintf("objdump --section-headers %s", libsimgrid_path);
268 fp = popen(command, "r");
271 perror("popen failed");
275 while ((read = xbt_getline(&line, &n, fp)) != -1 && plt_found != 2) {
280 /* Wipeout the new line character */
281 line[read - 1] = '\0';
283 lfields[0] = strtok(line, " ");
285 if(lfields[0] == NULL)
288 if(strcmp(lfields[0], "Sections:") == 0 || strcmp(lfields[0], "Idx") == 0 || strncmp(lfields[0], libsimgrid_path, strlen(libsimgrid_path)) == 0)
291 for (i = 1; i < 7 && lfields[i - 1] != NULL; i++) {
292 lfields[i] = strtok(NULL, " ");
296 if(strcmp(lfields[1], ".plt") == 0){
297 size = strtoul(lfields[2], NULL, 16);
298 offset = strtoul(lfields[5], NULL, 16);
299 start_plt_libsimgrid = (char *)start_text_libsimgrid + offset;
300 end_plt_libsimgrid = (char *)start_plt_libsimgrid + size;
302 }else if(strcmp(lfields[1], ".got.plt") == 0){
303 size = strtoul(lfields[2], NULL, 16);
304 offset = strtoul(lfields[5], NULL, 16);
305 start_got_plt_libsimgrid = (char *)start_text_libsimgrid + offset;
306 end_got_plt_libsimgrid = (char *)start_got_plt_libsimgrid + size;
320 void MC_get_binary_plt_section(){
323 char *line = NULL; /* Temporal storage for each line that is readed */
324 ssize_t read; /* Number of bytes readed */
325 size_t n = 0; /* Amount of bytes to read by xbt_getline */
328 int i, plt_found = 0;
329 unsigned long int size;
331 char *command = bprintf( "objdump --section-headers %s", xbt_binary_name);
333 fp = popen(command, "r");
336 perror("popen failed");
340 while ((read = xbt_getline(&line, &n, fp)) != -1 && plt_found != 2) {
345 /* Wipeout the new line character */
346 line[read - 1] = '\0';
348 lfields[0] = strtok(line, " ");
350 if(lfields[0] == NULL)
353 if(strcmp(lfields[0], "Sections:") == 0 || strcmp(lfields[0], "Idx") == 0 || strncmp(lfields[0], basename(xbt_binary_name), strlen(xbt_binary_name)) == 0)
356 for (i = 1; i < 7 && lfields[i - 1] != NULL; i++) {
357 lfields[i] = strtok(NULL, " ");
361 if(strcmp(lfields[1], ".plt") == 0){
362 size = strtoul(lfields[2], NULL, 16);
363 start_plt_binary = (void *)strtoul(lfields[3], NULL, 16);
364 end_plt_binary = (char *)start_plt_binary + size;
366 }else if(strcmp(lfields[1], ".got.plt") == 0){
367 size = strtoul(lfields[2], NULL, 16);
368 start_got_plt_binary = (char *)strtoul(lfields[3], NULL, 16);
369 end_got_plt_binary = (char *)start_got_plt_binary + size;
383 /************************************* Take Snapshot ************************************/
384 /****************************************************************************************/
386 static void MC_get_hash_global(char *snapshot_hash, void *data1, void *data2){
388 /* unsigned int cursor = 0; */
390 /* global_variable_t current_var; */
391 /* void *addr_pointed = NULL; */
392 /* void *res = NULL; */
394 /* xbt_strbuff_t clear = xbt_strbuff_new(); */
396 /* xbt_dynar_foreach(mc_global_variables, cursor, current_var){ */
397 /* if(current_var->address < start_data_libsimgrid){ /\* binary *\/ */
398 /* offset = (char *)current_var->address - (char *)start_data_binary; */
399 /* addr_pointed = *((void **)((char *)data2 + offset)); */
400 /* if(((addr_pointed >= start_plt_binary && addr_pointed <= end_plt_binary)) || ((addr_pointed >= std_heap && (char *)addr_pointed <= (char *)std_heap + STD_HEAP_SIZE ))) */
402 /* res = xbt_malloc0(current_var->size + 1); */
403 /* memset(res, 0, current_var->size + 1); */
404 /* memcpy(res, (char*)data2 + offset, current_var->size); */
405 /* }else{ /\* libsimgrid *\/ */
406 /* offset = (char *)current_var->address - (char *)start_data_libsimgrid; */
407 /* addr_pointed = *((void **)((char *)data1 + offset)); */
408 /* if((addr_pointed >= start_plt_libsimgrid && addr_pointed <= end_plt_libsimgrid) || (addr_pointed >= std_heap && (char *)addr_pointed <= (char *)std_heap + STD_HEAP_SIZE )) */
410 /* res = xbt_malloc0(current_var->size + 1); */
411 /* memset(res, 0, current_var->size + 1); */
412 /* memcpy(res, (char*)data1 + offset, current_var->size); */
414 /* if(res != NULL){ */
415 /* xbt_strbuff_append(clear, (const char*)res); */
421 /* xbt_sha(clear->data, snapshot_hash); */
423 /* xbt_strbuff_free(clear); */
427 static void MC_get_hash_local(char *snapshot_hash, xbt_dynar_t stacks){
429 /* xbt_dynar_t tokens = NULL, s_tokens = NULL; */
430 /* unsigned int cursor1 = 0, cursor2 = 0; */
431 /* mc_snapshot_stack_t current_stack; */
432 /* char *frame_name = NULL; */
435 /* xbt_strbuff_t clear = xbt_strbuff_new(); */
437 /* while(cursor1 < xbt_dynar_length(stacks)){ */
438 /* current_stack = xbt_dynar_get_as(stacks, cursor1, mc_snapshot_stack_t); */
439 /* tokens = xbt_str_split(current_stack->local_variables->data, NULL); */
441 /* while(cursor2 < xbt_dynar_length(tokens)){ */
442 /* s_tokens = xbt_str_split(xbt_dynar_get_as(tokens, cursor2, char *), "="); */
443 /* if(xbt_dynar_length(s_tokens) > 1){ */
444 /* if(strcmp(xbt_dynar_get_as(s_tokens, 0, char *), "frame_name") == 0){ */
445 /* xbt_free(frame_name); */
446 /* frame_name = xbt_strdup(xbt_dynar_get_as(s_tokens, 1, char *)); */
447 /* xbt_strbuff_append(clear, (const char*)xbt_dynar_get_as(tokens, cursor2, char *)); */
449 /* xbt_dynar_free(&s_tokens); */
452 /* addr = (void *) strtoul(xbt_dynar_get_as(s_tokens, 1, char *), NULL, 16); */
453 /* if(addr > std_heap && (char *)addr <= (char *)std_heap + STD_HEAP_SIZE){ */
455 /* xbt_dynar_free(&s_tokens); */
458 /* if(is_stack_ignore_variable(frame_name, xbt_dynar_get_as(s_tokens, 0, char *))){ */
460 /* xbt_dynar_free(&s_tokens); */
463 /* xbt_strbuff_append(clear, (const char *)xbt_dynar_get_as(tokens, cursor2, char *)); */
465 /* xbt_dynar_free(&s_tokens); */
468 /* xbt_dynar_free(&tokens); */
472 /* xbt_free(frame_name); */
474 /* xbt_sha(clear->data, snapshot_hash); */
476 /* xbt_strbuff_free(clear); */
480 static xbt_dynar_t MC_get_local_variables_values(void *stack_context){
485 char frame_name[256];
487 ret = unw_init_local(&c, (unw_context_t *)stack_context);
489 XBT_INFO("unw_init_local failed");
493 unw_word_t ip, sp, off;
496 unsigned int cursor = 0;
497 dw_variable_t current_variable;
498 dw_location_entry_t entry = NULL;
499 dw_location_t location_entry = NULL;
501 int frame_found = 0, region_type;
502 void *frame_pointer_address = NULL;
506 xbt_dynar_t variables = xbt_dynar_new(sizeof(local_variable_t), local_variable_free_voidp);
508 while(ret >= 0 && !stop){
510 unw_get_reg(&c, UNW_REG_IP, &ip);
511 unw_get_reg(&c, UNW_REG_SP, &sp);
513 unw_get_proc_name(&c, frame_name, sizeof (frame_name), &off);
515 if(!strcmp(frame_name, "smx_ctx_sysv_wrapper")) /* Stop before context switch with maestro */
518 if((long)ip > (long)start_text_libsimgrid)
519 frame = xbt_dict_get_or_null(mc_local_variables_libsimgrid, frame_name);
521 frame = xbt_dict_get_or_null(mc_local_variables_binary, frame_name);
528 true_ip = (long)frame->low_pc + (long)off;
529 frame_pointer_address = NULL;
531 /* Get frame pointer */
532 switch(frame->frame_base->type){
535 while(cursor < xbt_dynar_length(frame->frame_base->location.loclist) && !frame_found){
536 entry = xbt_dynar_get_as(frame->frame_base->location.loclist, cursor, dw_location_entry_t);
537 if((true_ip >= entry->lowpc) && (true_ip < entry->highpc)){
539 switch(entry->location->type){
541 if(xbt_dynar_length(entry->location->location.compose) > 1){
542 frame_pointer_address = NULL; /* TODO : location list with optimizations enabled */
544 location_entry = xbt_dynar_get_as(entry->location->location.compose, 0, dw_location_t);
545 switch(location_entry->type){
547 unw_get_reg(&c, location_entry->location.reg, &res);
548 frame_pointer_address = (void*)(long)res;
550 case e_dw_bregister_op:
551 unw_get_reg(&c, location_entry->location.breg_op.reg, &res);
552 frame_pointer_address = (void*)((long)res + location_entry->location.breg_op.offset);
555 frame_pointer_address = NULL; /* FIXME : implement other cases (with optimizations enabled) */
561 frame_pointer_address = NULL; /* FIXME : implement other cases (with optimizations enabled) */
569 frame_pointer_address = NULL; /* FIXME : implement other cases (with optimizations enabled)*/
576 xbt_dynar_foreach(frame->variables, cursor, current_variable){
578 if((long)ip > (long)start_text_libsimgrid)
583 local_variable_t new_var = xbt_new0(s_local_variable_t, 1);
584 new_var->frame = xbt_strdup(frame_name);
585 new_var->ip = (unsigned long)ip;
586 new_var->name = xbt_strdup(current_variable->name);
587 new_var->type = strdup(current_variable->type_origin);
588 new_var->region= region_type;
590 if(current_variable->address.location != NULL){
591 switch(current_variable->address.location->type){
593 if(xbt_dynar_length(current_variable->address.location->location.compose) > 1){
594 /* TODO : location list with optimizations enabled */
596 location_entry = xbt_dynar_get_as(current_variable->address.location->location.compose, 0, dw_location_t);
598 switch(location_entry->type){
600 unw_get_reg(&c, location_entry->location.reg, &res);
603 case e_dw_bregister_op:
604 unw_get_reg(&c, location_entry->location.breg_op.reg, &res);
605 value = (long)res + location_entry->location.breg_op.offset;
607 case e_dw_fbregister_op:
608 if(frame_pointer_address != NULL)
609 value = (long)((char *)frame_pointer_address + location_entry->location.fbreg_op);
614 value = 0; /* FIXME : implement other cases (with optimizations enabled)*/
619 new_var->address = (void *)value;
621 new_var->address = NULL;
629 xbt_dynar_push(variables, &new_var);
642 static void *MC_get_stack_pointer(void *stack_context, void *heap){
648 ret = unw_init_local(&c, (unw_context_t *)stack_context);
650 XBT_INFO("unw_init_local failed");
654 unw_get_reg(&c, UNW_REG_SP, &sp);
656 return ((char *)heap + (size_t)(((char *)((long)sp) - (char*)std_heap)));
660 static xbt_dynar_t MC_take_snapshot_stacks(mc_snapshot_t *snapshot, void *heap){
662 xbt_dynar_t res = xbt_dynar_new(sizeof(s_mc_snapshot_stack_t), MC_snapshot_stack_free_voidp);
664 unsigned int cursor = 0;
665 stack_region_t current_stack;
667 xbt_dynar_foreach(stacks_areas, cursor, current_stack){
668 mc_snapshot_stack_t st = xbt_new(s_mc_snapshot_stack_t, 1);
669 st->local_variables = MC_get_local_variables_values(current_stack->context);
670 st->stack_pointer = MC_get_stack_pointer(current_stack->context, heap);
671 st->real_address = current_stack->address;
672 xbt_dynar_push(res, &st);
673 (*snapshot)->stack_sizes = xbt_realloc((*snapshot)->stack_sizes, (cursor + 1) * sizeof(size_t));
674 (*snapshot)->stack_sizes[cursor] = current_stack->size - ((char *)st->stack_pointer - (char *)((char *)heap + ((char *)current_stack->address - (char *)std_heap)));
681 static xbt_dynar_t MC_take_snapshot_ignore(){
683 if(mc_heap_comparison_ignore == NULL)
686 xbt_dynar_t cpy = xbt_dynar_new(sizeof(mc_heap_ignore_region_t), heap_ignore_region_free_voidp);
688 unsigned int cursor = 0;
689 mc_heap_ignore_region_t current_region;
691 xbt_dynar_foreach(mc_heap_comparison_ignore, cursor, current_region){
692 mc_heap_ignore_region_t new_region = NULL;
693 new_region = xbt_new0(s_mc_heap_ignore_region_t, 1);
694 new_region->address = current_region->address;
695 new_region->size = current_region->size;
696 new_region->block = current_region->block;
697 new_region->fragment = current_region->fragment;
698 xbt_dynar_push(cpy, &new_region);
705 static void MC_dump_checkpoint_ignore(mc_snapshot_t snapshot){
707 unsigned int cursor = 0;
708 mc_checkpoint_ignore_region_t region;
711 xbt_dynar_foreach(mc_checkpoint_ignore, cursor, region){
712 if(region->addr > snapshot->regions[0]->start_addr && (char *)(region->addr) < (char *)snapshot->regions[0]->start_addr + STD_HEAP_SIZE){
713 offset = (char *)region->addr - (char *)snapshot->regions[0]->start_addr;
714 memset((char *)snapshot->regions[0]->data + offset, 0, region->size);
715 }else if(region->addr > snapshot->regions[2]->start_addr && (char *)(region->addr) < (char*)snapshot->regions[2]->start_addr + snapshot->regions[2]->size){
716 offset = (char *)region->addr - (char *)snapshot->regions[2]->start_addr;
717 memset((char *)snapshot->regions[2]->data + offset, 0, region->size);
718 }else if(region->addr > snapshot->regions[1]->start_addr && (char *)(region->addr) < (char*)snapshot->regions[1]->start_addr + snapshot->regions[1]->size){
719 offset = (char *)region->addr - (char *)snapshot->regions[1]->start_addr;
720 memset((char *)snapshot->regions[1]->data + offset, 0, region->size);
727 mc_snapshot_t MC_take_snapshot(){
729 mc_snapshot_t snapshot = xbt_new0(s_mc_snapshot_t, 1);
730 snapshot->nb_processes = xbt_swag_size(simix_global->process_list);
732 /* Save the std heap and the writable mapped pages of libsimgrid and binary */
733 MC_get_memory_regions(snapshot);
735 snapshot->to_ignore = MC_take_snapshot_ignore();
737 if(_sg_mc_visited > 0 || strcmp(_sg_mc_property_file,"")){
738 snapshot->stacks = MC_take_snapshot_stacks(&snapshot, snapshot->regions[0]->data);
739 //MC_get_hash_global(snapshot->hash_global, snapshot->regions[1]->data, snapshot->regions[2]->data);
740 //MC_get_hash_local(snapshot->hash_local, snapshot->stacks);
743 MC_dump_checkpoint_ignore(snapshot);
749 void MC_restore_snapshot(mc_snapshot_t snapshot){
751 for(i=0; i < NB_REGIONS; i++){
752 MC_region_restore(snapshot->regions[i]);
757 mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall){
758 return MC_take_snapshot();
761 void *MC_snapshot(void){
762 return simcall_mc_snapshot();