Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
f458f72a84af0552e42c2e4ccb8242624ac2c15f
[simgrid.git] / src / mc / mc_checkpoint.cpp
1 /* Copyright (c) 2008-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include <unistd.h>
8
9 #include <string.h>
10 #include <link.h>
11 #include <dirent.h>
12
13 #include "src/internal_config.h"
14 #include "mc_private.h"
15 #include "xbt/module.h"
16 #include <xbt/mmalloc.h>
17 #include "src/smpi/private.h"
18 #include <alloca.h>
19
20 #include "src/xbt/mmalloc/mmprivate.h"
21
22 #include "src/simix/smx_private.h"
23
24 #include <libunwind.h>
25 #include <libelf.h>
26
27 #include "mc_private.h"
28 #include <mc/mc.h>
29
30 #include "mc_snapshot.h"
31 #include "mc_object_info.h"
32 #include "mc_mmu.h"
33 #include "mc_unw.h"
34 #include "mc_protocol.h"
35 #include "mc_smx.h"
36 #include "mc_hash.hpp"
37
38 #include "src/mc/ObjectInformation.hpp"
39 #include "src/mc/Frame.hpp"
40 #include "src/mc/Variable.hpp"
41
42 using simgrid::mc::remote;
43
44 extern "C" {
45
46 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_checkpoint, mc,
47                                 "Logging specific to mc_checkpoint");
48
49 /************************************  Free functions **************************************/
50 /*****************************************************************************************/
51
52 /** @brief Restore a region from a snapshot
53  *
54  *  @param reg     Target region
55  */
56 static void MC_region_restore(mc_mem_region_t region)
57 {
58   switch(region->storage_type()) {
59   case simgrid::mc::StorageType::NoData:
60   default:
61     xbt_die("Storage type not supported");
62     break;
63
64   case simgrid::mc::StorageType::Flat:
65     mc_model_checker->process().write_bytes(region->flat_data(),
66       region->size(), region->permanent_address());
67     break;
68
69   case simgrid::mc::StorageType::Chunked:
70     mc_region_restore_sparse(&mc_model_checker->process(), region);
71     break;
72
73   case simgrid::mc::StorageType::Privatized:
74     for (auto& p : region->privatized_data())
75       MC_region_restore(&p);
76     break;
77   }
78 }
79
80 }
81
82 namespace simgrid {
83 namespace mc {
84
85 #ifdef HAVE_SMPI
86 simgrid::mc::RegionSnapshot privatized_region(
87     RegionType region_type, void *start_addr, void* permanent_addr,
88     std::size_t size, const simgrid::mc::RegionSnapshot* ref_region
89     )
90 {
91   size_t process_count = MC_smpi_process_count();
92
93   // Read smpi_privatisation_regions from MCed:
94   smpi_privatisation_region_t remote_smpi_privatisation_regions;
95   mc_model_checker->process().read_variable(
96     "smpi_privatisation_regions",
97     &remote_smpi_privatisation_regions, sizeof(remote_smpi_privatisation_regions));
98   s_smpi_privatisation_region_t privatisation_regions[process_count];
99   mc_model_checker->process().read_bytes(
100     &privatisation_regions, sizeof(privatisation_regions),
101     remote(remote_smpi_privatisation_regions));
102
103   std::vector<simgrid::mc::RegionSnapshot> data;
104   data.reserve(process_count);
105   for (size_t i = 0; i < process_count; i++) {
106     const simgrid::mc::RegionSnapshot* ref_privatized_region = nullptr;
107     if (ref_region && ref_region->storage_type() == StorageType::Privatized)
108       ref_privatized_region = &ref_region->privatized_data()[i];
109     data.push_back(simgrid::mc::region(region_type, start_addr,
110       privatisation_regions[i].address, size, ref_privatized_region));
111   }
112
113   simgrid::mc::RegionSnapshot region = simgrid::mc::RegionSnapshot(
114     region_type, start_addr, permanent_addr, size);
115   region.privatized_data(std::move(data));
116   return std::move(region);
117 }
118 #endif
119
120 }
121 }
122
123 extern "C" {
124
125 static void MC_snapshot_add_region(int index, mc_snapshot_t snapshot,
126                                   simgrid::mc::RegionType type,
127                                   simgrid::mc::ObjectInformation* object_info,
128                                   void *start_addr, void* permanent_addr,
129                                   std::size_t size)
130 {
131   if (type == simgrid::mc::RegionType::Data)
132     xbt_assert(object_info, "Missing object info for object.");
133   else if (type == simgrid::mc::RegionType::Heap)
134     xbt_assert(!object_info, "Unexpected object info for heap region.");
135
136   simgrid::mc::RegionSnapshot const* ref_region = nullptr;
137   if (mc_model_checker->parent_snapshot_)
138     ref_region = mc_model_checker->parent_snapshot_->snapshot_regions[index].get();
139
140   simgrid::mc::RegionSnapshot region;
141 #ifdef HAVE_SMPI
142   const bool privatization_aware = object_info && object_info->privatized();
143   if (privatization_aware && MC_smpi_process_count())
144     region = simgrid::mc::privatized_region(
145       type, start_addr, permanent_addr, size, ref_region);
146   else
147 #endif
148     region = simgrid::mc::region(type, start_addr, permanent_addr, size, ref_region);
149
150   region.object_info(object_info);
151   snapshot->snapshot_regions[index]
152     = std::unique_ptr<simgrid::mc::RegionSnapshot>(
153       new simgrid::mc::RegionSnapshot(std::move(region)));
154   return;
155 }
156
157 static void MC_get_memory_regions(simgrid::mc::Process* process, mc_snapshot_t snapshot)
158 {
159   const size_t n = process->object_infos.size();
160   snapshot->snapshot_regions.resize(n + 1);
161   int i = 0;
162   for (auto const& object_info : process->object_infos) {
163     MC_snapshot_add_region(i, snapshot, simgrid::mc::RegionType::Data,
164       object_info.get(),
165       object_info->start_rw, object_info->start_rw,
166       object_info->end_rw - object_info->start_rw);
167     ++i;
168   }
169
170   xbt_mheap_t heap = process->get_heap();
171   void *start_heap = heap->base;
172   void *end_heap = heap->breakval;
173
174   MC_snapshot_add_region(n, snapshot, simgrid::mc::RegionType::Heap, NULL,
175                         start_heap, start_heap,
176                         (char *) end_heap - (char *) start_heap);
177   snapshot->heap_bytes_used = mmalloc_get_bytes_used_remote(
178     heap->heaplimit,
179     process->get_malloc_info());
180
181 #ifdef HAVE_SMPI
182   if (smpi_privatize_global_variables && MC_smpi_process_count()) {
183     // snapshot->privatization_index = smpi_loaded_page
184     mc_model_checker->process().read_variable(
185       "smpi_loaded_page", &snapshot->privatization_index,
186       sizeof(snapshot->privatization_index));
187   } else
188 #endif
189   {
190     snapshot->privatization_index = simgrid::mc::ProcessIndexMissing;
191   }
192 }
193
194 /** \brief Fills the position of the segments (executable, read-only, read/write).
195  *
196  *  `dl_iterate_phdr` would be more robust but would not work in cross-process.
197  * */
198 void MC_find_object_address(
199   std::vector<simgrid::xbt::VmMap> const& maps,
200   simgrid::mc::ObjectInformation* result)
201 {
202   char* file_name = xbt_strdup(result->file_name.c_str());
203   const char *name = basename(file_name);
204   for (size_t i = 0; i < maps.size(); ++i) {
205     simgrid::xbt::VmMap const& reg = maps[i];
206     if (maps[i].pathname.empty()
207         || strcmp(basename(maps[i].pathname.c_str()), name)) {
208       // Nothing to do
209     } else if ((reg.prot & PROT_WRITE)) {
210       xbt_assert(!result->start_rw,
211                  "Multiple read-write segments for %s, not supported",
212                  maps[i].pathname.c_str());
213       result->start_rw = (char*) reg.start_addr;
214       result->end_rw = (char*) reg.end_addr;
215       // .bss is usually after the .data:
216       simgrid::xbt::VmMap const& next = maps[i + 1];
217       if (next.pathname.empty() && (next.prot & PROT_WRITE)
218           && next.start_addr == reg.end_addr) {
219         result->end_rw = (char*) maps[i + 1].end_addr;
220       }
221     } else if ((reg.prot & PROT_READ) && (reg.prot & PROT_EXEC)) {
222       xbt_assert(!result->start_exec,
223                  "Multiple executable segments for %s, not supported",
224                  maps[i].pathname.c_str());
225       result->start_exec = (char*) reg.start_addr;
226       result->end_exec = (char*) reg.end_addr;
227     } else if ((reg.prot & PROT_READ) && !(reg.prot & PROT_EXEC)) {
228       xbt_assert(!result->start_ro,
229                  "Multiple read only segments for %s, not supported",
230                  maps[i].pathname.c_str());
231       result->start_ro = (char*) reg.start_addr;
232       result->end_ro = (char*) reg.end_addr;
233     }
234   }
235
236   result->start = result->start_rw;
237   if ((const void*) result->start_ro > result->start)
238     result->start = result->start_ro;
239   if ((const void*) result->start_exec > result->start)
240     result->start = result->start_exec;
241
242   result->end = result->end_rw;
243   if (result->end_ro && (const void*) result->end_ro < result->end)
244     result->end = result->end_ro;
245   if (result->end_exec && (const void*) result->end_exec > result->end)
246     result->end = result->end_exec;
247
248   xbt_assert(result->start_rw);
249   xbt_assert(result->start_exec);
250   free(file_name);
251 }
252
253 /************************************* Take Snapshot ************************************/
254 /****************************************************************************************/
255
256 /** \brief Checks whether the variable is in scope for a given IP.
257  *
258  *  A variable may be defined only from a given value of IP.
259  *
260  *  \param var   Variable description
261  *  \param frame Scope description
262  *  \param ip    Instruction pointer
263  *  \return      true if the variable is valid
264  * */
265 static bool mc_valid_variable(simgrid::mc::Variable* var,
266                               simgrid::mc::Frame* scope,
267                               const void *ip)
268 {
269   // The variable is not yet valid:
270   if ((const void *) ((const char *) scope->low_pc + var->start_scope) > ip)
271     return false;
272   else
273     return true;
274 }
275
276 static void mc_fill_local_variables_values(mc_stack_frame_t stack_frame,
277                                            simgrid::mc::Frame* scope,
278                                            int process_index,
279                                            std::vector<s_local_variable>& result)
280 {
281   simgrid::mc::Process* process = &mc_model_checker->process();
282
283   void *ip = (void *) stack_frame->ip;
284   if (ip < scope->low_pc || ip >= scope->high_pc)
285     return;
286
287   for(simgrid::mc::Variable& current_variable :
288       scope->variables) {
289
290     if (!mc_valid_variable(&current_variable, scope, (void *) stack_frame->ip))
291       continue;
292
293     int region_type;
294     // FIXME, get rid of `region_type`
295     if ((long) stack_frame->ip > (long) process->libsimgrid_info->start_exec)
296       region_type = 1;
297     else
298       region_type = 2;
299
300     s_local_variable_t new_var;
301     new_var.subprogram = stack_frame->frame;
302     new_var.ip = stack_frame->ip;
303     new_var.name = current_variable.name;
304     new_var.type = current_variable.type;
305     new_var.region = region_type;
306     new_var.address = nullptr;
307
308     if (current_variable.address != NULL) {
309       new_var.address = current_variable.address;
310     } else if (!current_variable.location_list.empty()) {
311       simgrid::dwarf::Location location =
312         simgrid::dwarf::resolve(
313           current_variable.location_list,
314           current_variable.object_info,
315           &(stack_frame->unw_cursor),
316           (void *) stack_frame->frame_base,
317           &mc_model_checker->process(), process_index);
318
319       if (!location.in_memory())
320         xbt_die("Cannot handle non-address variable");
321       new_var.address = location.address();
322
323     } else {
324       xbt_die("No address");
325     }
326
327     result.push_back(std::move(new_var));
328   }
329
330   // Recursive processing of nested scopes:
331   for(simgrid::mc::Frame& nested_scope : scope->scopes)
332     mc_fill_local_variables_values(
333       stack_frame, &nested_scope, process_index, result);
334 }
335
336 static std::vector<s_local_variable> MC_get_local_variables_values(
337   std::vector<s_mc_stack_frame_t>& stack_frames, int process_index)
338 {
339   std::vector<s_local_variable> variables;
340   for (s_mc_stack_frame_t& stack_frame : stack_frames)
341     mc_fill_local_variables_values(&stack_frame, stack_frame.frame, process_index, variables);
342   return std::move(variables);
343 }
344
345 static void MC_stack_frame_free_voipd(void *s)
346 {
347   mc_stack_frame_t stack_frame = *(mc_stack_frame_t *) s;
348   delete(stack_frame);
349 }
350
351 static std::vector<s_mc_stack_frame_t> MC_unwind_stack_frames(mc_unw_context_t stack_context)
352 {
353   simgrid::mc::Process* process = &mc_model_checker->process();
354   std::vector<s_mc_stack_frame_t> result;
355
356   unw_cursor_t c;
357
358   // TODO, check condition check (unw_init_local==0 means end of frame)
359   if (mc_unw_init_cursor(&c, stack_context) != 0) {
360
361     xbt_die("Could not initialize stack unwinding");
362
363   } else
364     while (1) {
365
366       s_mc_stack_frame_t stack_frame;
367
368       stack_frame.unw_cursor = c;
369
370       unw_word_t ip, sp;
371
372       unw_get_reg(&c, UNW_REG_IP, &ip);
373       unw_get_reg(&c, UNW_REG_SP, &sp);
374
375       stack_frame.ip = ip;
376       stack_frame.sp = sp;
377
378       // TODO, use real addresses in frame_t instead of fixing it here
379
380       simgrid::mc::Frame* frame = process->find_function(remote(ip));
381       stack_frame.frame = frame;
382
383       if (frame) {
384         stack_frame.frame_name = frame->name;
385         stack_frame.frame_base =
386             (unw_word_t) frame->frame_base(c);
387       } else {
388         stack_frame.frame_base = 0;
389         stack_frame.frame_name = std::string();
390       }
391
392       result.push_back(std::move(stack_frame));
393
394       /* Stop before context switch with maestro */
395       if (frame != nullptr &&
396           frame->name == "smx_ctx_sysv_wrapper")
397         break;
398
399       int ret = unw_step(&c);
400       if (ret == 0) {
401         xbt_die("Unexpected end of stack.");
402       } else if (ret < 0) {
403         xbt_die("Error while unwinding stack");
404       }
405     }
406
407   if (result.empty()) {
408     XBT_INFO("unw_init_local failed");
409     xbt_abort();
410   }
411
412   return std::move(result);
413 };
414
415 static std::vector<s_mc_snapshot_stack_t> MC_take_snapshot_stacks(mc_snapshot_t * snapshot)
416 {
417   std::vector<s_mc_snapshot_stack_t> res;
418
419   unsigned int cursor = 0;
420   stack_region_t current_stack;
421
422   // FIXME, cross-process support (stack_areas)
423   xbt_dynar_foreach(stacks_areas, cursor, current_stack) {
424     s_mc_snapshot_stack_t st;
425
426     // Read the context from remote process:
427     unw_context_t context;
428     mc_model_checker->process().read_bytes(
429       &context, sizeof(context), remote(current_stack->context));
430
431     if (mc_unw_init_context(&st.context, &mc_model_checker->process(),
432       &context) < 0) {
433       xbt_die("Could not initialise the libunwind context.");
434     }
435     st.stack_frames = MC_unwind_stack_frames(&st.context);
436     st.local_variables = MC_get_local_variables_values(st.stack_frames, current_stack->process_index);
437     st.process_index = current_stack->process_index;
438
439     unw_word_t sp = st.stack_frames[0].sp;
440
441     res.push_back(std::move(st));
442
443     size_t stack_size =
444       (char*) current_stack->address + current_stack->size - (char*) sp;
445     (*snapshot)->stack_sizes.push_back(stack_size);
446   }
447
448   return std::move(res);
449
450 }
451
452 static std::vector<s_mc_heap_ignore_region_t> MC_take_snapshot_ignore()
453 {
454   std::vector<s_mc_heap_ignore_region_t> res;
455
456   if (mc_heap_comparison_ignore == NULL)
457     return std::move(res);
458
459   unsigned int cursor = 0;
460   mc_heap_ignore_region_t current_region;
461
462   xbt_dynar_foreach(mc_heap_comparison_ignore, cursor, current_region) {
463     s_mc_heap_ignore_region_t new_region;
464     new_region.address = current_region->address;
465     new_region.size = current_region->size;
466     new_region.block = current_region->block;
467     new_region.fragment = current_region->fragment;
468     res.push_back(std::move(new_region));
469   }
470
471   return std::move(res);
472 }
473
474 static void MC_snapshot_handle_ignore(mc_snapshot_t snapshot)
475 {
476   xbt_assert(snapshot->process());
477   
478   // Copy the memory:
479   for (auto const& region : mc_model_checker->process().ignored_regions()) {
480     s_mc_snapshot_ignored_data_t ignored_data;
481     ignored_data.start = (void*)region.addr;
482     ignored_data.data.resize(region.size);
483     // TODO, we should do this once per privatization segment:
484     snapshot->process()->read_bytes(
485       ignored_data.data.data(), region.size, remote(region.addr),
486       simgrid::mc::ProcessIndexDisabled);
487     snapshot->ignored_data.push_back(std::move(ignored_data));
488   }
489
490   // Zero the memory:
491   for(auto const& region : mc_model_checker->process().ignored_regions()) {
492     snapshot->process()->clear_bytes(remote(region.addr), region.size);
493   }
494
495 }
496
497 static void MC_snapshot_ignore_restore(mc_snapshot_t snapshot)
498 {
499   for (auto const& ignored_data : snapshot->ignored_data)
500     snapshot->process()->write_bytes(
501       ignored_data.data.data(), ignored_data.data.size(),
502       remote(ignored_data.start));
503 }
504
505 static std::vector<s_fd_infos_t> MC_get_current_fds(pid_t pid)
506 {
507   const size_t fd_dir_path_size = 20;
508   char fd_dir_path[fd_dir_path_size];
509   int res = snprintf(fd_dir_path, fd_dir_path_size,
510     "/proc/%lli/fd", (long long int) pid);
511   xbt_assert(res >= 0);
512   if ((size_t) res > fd_dir_path_size)
513     xbt_die("Unexpected buffer is too small for fd_dir_path");
514
515   DIR* fd_dir = opendir(fd_dir_path);
516   if (fd_dir == NULL)
517     xbt_die("Cannot open directory '/proc/self/fd'\n");
518
519   std::vector<s_fd_infos_t> fds;
520
521   struct dirent* fd_number;
522   while ((fd_number = readdir(fd_dir))) {
523
524     int fd_value = atoi(fd_number->d_name);
525
526     if(fd_value < 3)
527       continue;
528
529     const size_t source_size = 25;
530     char source[25];
531     int res = snprintf(source, source_size, "/proc/%lli/fd/%s",
532         (long long int) pid, fd_number->d_name);
533     xbt_assert(res >= 0);
534     if ((size_t) res > source_size)
535       xbt_die("Unexpected buffer is too small for fd %s", fd_number->d_name);
536
537     const size_t link_size = 200;
538     char link[200];
539     res = readlink(source, link, link_size);
540     if (res<0) {
541       xbt_die("Could not read link for %s", source);
542     }
543     if (res==200) {
544       xbt_die("Buffer to small for link of %s", source);
545     }
546     link[res] = '\0';
547
548 #ifdef HAVE_SMPI
549     if(smpi_is_privatisation_file(link))
550       continue;
551 #endif
552
553     // This is (probably) the DIR* we are reading:
554     // TODO, read all the file entries at once and close the DIR.*
555     if(strcmp(fd_dir_path, link) == 0)
556       continue;
557
558     // We don't handle them.
559     // It does not mean we should silently ignore them however.
560     if (strncmp(link, "pipe:", 5) == 0 || strncmp(link, "socket:", 7) == 0)
561       continue;
562
563     // If dot_output enabled, do not handle the corresponding file
564     if (dot_output !=  NULL && strcmp(basename(link), _sg_mc_dot_output_file) == 0)
565       continue;
566
567     // This is probably a shared memory used by lttng-ust:
568     if(strncmp("/dev/shm/ust-shm-tmp-", link, 21)==0)
569       continue;
570
571     // Add an entry for this FD in the snapshot:
572     s_fd_infos_t fd;
573     fd.filename = std::string(link);
574     fd.number = fd_value;
575     fd.flags = fcntl(fd_value, F_GETFL) | fcntl(fd_value, F_GETFD) ;
576     fd.current_position = lseek(fd_value, 0, SEEK_CUR);
577     fds.push_back(std::move(fd));
578   }
579
580   closedir (fd_dir);
581   return std::move(fds);
582 }
583
584 mc_snapshot_t MC_take_snapshot(int num_state)
585 {
586   XBT_DEBUG("Taking snapshot %i", num_state);
587
588   simgrid::mc::Process* mc_process = &mc_model_checker->process();
589
590   mc_snapshot_t snapshot = new simgrid::mc::Snapshot(mc_process);
591
592   snapshot->num_state = num_state;
593
594   smx_process_t process;
595   MC_EACH_SIMIX_PROCESS(process,
596     snapshot->enabled_processes.insert(process->pid));
597
598   MC_snapshot_handle_ignore(snapshot);
599
600   if (_sg_mc_snapshot_fds)
601     snapshot->current_fds = MC_get_current_fds(process->pid);
602
603   const bool use_soft_dirty = _sg_mc_sparse_checkpoint && _sg_mc_soft_dirty;
604
605   /* Save the std heap and the writable mapped pages of libsimgrid and binary */
606   MC_get_memory_regions(mc_process, snapshot);
607   if (use_soft_dirty)
608     mc_process->reset_soft_dirty();
609
610   snapshot->to_ignore = MC_take_snapshot_ignore();
611
612   if (_sg_mc_visited > 0 || strcmp(_sg_mc_property_file, "")) {
613     snapshot->stacks =
614         MC_take_snapshot_stacks(&snapshot);
615     if (_sg_mc_hash) {
616       snapshot->hash = simgrid::mc::hash(*snapshot);
617     } else {
618       snapshot->hash = 0;
619     }
620   } else {
621     snapshot->hash = 0;
622   }
623
624   MC_snapshot_ignore_restore(snapshot);
625   if (use_soft_dirty)
626     mc_model_checker->parent_snapshot_ = snapshot;
627   return snapshot;
628 }
629
630 static inline
631 void MC_restore_snapshot_regions(mc_snapshot_t snapshot)
632 {
633   for(std::unique_ptr<s_mc_mem_region_t> const& region : snapshot->snapshot_regions) {
634     // For privatized, variables we decided it was not necessary to take the snapshot:
635     if (region)
636       MC_region_restore(region.get());
637   }
638
639 #ifdef HAVE_SMPI
640   // TODO, send a message to implement this in the MCed process
641   if(snapshot->privatization_index >= 0) {
642     // We just rewrote the global variables.
643     // The privatisation segment SMPI thinks
644     // is mapped might be inconsistent with the segment which
645     // is really mapped in memory (kernel state).
646     // We ask politely SMPI to map the segment anyway,
647     // even if it thinks it is the current one:
648     smpi_really_switch_data_segment(snapshot->privatization_index);
649   }
650 #endif
651 }
652
653 static inline
654 void MC_restore_snapshot_fds(mc_snapshot_t snapshot)
655 {
656   if (mc_mode == MC_MODE_SERVER)
657     xbt_die("FD snapshot not implemented in client/server mode.");
658
659   for (auto const& fd : snapshot->current_fds) {
660     
661     int new_fd = open(fd.filename.c_str(), fd.flags);
662     if (new_fd < 0) {
663       xbt_die("Could not reopen the file %s fo restoring the file descriptor",
664         fd.filename.c_str());
665     }
666     if (new_fd != fd.number) {
667       dup2(new_fd, fd.number);
668       close(new_fd);
669     };
670     lseek(fd.number, fd.current_position, SEEK_SET);
671   }
672 }
673
674 void MC_restore_snapshot(mc_snapshot_t snapshot)
675 {
676   XBT_DEBUG("Restore snapshot %i", snapshot->num_state);
677   const bool use_soft_dirty = _sg_mc_sparse_checkpoint && _sg_mc_soft_dirty;
678   MC_restore_snapshot_regions(snapshot);
679   if (_sg_mc_snapshot_fds)
680     MC_restore_snapshot_fds(snapshot);
681   if (use_soft_dirty)
682     mc_model_checker->process().reset_soft_dirty();
683   MC_snapshot_ignore_restore(snapshot);
684   mc_model_checker->process().cache_flags = 0;
685   if (use_soft_dirty)
686     mc_model_checker->parent_snapshot_ = snapshot;
687 }
688
689 mc_snapshot_t simcall_HANDLER_mc_snapshot(smx_simcall_t simcall)
690 {
691   return MC_take_snapshot(1);
692 }
693
694 }