pub fn new(target: &str, args: &Vec<String>, break_points: &Vec<usize>,
               brk_point_map: &mut HashMap<usize, u8>) -> Option<Inferior> {
        // TODO: implement me!
        let mut  cmd = Command::new(target);
        cmd.args(args);
        // Nearly the same issue like the below one:
        // https://stackoverflow.com/questions/54056268/temporary-value-is-freed-at-the-end-of-this-statement

        unsafe {
            cmd.pre_exec(child_traceme);
        }
        let child = cmd.spawn().ok()?;
        let mut the_inferior = Inferior{child, is_exited: false, is_brk_point: false, brk_point_rip: None };
        the_inferior.wait(Some(WaitPidFlag::WUNTRACED)).ok()?;

        //set the break_point
        for break_point in break_points {
            let orig_byte = the_inferior.write_byte(break_point.clone(), 0xcc)
                .ok().unwrap();
            brk_point_map.insert(break_point.clone(), orig_byte);
        }

        Some(the_inferior)
    }
/// Attempts to start a new inferior process. Returns Some(Inferior) if successful, or None if
/// an error is encountered.
Attempts to start a new inferior process. Returns Some(Inferior) if successful, or None if
an error is encountered.
Attempts to start a new inferior process . Returns Some ( Inferior ) if successful or None if an error is encountered .
pub fn new(target: &str, args: &Vec<String>, break_points: &Vec<usize>,
               brk_point_map: &mut HashMap<usize, u8>) -> Option<Inferior> {
        // TODO: implement me!
        let mut  cmd = Command::new(target);
        cmd.args(args);
        // Nearly the same issue like the below one:
        // https://stackoverflow.com/questions/54056268/temporary-value-is-freed-at-the-end-of-this-statement
        unsafe {
            cmd.pre_exec(child_traceme);
        }
        let child = cmd.spawn().ok()?;
        let mut the_inferior = Inferior{child, is_exited: false, is_brk_point: false, brk_point_rip: None };
        the_inferior.wait(Some(WaitPidFlag::WUNTRACED)).ok()?;
        //set the break_point
        for break_point in break_points {
            let orig_byte = the_inferior.write_byte(break_point.clone(), 0xcc)
                .ok().unwrap();
            brk_point_map.insert(break_point.clone(), orig_byte);
        }
        Some(the_inferior)
    }
pub fn new ( target : & str , args : & Vec < String > , break_points : & Vec < usize > , brk_point_map : & mut HashMap < usize , u8 > ) -> Option < Inferior > { // TODO: implement me! let mut cmd = Command :: new ( target ) ; cmd . args ( args ) ; // Nearly the same issue like the below one: // https://stackoverflow.com/questions/54056268/temporary-value-is-freed-at-the-end-of-this-statement unsafe { cmd . pre_exec ( child_traceme ) ; } let child = cmd . spawn ( ) . ok ( ) ? ; let mut the_inferior = Inferior { child , is_exited : false , is_brk_point : false , brk_point_rip : None } ; the_inferior . wait ( Some ( WaitPidFlag :: WUNTRACED ) ) . ok ( ) ? ; //set the break_point for break_point in break_points { let orig_byte = the_inferior . write_byte ( break_point . clone ( ) , 0xcc ) . ok ( ) . unwrap ( ) ; brk_point_map . insert ( break_point . clone ( ) , orig_byte ) ; } Some ( the_inferior ) }
Attempts to start a new inferior process.
Attempts to start a new inferior process .
target
&str
args
&Vec<String>
break_points
&Vec<usize>
brk_point_map
&mut HashMap<usize, u8>
target
&str
args
&Vec<String>
break_points
&Vec<usize>
brk_point_map
&mut HashMap<usize, u8>