avrora.sim.util
Class SequenceProbe

java.lang.Object
  extended byavrora.sim.util.SequenceProbe
All Implemented Interfaces:
Simulator.Probe

public class SequenceProbe
extends java.lang.Object
implements Simulator.Probe

The SequenceProbe is a probe composer that allows a probe to be fired for every instruction executed between a specified entrypoint and a specified exit point. For example, if the entrypoint is a call instruction and the exit point is the instruction following the call instruction, then the probe will fire for every instruction executed between the call and return, including both the call and the instruction following the call.

This probe supports nested entries (e.g. recursive calls). It is best used on pieces of the program that are single-entry/single-exit such as calls, interrupts, basic blocks, and SSE regions of control flow graphs. It does not work well for loops because of the nesting behavior.


Field Summary
 int entry_addr
           
 int exit_addr
           
 int nesting
           
 Simulator.Probe probe
           
 
Constructor Summary
SequenceProbe(Simulator.Probe p, int entry, int exit)
          The constructor for the SequenceProbe class simply stores its arguments into the corresponding public final fields in this object, leaving the probe in a state where it is ready to be inserted into a simulator.
 
Method Summary
 void fireAfter(Instr i, int address, State state)
          The fireBefore() method is called before the probed instruction executes.
 void fireBefore(Instr i, int address, State state)
          The fireBefore() method is called before the probed instruction executes.
 void reset()
          The reset() method simply resets the nesting level of the sequence probe, as if it had exited from all nested entries into the region.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entry_addr

public final int entry_addr

exit_addr

public final int exit_addr

probe

public final Simulator.Probe probe

nesting

public int nesting
Constructor Detail

SequenceProbe

public SequenceProbe(Simulator.Probe p,
                     int entry,
                     int exit)
The constructor for the SequenceProbe class simply stores its arguments into the corresponding public final fields in this object, leaving the probe in a state where it is ready to be inserted into a simulator.

Parameters:
p - the probe to fire for each instruction when the sequence is entered
entry - the byte address of the entrypoint to the sequence
exit - the byte address of the exitpoint of the sequence
Method Detail

fireBefore

public void fireBefore(Instr i,
                       int address,
                       State state)
The fireBefore() method is called before the probed instruction executes. In the implementation of the sequence probe, if the address is the entrypoint address, then the nesting level is incremented. When the nesting level is greater than one, then the sequence probe will delegate the fireBefore() call to the user probe.

Specified by:
fireBefore in interface Simulator.Probe
Parameters:
i - the instruction being probed
address - the address at which this instruction resides
state - the state of the simulation

fireAfter

public void fireAfter(Instr i,
                      int address,
                      State state)
The fireBefore() method is called before the probed instruction executes. When the nesting level is greater than one, then the sequence probe will delegate the fireAfter() call to the user probe. If the address is the exit point, then the nesting level is decremented after the call to fireAfter() of the user probe.

Specified by:
fireAfter in interface Simulator.Probe
Parameters:
i - the instruction being probed
address - the address at which this instruction resides
state - the state of the simulation

reset

public void reset()
The reset() method simply resets the nesting level of the sequence probe, as if it had exited from all nested entries into the region.