return result;
};
-static xbt_dynar_t MC_take_snapshot_stacks(mc_snapshot_t * snapshot, void *heap)
+static xbt_dynar_t MC_take_snapshot_stacks(mc_snapshot_t * snapshot)
{
xbt_dynar_t res =
st->local_variables = MC_get_local_variables_values(st->stack_frames);
unw_word_t sp = xbt_dynar_get_as(st->stack_frames, 0, mc_stack_frame_t)->sp;
- st->stack_pointer =
- ((char *) heap + (size_t) (((char *) ((long) sp) - (char *) std_heap)));
- st->real_address = current_stack->address;
xbt_dynar_push(res, &st);
(*snapshot)->stack_sizes =
xbt_realloc((*snapshot)->stack_sizes, (cursor + 1) * sizeof(size_t));
(*snapshot)->stack_sizes[cursor] =
- current_stack->size - ((char *) st->stack_pointer -
- (char *) ((char *) heap +
- ((char *) current_stack->address -
- (char *) std_heap)));
+ (char*) current_stack->address + current_stack->size - (char*) sp;
}
return res;
/* Save the std heap and the writable mapped pages of libsimgrid and binary */
MC_get_memory_regions(snapshot);
- if (_sg_mc_sparse_checkpoint) {
+ if (_sg_mc_sparse_checkpoint && _sg_mc_soft_dirty) {
mc_softdirty_reset();
}
if (_sg_mc_visited > 0 || strcmp(_sg_mc_property_file, "")) {
snapshot->stacks =
- MC_take_snapshot_stacks(&snapshot, snapshot->regions[0]->data);
+ MC_take_snapshot_stacks(&snapshot);
if (_sg_mc_hash && snapshot->stacks != NULL) {
snapshot->hash = mc_hash_processes_state(num_state, snapshot->stacks);
} else {
switch_data_segment(snapshot->privatization_index);
}
- MC_snapshot_ignore_restore(snapshot);
- if (_sg_mc_sparse_checkpoint) {
+ if (_sg_mc_sparse_checkpoint && _sg_mc_soft_dirty) {
mc_softdirty_reset();
}
- mc_model_checker->parent_snapshot = snapshot;
-}
-
-void *mc_translate_address(uintptr_t addr, mc_snapshot_t snapshot)
-{
-
- // If not in a process state/clone:
- if (!snapshot) {
- return (uintptr_t *) addr;
- }
- // If it is in a snapshot:
- for (size_t i = 0; i != NB_REGIONS; ++i) {
- mc_mem_region_t region = snapshot->regions[i];
- uintptr_t start = (uintptr_t) region->start_addr;
- uintptr_t end = start + region->size;
-
- // The address is in this region:
- if (addr >= start && addr < end) {
- uintptr_t offset = addr - start;
- return (void *) ((uintptr_t) region->data + offset);
- }
-
- }
-
- // It is not in a snapshot:
- return (void *) addr;
-}
-
-uintptr_t mc_untranslate_address(void *addr, mc_snapshot_t snapshot)
-{
- if (!snapshot) {
- return (uintptr_t) addr;
- }
- for (size_t i = 0; i != NB_REGIONS; ++i) {
- mc_mem_region_t region = snapshot->regions[i];
- if (addr >= region->data
- && addr <= (void *) (((char *) region->data) + region->size)) {
- size_t offset = (size_t) ((char *) addr - (char *) region->data);
- return ((uintptr_t) region->start_addr) + offset;
- }
- }
-
- return (uintptr_t) addr;
+ MC_snapshot_ignore_restore(snapshot);
+ mc_model_checker->parent_snapshot = snapshot;
}
mc_snapshot_t SIMIX_pre_mc_snapshot(smx_simcall_t simcall)