pub fn fix(&mut self, rfn_addr: &u64) {
        if self.rmod.functions.get(rfn_addr).is_none() {
            radeco_err!("RadecoFunction Not Found!");
            return;
        }
        let call_info: Vec<(LValueRef, Vec<String>)> = {
            let rfn = self.rmod.functions.get(rfn_addr).unwrap();
            let callees = rfn.callees(&self.rmod.callgraph).clone();
            let addr_callees = callees
                .into_iter()
                .filter_map(|node| self.rmod.callgraph.node_weight(node).map(|a| (*a, node)))
                .collect::<Vec<_>>();
            self.preserves_for_call_context(addr_callees)
        };
        radeco_trace!("CallFixer|Call site: {:?}", call_info);

        {
            let rfn = self.rmod.functions.get_mut(rfn_addr).unwrap();
            let ssa = rfn.ssa_mut();

            for (node, mut regs) in call_info {
                // Add SP for every function.
                if let Some(ref name) = self.sp_name {
                    regs.push(name.clone());
                }
                for reg in regs {
                    let node_sets = vec![ssa.operands_of(node), ssa.uses_of(node)];
                    let mut replace_pair: Vec<LValueRef> = Vec::with_capacity(2);
                    for node_set in node_sets {
                        for sub_node in node_set {
                            if ssa.registers(sub_node).contains(&reg) {
                                replace_pair.push(sub_node);
                                break;
                            }
                        }
                    }

                    if replace_pair.len() != 2 {
                        radeco_trace!("CallFixer|{:?} with {:?} Not Found!", node, reg);
                        radeco_trace!("CallFixer| Found replace_pair {:?}", replace_pair);
                        continue;
                    }

                    ssa.replace_value(replace_pair[1], replace_pair[0]);
                }
            }
        }
    }
// Fix the call_site with the callees' preserved register,
// which will make later analysis much easier.
Fix the call_site with the callees' preserved register,
which will make later analysis much easier.
Fix the call_site with the callees ' preserved register which will make later analysis much easier .
pub fn fix(&mut self, rfn_addr: &u64) {
        if self.rmod.functions.get(rfn_addr).is_none() {
            radeco_err!("RadecoFunction Not Found!");
            return;
        }
        let call_info: Vec<(LValueRef, Vec<String>)> = {
            let rfn = self.rmod.functions.get(rfn_addr).unwrap();
            let callees = rfn.callees(&self.rmod.callgraph).clone();
            let addr_callees = callees
                .into_iter()
                .filter_map(|node| self.rmod.callgraph.node_weight(node).map(|a| (*a, node)))
                .collect::<Vec<_>>();
            self.preserves_for_call_context(addr_callees)
        };
        radeco_trace!("CallFixer|Call site: {:?}", call_info);
        {
            let rfn = self.rmod.functions.get_mut(rfn_addr).unwrap();
            let ssa = rfn.ssa_mut();
            for (node, mut regs) in call_info {
                // Add SP for every function.
                if let Some(ref name) = self.sp_name {
                    regs.push(name.clone());
                }
                for reg in regs {
                    let node_sets = vec![ssa.operands_of(node), ssa.uses_of(node)];
                    let mut replace_pair: Vec<LValueRef> = Vec::with_capacity(2);
                    for node_set in node_sets {
                        for sub_node in node_set {
                            if ssa.registers(sub_node).contains(&reg) {
                                replace_pair.push(sub_node);
                                break;
                            }
                        }
                    }
                    if replace_pair.len() != 2 {
                        radeco_trace!("CallFixer|{:?} with {:?} Not Found!", node, reg);
                        radeco_trace!("CallFixer| Found replace_pair {:?}", replace_pair);
                        continue;
                    }
                    ssa.replace_value(replace_pair[1], replace_pair[0]);
                }
            }
        }
    }
pub fn fix ( & mut self , rfn_addr : & u64 ) { if self . rmod . functions . get ( rfn_addr ) . is_none ( ) { radeco_err ! ( " " ) ; return ; } let call_info : Vec < ( LValueRef , Vec < String > ) > = { let rfn = self . rmod . functions . get ( rfn_addr ) . unwrap ( ) ; let callees = rfn . callees ( & self . rmod . callgraph ) . clone ( ) ; let addr_callees = callees . into_iter ( ) . filter_map ( | node | self . rmod . callgraph . node_weight ( node ) . map ( | a | ( * a , node ) ) ) . collect :: < Vec < _ > > ( ) ; self . preserves_for_call_context ( addr_callees ) } ; radeco_trace ! ( " " call_info ) ; { let rfn = self . rmod . functions . get_mut ( rfn_addr ) . unwrap ( ) ; let ssa = rfn . ssa_mut ( ) ; for ( node , mut regs ) in call_info { // Add SP for every function. if let Some ( ref name ) = self . sp_name { regs . push ( name . clone ( ) ) ; } for reg in regs { let node_sets = vec ! [ ssa operands_of ( node ) ssa uses_of ( node ) ] ; let mut replace_pair : Vec < LValueRef > = Vec :: with_capacity ( 2 ) ; for node_set in node_sets { for sub_node in node_set { if ssa . registers ( sub_node ) . contains ( & reg ) { replace_pair . push ( sub_node ) ; break ; } } } if replace_pair . len ( ) != 2 { radeco_trace ! ( " " node reg ) ; radeco_trace ! ( " " replace_pair ) ; continue ; } ssa . replace_value ( replace_pair [ 1 ] , replace_pair [ 0 ] ) ; } } } }
Fix the call_site with the callees' preserved register,
which will make later analysis much easier.
Fix the call_site with the callees ' preserved register which will make later analysis much easier .
&mut self
rfn_addr
&u64
&mut self
rfn_addr
&u64