Class InstructionTraversalResult<TInstruction>
- Namespace
- Echo.ControlFlow.Construction
- Assembly
- Echo.ControlFlow.dll
Provides a default implementation of the IInstructionTraversalResult<TInstruction> interface, using a dictionary and a set to store the instructions and block header offsets.
public class InstructionTraversalResult<TInstruction> : IInstructionTraversalResult<TInstruction>, IStaticInstructionProvider<TInstruction> where TInstruction : notnull
Type Parameters
TInstructionThe type of instructions that were traversed.
- Inheritance
-
InstructionTraversalResult<TInstruction>
- Implements
-
IInstructionTraversalResult<TInstruction>IStaticInstructionProvider<TInstruction>
- Inherited Members
Constructors
InstructionTraversalResult(IArchitecture<TInstruction>)
Creates a new instance of the InstructionTraversalResult<TInstruction> class.
public InstructionTraversalResult(IArchitecture<TInstruction> architecture)
Parameters
architectureIArchitecture<TInstruction>The architecture.
Properties
Architecture
Gets the architecture describing the instructions exposed by this instruction provider.
public IArchitecture<TInstruction> Architecture { get; }
Property Value
- IArchitecture<TInstruction>
BlockHeaders
Gets a collection of recorded block headers.
public ISet<long> BlockHeaders { get; }
Property Value
Methods
AddInstruction(in TInstruction)
Adds a single instruction to the traversal result.
public void AddInstruction(in TInstruction instruction)
Parameters
instructionTInstructionThe instruction to add.
ClearSuccessors(in TInstruction)
Clears all registered successors for the provided instruction.
public void ClearSuccessors(in TInstruction instruction)
Parameters
instructionTInstructionThe instruction.
ContainsInstruction(long)
Determines whether an offset was traversed and interpreted as an instruction.
public bool ContainsInstruction(long offset)
Parameters
offsetlongThe offset to check.
Returns
- bool
trueif the offset was traversed,falseotherwise.
GetAllInstructions()
Obtains all instruction records that were collected during the traversal.
public IEnumerable<TInstruction> GetAllInstructions()
Returns
- IEnumerable<TInstruction>
The instructions and their metadata.
GetInstructionAtOffset(long)
Gets the instruction at the provided address.
public TInstruction GetInstructionAtOffset(long offset)
Parameters
offsetlongThe address of the instruction to get.
Returns
- TInstruction
The instruction at the provided address.
GetSuccessorCount(long)
Obtains the number of successors of an instruction that were found during the traversal.
public int GetSuccessorCount(long offset)
Parameters
offsetlongThe offset of the instruction.
Returns
- int
The number of successors.
GetSuccessors(long, Span<SuccessorInfo>)
Obtains the registered successors of an instruction.
public int GetSuccessors(long offset, Span<SuccessorInfo> successorsBuffer)
Parameters
offsetlongThe offset.
successorsBufferSpan<SuccessorInfo>The buffer to write the successors into.
Returns
- int
The number of successors.
IsBlockHeader(long)
Determines whether an offset was marked as a block header during the traversal.
public bool IsBlockHeader(long offset)
Parameters
offsetlongThe offset to check.
Returns
- bool
trueif the offset was a block header,falseotherwise.
RegisterSuccessor(in TInstruction, SuccessorInfo)
Registers a successor for the provided instruction.
public void RegisterSuccessor(in TInstruction instruction, SuccessorInfo successorInfo)
Parameters
instructionTInstructionThe instruction.
successorInfoSuccessorInfoThe successor information.