process->process_flags = MC_PROCESS_NO_FLAG;
process->socket = sockfd;
- process->pid = pid;
+ process->pid_ = pid;
if (pid==getpid())
process->process_flags |= MC_PROCESS_SELF_FLAG;
process->running = true;
if (process->is_self())
process->memory_file = -1;
else {
- int fd = open_vm(process->pid, O_RDWR);
+ int fd = open_vm(process->pid_, O_RDWR);
if (fd<0)
xbt_die("Could not open file for process virtual address space");
process->memory_file = fd;
process->smx_process_infos = MC_smx_process_info_list_new();
process->smx_old_process_infos = MC_smx_process_info_list_new();
- process->checkpoint_ignore = MC_checkpoint_ignore_new();
-
process->unw_addr_space = unw_create_addr_space(&mc_unw_accessors , __BYTE_ORDER);
if (process->process_flags & MC_PROCESS_SELF_FLAG) {
process->unw_underlying_addr_space = unw_local_addr_space;
Process* process = this;
process->process_flags = MC_PROCESS_NO_FLAG;
- process->pid = 0;
+ process->pid_ = 0;
MC_free_memory_map(process->memory_map);
process->memory_map = NULL;
process->maestro_stack_start = NULL;
process->maestro_stack_end = NULL;
- xbt_dynar_free(&process->checkpoint_ignore);
-
xbt_dynar_free(&process->smx_process_infos);
xbt_dynar_free(&process->smx_old_process_infos);
}
} else {
if (pread_whole(this->memory_file, buffer, size, (off_t) address.address()) < 0)
- xbt_die("Read from process %lli failed", (long long) this->pid);
+ xbt_die("Read from process %lli failed", (long long) this->pid_);
return buffer;
}
}
memcpy((void*)address.address(), buffer, len);
} else {
if (pwrite_whole(this->memory_file, buffer, len, address.address()) < 0)
- xbt_die("Write to process %lli failed", (long long) this->pid);
+ xbt_die("Write to process %lli failed", (long long) this->pid_);
}
}
}
}
+void Process::ignore_region(std::uint64_t addr, std::size_t size)
+{
+ IgnoredRegion region;
+ region.addr = addr;
+ region.size = size;
+
+ if (ignored_regions_.empty()) {
+ ignored_regions_.push_back(region);
+ return;
+ }
+
+ unsigned int cursor = 0;
+ IgnoredRegion* current_region = nullptr;
+
+ int start = 0;
+ int end = ignored_regions_.size() - 1;
+ while (start <= end) {
+ cursor = (start + end) / 2;
+ current_region = &ignored_regions_[cursor];
+ if (current_region->addr == addr) {
+ if (current_region->size == size)
+ return;
+ else if (current_region->size < size)
+ start = cursor + 1;
+ else
+ end = cursor - 1;
+ } else if (current_region->addr < addr)
+ start = cursor + 1;
+ else
+ end = cursor - 1;
+ }
+
+ std::size_t position;
+ if (current_region->addr == addr) {
+ if (current_region->size < size) {
+ position = cursor + 1;
+ } else {
+ position = cursor;
+ }
+ } else if (current_region->addr < addr) {
+ position = cursor + 1;
+ } else {
+ position = cursor;
+ }
+ ignored_regions_.insert(
+ ignored_regions_.begin() + position, region);
+}
+
}
}