Class StateTransitioner<TInstruction>
- Namespace
- Echo.DataFlow.Construction
- Assembly
- Echo.DataFlow.dll
Provides a base implementation for a state transition resolver, that maintains a data flow graph (DFG) for resolving each program state transition an instruction might apply.
public abstract class StateTransitioner<TInstruction> : IStateTransitioner<TInstruction> where TInstruction : notnull
Type Parameters
TInstructionThe type of instructions to evaluate.
- Inheritance
-
StateTransitioner<TInstruction>
- Implements
-
IStateTransitioner<TInstruction>
- Inherited Members
Constructors
StateTransitioner(IArchitecture<TInstruction>)
Initializes the base implementation of the state state transition resolver.
public StateTransitioner(IArchitecture<TInstruction> architecture)
Parameters
architectureIArchitecture<TInstruction>The architecture that describes the instruction set.
Properties
Architecture
Gets the architecture for which this transition resolver is built.
public IArchitecture<TInstruction> Architecture { get; }
Property Value
- IArchitecture<TInstruction>
DataFlowGraph
Gets the data flow graph that was constructed during the resolution of all transitions.
public DataFlowGraph<TInstruction> DataFlowGraph { get; }
Property Value
- DataFlowGraph<TInstruction>
OffsetMap
Gets a mapping between offsets to data flow nodes.
public IDictionary<long, DataFlowNode<TInstruction>> OffsetMap { get; }
Property Value
- IDictionary<long, DataFlowNode<TInstruction>>
Methods
ApplyDefaultBehaviour(in SymbolicProgramState<TInstruction>, TInstruction)
Applies the default fallthrough transition on a symbolic program state.
protected SymbolicProgramState<TInstruction> ApplyDefaultBehaviour(in SymbolicProgramState<TInstruction> currentState, TInstruction instruction)
Parameters
currentStateSymbolicProgramState<TInstruction>The current program state to be transitioned.
instructionTInstructionThe instruction invoking the state transition.
Returns
- SymbolicProgramState<TInstruction>
GetInitialState(long)
Gets the initial state of the program at a provided entry point address.
public virtual SymbolicProgramState<TInstruction> GetInitialState(long entrypointAddress)
Parameters
entrypointAddresslongThe entry point address.
Returns
- SymbolicProgramState<TInstruction>
The object representing the initial state of the program.
GetOrCreateDataFlowNode(TInstruction)
Gets or adds a new a data flow graph node in the current data flow graph (DFG) that is linked to the provided instruction.
protected DataFlowNode<TInstruction> GetOrCreateDataFlowNode(TInstruction instruction)
Parameters
instructionTInstructionThe instruction.
Returns
- DataFlowNode<TInstruction>
The data flow graph
GetTransitions(in SymbolicProgramState<TInstruction>, in TInstruction, IList<StateTransition<TInstruction>>)
Resolves all possible program state transitions that the provided instruction can apply.
public abstract void GetTransitions(in SymbolicProgramState<TInstruction> currentState, in TInstruction instruction, IList<StateTransition<TInstruction>> transitionsBuffer)
Parameters
currentStateSymbolicProgramState<TInstruction>The current state of the program.
instructionTInstructionThe instruction to evaluate.
transitionsBufferIList<StateTransition<TInstruction>>The output buffer to add the transitions that the instruction might apply.