pub fn write<W: std::fmt::Write>(
        &self,
        out: &mut W,
        program: &[u8],
    ) -> Result<(), std::fmt::Error> {
        let disassembled = disassembler::to_insn_vec(program);
        let mut pc_to_instruction_index =
            vec![0usize; disassembled.last().map(|ins| ins.ptr + 1).unwrap_or(0)];
        for index in 0..disassembled.len() {
            pc_to_instruction_index[disassembled[index].ptr] = index;
        }
        for index in 0..self.log.len() {
            let entry = &self.log[index];
            let ins_index = pc_to_instruction_index[entry[11] as usize];
            writeln!(
                out,
                "{:5?} {:016X?} {:5?}: {}",
                index, entry, ins_index, disassembled[ins_index].desc
            )?;
        }
        Ok(())
    }
/// Use this method to print the log of this tracer
Use this method to print the log of this tracer
Use this method to print the log of this tracer
pub fn write<W: std::fmt::Write>(
        &self,
        out: &mut W,
        program: &[u8],
    ) -> Result<(), std::fmt::Error> {
        let disassembled = disassembler::to_insn_vec(program);
        let mut pc_to_instruction_index =
            vec![0usize; disassembled.last().map(|ins| ins.ptr + 1).unwrap_or(0)];
        for index in 0..disassembled.len() {
            pc_to_instruction_index[disassembled[index].ptr] = index;
        }
        for index in 0..self.log.len() {
            let entry = &self.log[index];
            let ins_index = pc_to_instruction_index[entry[11] as usize];
            writeln!(
                out,
                "{:5?} {:016X?} {:5?}: {}",
                index, entry, ins_index, disassembled[ins_index].desc
            )?;
        }
        Ok(())
    }
pub fn write < W : std :: fmt :: Write > ( & self , out : & mut W , program : & [ u8 ] , ) -> Result < ( ) , std :: fmt :: Error > { let disassembled = disassembler :: to_insn_vec ( program ) ; let mut pc_to_instruction_index = vec ! [ 0usize disassembled last ( ) map ( ins ins ptr 1 ) unwrap_or ( 0 ) ] ; for index in 0 .. disassembled . len ( ) { pc_to_instruction_index [ disassembled [ index ] . ptr ] = index ; } for index in 0 .. self . log . len ( ) { let entry = & self . log [ index ] ; let ins_index = pc_to_instruction_index [ entry [ 11 ] as usize ] ; writeln ! ( out " " index entry ins_index disassembled [ ins_index ] desc ) ? ; } Ok ( ( ) ) }
Use this method to print the log of this tracer
Use this method to print the log of this tracer
&self
out
&mut W
program
&[u8]