fn read_breakpoints(
    core: &mut Core,
    ktest: &KTest,
    app: &AppInfo,
    timeout: u64,
) -> Result<Vec<MeasurementResult>> {
    let mut measurements: Vec<MeasurementResult> = Vec::new();
    let name = BKPT_UNKNOWN_NAME.to_string();
    let mut current_hw_bkpt: u32 = 0;
    let mut vcell_test_vectors = get_vcell_ktestobjects(ktest);
    vcell_test_vectors.reverse();

    // Loop from breakpoints until the next
    loop {
        core::run(core).context("Could not continue from the ReplayStart breakpoint")?;
        core.wait_for_core_halted(std::time::Duration::from_secs(timeout))
            .context(
                "Core does not halt. Your application might be stuck in a non-terminating loop?",
            )?;

        let current_pc = core::current_pc(core)?;

        // Catch hardware breakpoints which are only used when writing the test vectors
        // for vcell readings to the load register
        if (current_pc == current_hw_bkpt) && (current_hw_bkpt != 0) {
            let reg = get_output_reg_from_breakpoint_addr(app, current_hw_bkpt)?;
            core.clear_hw_breakpoint(current_hw_bkpt)?;
            current_hw_bkpt = 0;

            // It is assumed vcells occur in order so just pop the first test
            if let Some(test) = vcell_test_vectors.pop() {
                write_vcell_test_to_register(core, reg, &test)?;
            }
        // Catch halts that are not breakpoints because that should not happen
        } else if !core::breakpoint_at_pc(core)? {
            return Err(anyhow!(
                "Core halted, but not due to a breakpoint. Can't continue with analysis. Core status: {:?}", core.status()?
            ));
        // Measure breakpoints and
        } else {
            let bkpt_val = core::read_breakpoint_value(core)?;
            let bkpt = Breakpoint::from(bkpt_val);

            match handle_breakpoint(&bkpt, core, &mut measurements, &mut current_hw_bkpt, app)? {
                LoopAction::Break => break,
                LoopAction::Continue => continue,
                LoopAction::Nothing => (),
            }

            // Save the result onto the stack
            let cyccnt = core::read_cycle_counter(core)?;
            measurements.push((bkpt, name.clone(), cyccnt));
        }
    }

    Ok(measurements)
}
/// Read all breakpoints and the cycle counter at their positions from the start of
/// a ReplayStart breakpoint until the next ReplayStart breakpoint. Also writes the
/// generated test vector for a hardware read one at a time in order whenever applicable.
/// Return the measurement result as a list.
///
/// * `core` - A connected probe-rs _core_
/// * `ktest` - The test to replay
/// * `app` - Relevant information of the replay binary
Read all breakpoints and the cycle counter at their positions from the start of
a ReplayStart breakpoint until the next ReplayStart breakpoint. Also writes the
generated test vector for a hardware read one at a time in order whenever applicable.
Return the measurement result as a list.


