fn finish_initializing(&self) {
        if self.clone_completion.borrow().is_none() {
            return;
        }

        // DIFF NOTE: We're setting clone completion to None here instead of at the end of the
        // method.
        let cc = self.clone_completion.replace(None).unwrap();
        for tgleader in &cc.address_spaces {
            let rc = tgleader.clone_leader.upgrade().unwrap();
            let mut leader = rc.borrow_mut();
            {
                let mut found_syscall_buf = None;
                let mut remote = AutoRemoteSyscalls::new(leader.as_mut());
                for (&mk, m) in &remote.vm().maps() {
                    if m.flags.contains(MappingFlags::IS_SYSCALLBUF) {
                        // DIFF NOTE: The whole reason why this approach is a bit different from rr because its
                        // its tougher to iterate and modify a map at the same time in rust vs c++.
                        found_syscall_buf = Some(mk);
                        // DIFF NOTE: We are assuming only a single syscall buffer in the memory maps.
                        break;
                    }
                }

                match found_syscall_buf {
                    Some(k) => {
                        // Creating this mapping was delayed in capture_state for performance
                        remote.recreate_shared_mmap(k, None, None);
                    }
                    None => (),
                }
            }

            for (rptr, captured_mem) in &tgleader.captured_memory {
                leader.write_bytes_helper(*rptr, captured_mem, None, WriteFlags::empty());
            }

            {
                let mut remote2 = AutoRemoteSyscalls::new(leader.as_mut());
                for tgmember in &tgleader.member_states {
                    let t_clone = task_common::os_clone_into(tgmember, &mut remote2);
                    self.on_create_task(t_clone);
                }
            }

            tgleader
                .clone_leader
                .upgrade()
                .unwrap()
                .borrow_mut()
                .copy_state(&tgleader.clone_leader_state);
        }
        // Don't need to set clone completion to `None`. Its already been done!
    }
/// Call this before doing anything that requires access to the full set
/// of tasks (i.e., almost anything!).
Call this before doing anything that requires access to the full set
of tasks .
Call this before doing anything that requires access to the full set of tasks .
fn finish_initializing(&self) {
        if self.clone_completion.borrow().is_none() {
            return;
        }
        // DIFF NOTE: We're setting clone completion to None here instead of at the end of the
        // method.
        let cc = self.clone_completion.replace(None).unwrap();
        for tgleader in &cc.address_spaces {
            let rc = tgleader.clone_leader.upgrade().unwrap();
            let mut leader = rc.borrow_mut();
            {
                let mut found_syscall_buf = None;
                let mut remote = AutoRemoteSyscalls::new(leader.as_mut());
                for (&mk, m) in &remote.vm().maps() {
                    if m.flags.contains(MappingFlags::IS_SYSCALLBUF) {
                        // DIFF NOTE: The whole reason why this approach is a bit different from rr because its
                        // its tougher to iterate and modify a map at the same time in rust vs c++.
                        found_syscall_buf = Some(mk);
                        // DIFF NOTE: We are assuming only a single syscall buffer in the memory maps.
                        break;
                    }
                }
                match found_syscall_buf {
                    Some(k) => {
                        // Creating this mapping was delayed in capture_state for performance
                        remote.recreate_shared_mmap(k, None, None);
                    }
                    None => (),
                }
            }
            for (rptr, captured_mem) in &tgleader.captured_memory {
                leader.write_bytes_helper(*rptr, captured_mem, None, WriteFlags::empty());
            }
            {
                let mut remote2 = AutoRemoteSyscalls::new(leader.as_mut());
                for tgmember in &tgleader.member_states {
                    let t_clone = task_common::os_clone_into(tgmember, &mut remote2);
                    self.on_create_task(t_clone);
                }
            }
            tgleader
                .clone_leader
                .upgrade()
                .unwrap()
                .borrow_mut()
                .copy_state(&tgleader.clone_leader_state);
        }
        // Don't need to set clone completion to `None`. Its already been done!
    }
fn finish_initializing ( & self ) { if self . clone_completion . borrow ( ) . is_none ( ) { return ; } // DIFF NOTE: We're setting clone completion to None here instead of at the end of the // method. let cc = self . clone_completion . replace ( None ) . unwrap ( ) ; for tgleader in & cc . address_spaces { let rc = tgleader . clone_leader . upgrade ( ) . unwrap ( ) ; let mut leader = rc . borrow_mut ( ) ; { let mut found_syscall_buf = None ; let mut remote = AutoRemoteSyscalls :: new ( leader . as_mut ( ) ) ; for ( & mk , m ) in & remote . vm ( ) . maps ( ) { if m . flags . contains ( MappingFlags :: IS_SYSCALLBUF ) { // DIFF NOTE: The whole reason why this approach is a bit different from rr because its // its tougher to iterate and modify a map at the same time in rust vs c++. found_syscall_buf = Some ( mk ) ; // DIFF NOTE: We are assuming only a single syscall buffer in the memory maps. break ; } } match found_syscall_buf { Some ( k ) => { // Creating this mapping was delayed in capture_state for performance remote . recreate_shared_mmap ( k , None , None ) ; } None => ( ) , } } for ( rptr , captured_mem ) in & tgleader . captured_memory { leader . write_bytes_helper ( * rptr , captured_mem , None , WriteFlags :: empty ( ) ) ; } { let mut remote2 = AutoRemoteSyscalls :: new ( leader . as_mut ( ) ) ; for tgmember in & tgleader . member_states { let t_clone = task_common :: os_clone_into ( tgmember , & mut remote2 ) ; self . on_create_task ( t_clone ) ; } } tgleader . clone_leader . upgrade ( ) . unwrap ( ) . borrow_mut ( ) . copy_state ( & tgleader . clone_leader_state ) ; } // Don't need to set clone completion to `None`. Its already been done! }
Call this before doing anything that requires access to the full set
of tasks (i.e., almost anything!
Call this before doing anything that requires access to the full set of tasks ( i . e . almost anything!
&self