in reverie-ptrace/src/task.rs [371:420]
fn cloned(&self, child: Pid) -> Self {
let global_state = self.global_state.clone();
let process_state = self.process_state.clone();
let thread_state =
process_state.init_thread_state(child, Some((self.tid, &self.thread_state)));
let (next_state, next_state_rx) = mpsc::channel(1);
let (daemonizer, daemonizer_rx) = mpsc::channel(1);
let (gdb_resume_tx, gdb_resume_rx) = mpsc::channel(1);
let (gdb_request_tx, gdb_request_rx) = mpsc::channel(1);
let (exit_suspend_tx, exit_suspend_rx) = mpsc::channel(16);
self.ntasks.fetch_add(1, Ordering::SeqCst);
Self {
tid: child,
pid: self.pid,
ppid: self.ppid,
thread_state,
process_state,
global_state,
pending_syscall: None,
next_state,
next_state_rx: Some(next_state_rx),
timer: Timer::new(self.pid, child),
notifier: Arc::new(Notify::new()),
pending_signal: None,
child_procs: self.child_procs.clone(),
child_threads: self.child_threads.clone(),
orphanage: self.orphanage.clone(),
daemon_kill_switch: self.daemon_kill_switch.clone(),
daemonizer,
daemonizer_rx: Some(daemonizer_rx),
ntasks: self.ntasks.clone(),
ndaemons: self.ndaemons.clone(),
is_a_daemon: self.is_a_daemon,
gdbserver_start_tx: None,
gdb_stop_tx: None,
attached_by_gdb: self.attached_by_gdb,
resumed_by_gdb: self.resumed_by_gdb,
gdb_resume_tx: Some(gdb_resume_tx),
gdb_resume_rx: Some(gdb_resume_rx),
breakpoints: self.breakpoints.clone(),
suspended: Arc::new(AtomicBool::new(false)),
gdb_request_tx: Some(gdb_request_tx),
gdb_request_rx: Some(gdb_request_rx),
exit_suspend_tx: Some(exit_suspend_tx),
exit_suspend_rx: Some(exit_suspend_rx),
needs_step_over: self.needs_step_over.clone(),
suspended_tasks: BTreeMap::new(),
stack_checked_out: Arc::new(AtomicBool::new(false)),
}
}