Table of Contents

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

TInstruction

The type of instructions that were traversed.

Inheritance
InstructionTraversalResult<TInstruction>
Implements
Inherited Members

Constructors

InstructionTraversalResult(IArchitecture<TInstruction>)

Creates a new instance of the InstructionTraversalResult<TInstruction> class.

public InstructionTraversalResult(IArchitecture<TInstruction> architecture)

Parameters

architecture IArchitecture<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

ISet<long>

Methods

AddInstruction(in TInstruction)

Adds a single instruction to the traversal result.

public void AddInstruction(in TInstruction instruction)

Parameters

instruction TInstruction

The instruction to add.

ClearSuccessors(in TInstruction)

Clears all registered successors for the provided instruction.

public void ClearSuccessors(in TInstruction instruction)

Parameters

instruction TInstruction

The instruction.

ContainsInstruction(long)

Determines whether an offset was traversed and interpreted as an instruction.

public bool ContainsInstruction(long offset)

Parameters

offset long

The offset to check.

Returns

bool

true if the offset was traversed, false otherwise.

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

offset long

The 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

offset long

The 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

offset long

The offset.

successorsBuffer Span<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

offset long

The offset to check.

Returns

bool

true if the offset was a block header, false otherwise.

RegisterSuccessor(in TInstruction, SuccessorInfo)

Registers a successor for the provided instruction.

public void RegisterSuccessor(in TInstruction instruction, SuccessorInfo successorInfo)

Parameters

instruction TInstruction

The instruction.

successorInfo SuccessorInfo

The successor information.