Read all breakpoints and the cycle counter at their positions from the start of a ReplayStart breakpoint until the next ReplayStart breakpoint . Also writes the generated test vector for a hardware read one at a time in order whenever applicable . Return the measurement result as a list .
fn read_breakpoints(
    core: &mut Core,
    ktest: &KTest,
    app: &AppInfo,
    timeout: u64,
) -> Result<Vec<MeasurementResult>> {
    let mut measurements: Vec<MeasurementResult> = Vec::new();
    let name = BKPT_UNKNOWN_NAME.to_string();
    let mut current_hw_bkpt: u32 = 0;
    let mut vcell_test_vectors = get_vcell_ktestobjects(ktest);
    vcell_test_vectors.reverse();
    // Loop from breakpoints until the next
    loop {
        core::run(core).context("Could not continue from the ReplayStart breakpoint")?;
        core.wait_for_core_halted(std::time::Duration::from_secs(timeout))
            .context(
                "Core does not halt. Your application might be stuck in a non-terminating loop?",
            )?;
        let current_pc = core::current_pc(core)?;
        // Catch hardware breakpoints which are only used when writing the test vectors
        // for vcell readings to the load register
        if (current_pc == current_hw_bkpt) && (current_hw_bkpt != 0) {
            let reg = get_output_reg_from_breakpoint_addr(app, current_hw_bkpt)?;
            core.clear_hw_breakpoint(current_hw_bkpt)?;
            current_hw_bkpt = 0;
            // It is assumed vcells occur in order so just pop the first test
            if let Some(test) = vcell_test_vectors.pop() {
                write_vcell_test_to_register(core, reg, &test)?;
            }
        // Catch halts that are not breakpoints because that should not happen
        } else if !core::breakpoint_at_pc(core)? {
            return Err(anyhow!(
                "Core halted, but not due to a breakpoint. Can't continue with analysis. Core status: {:?}", core.status()?
            ));
        // Measure breakpoints and
        } else {
            let bkpt_val = core::read_breakpoint_value(core)?;
            let bkpt = Breakpoint::from(bkpt_val);
            match handle_breakpoint(&bkpt, core, &mut measurements, &mut current_hw_bkpt, app)? {
                LoopAction::Break => break,
                LoopAction::Continue => continue,
                LoopAction::Nothing => (),
            }
            // Save the result onto the stack
            let cyccnt = core::read_cycle_counter(core)?;
            measurements.push((bkpt, name.clone(), cyccnt));
        }
    }
    Ok(measurements)
}
fn read_breakpoints ( core : & mut Core , ktest : & KTest , app : & AppInfo , timeout : u64 , ) -> Result < Vec < MeasurementResult > > { let mut measurements : Vec < MeasurementResult > = Vec :: new ( ) ; let name = BKPT_UNKNOWN_NAME . to_string ( ) ; let mut current_hw_bkpt : u32 = 0 ; let mut vcell_test_vectors = get_vcell_ktestobjects ( ktest ) ; vcell_test_vectors . reverse ( ) ; // Loop from breakpoints until the next loop { core :: run ( core ) . context ( " " ) ? ; core . wait_for_core_halted ( std :: time :: Duration :: from_secs ( timeout ) ) . context ( " " , ) ? ; let current_pc = core :: current_pc ( core ) ? ; // Catch hardware breakpoints which are only used when writing the test vectors // for vcell readings to the load register if ( current_pc == current_hw_bkpt ) && ( current_hw_bkpt != 0 ) { let reg = get_output_reg_from_breakpoint_addr ( app , current_hw_bkpt ) ? ; core . clear_hw_breakpoint ( current_hw_bkpt ) ? ; current_hw_bkpt = 0 ; // It is assumed vcells occur in order so just pop the first test if let Some ( test ) = vcell_test_vectors . pop ( ) { write_vcell_test_to_register ( core , reg , & test ) ? ; } // Catch halts that are not breakpoints because that should not happen } else if ! core :: breakpoint_at_pc ( core ) ? { return Err ( anyhow ! ( " " core status ( ) ) ) ; // Measure breakpoints and } else { let bkpt_val = core :: read_breakpoint_value ( core ) ? ; let bkpt = Breakpoint :: from ( bkpt_val ) ; match handle_breakpoint ( & bkpt , core , & mut measurements , & mut current_hw_bkpt , app ) ? { LoopAction :: Break => break , LoopAction :: Continue => continue , LoopAction :: Nothing => ( ) , } // Save the result onto the stack let cyccnt = core :: read_cycle_counter ( core ) ? ; measurements . push ( ( bkpt , name . clone ( ) , cyccnt ) ) ; } } Ok ( measurements ) }
Read all breakpoints and the cycle counter at their positions from the start of
a ReplayStart breakpoint until the next ReplayStart breakpoint.
Read all breakpoints and the cycle counter at their positions from the start of a ReplayStart breakpoint until the next ReplayStart breakpoint .
core
&mut Core
ktest
&KTest
app
&AppInfo
timeout
u64
core
&mut Core
ktest
&KTest
app
&AppInfo
timeout
u64