public interface

IControlFlowGraph

com.pnfsoftware.jeb.core.units.code.IControlFlowGraph<InsnType extends com.pnfsoftware.jeb.core.units.code.IInstruction>
Known Indirect Subclasses

Class Overview

Generic interface for control flow graph objects.

Summary

Public Methods
abstract IBasicBlock<InsnType> get(int index)
Retrieve a basic block.
abstract IBasicBlock<InsnType> getBlock(int index)
abstract IBasicBlock<InsnType> getBlockAt(long base)
Get the basic block that starts at the provided address or offset.
abstract IBasicBlock<InsnType> getBlockContaining(long address)
Get the basic block that contains the provided address.
abstract IBasicBlock<InsnType> getBlockEndingAt(long end)
abstract List<? extends IBasicBlock<InsnType>> getBlocks()
Get a copy of the block list of the CFG.
abstract List<? extends IBasicBlock<InsnType>> getBlocksView()
Get a read-only view of the list of blocks for this CFG.
abstract int getEffectiveSize()
Calculate the 'effective' size of this CFG, that is, the sum of the size of each basic block.
abstract long getEndAddress()
Routine highest address (exclusive).
abstract long getEntryAddress()
Routine entry-point address.
abstract IBasicBlock<InsnType> getEntryBlock()
Get the entry block.
abstract List<? extends IBasicBlock<InsnType>> getExitBlocks()
Get the ordered list of exit blocks.
abstract long getFirstAddress()
Routine lowest address (inclusive).
abstract void getGraphRepresentation(List<int[]> edges, List<int[]> irregularEdges)
Get the a graph representation of the CFG.
abstract InsnType getInstruction(long address)
Get the instruction located at the exact address.
abstract int getInstructionCount()
Get the total number of instructions in the CFG.
abstract Couple<? extends IBasicBlock<InsnType>, Integer> getInstructionLocation(long address)
Locate an instruction.
abstract List<InsnType> getInstructions()
Get the instruction list of this CFG by aggregating each instruction of every block.
abstract long getLastAddress()
Routine highest address (inclusive).
abstract int indexOf(IBasicBlock<InsnType> b)
abstract int size()
Get the number of blocks.

Public Methods

public abstract IBasicBlock<InsnType> get (int index)

Retrieve a basic block.

public abstract IBasicBlock<InsnType> getBlock (int index)

public abstract IBasicBlock<InsnType> getBlockAt (long base)

Get the basic block that starts at the provided address or offset.

Parameters
base the block address/offset
Returns
  • basic block, or null if none starts at that address

public abstract IBasicBlock<InsnType> getBlockContaining (long address)

Get the basic block that contains the provided address.

Note that the address just needs to be in the block address range; it does not need to point to the beginning of an instruction within the block

Parameters
address an address within the block

public abstract IBasicBlock<InsnType> getBlockEndingAt (long end)

public abstract List<? extends IBasicBlock<InsnType>> getBlocks ()

Get a copy of the block list of the CFG. The list is ordered by ascending block address. Modifying the list does not impact the CFG.

Returns
  • a copy of the list of blocks

public abstract List<? extends IBasicBlock<InsnType>> getBlocksView ()

Get a read-only view of the list of blocks for this CFG. The list is ordered by ascending block address.

Returns
  • the list of blocks

public abstract int getEffectiveSize ()

Calculate the 'effective' size of this CFG, that is, the sum of the size of each basic block.

Returns
  • the CFG size

public abstract long getEndAddress ()

Routine highest address (exclusive).

public abstract long getEntryAddress ()

Routine entry-point address. Note that this address may not be the lowest one in the CFG.

Returns
  • the address of the entry block

public abstract IBasicBlock<InsnType> getEntryBlock ()

Get the entry block. The entry block is unique.

Returns
  • never null; the method throws on error

public abstract List<? extends IBasicBlock<InsnType>> getExitBlocks ()

Get the ordered list of exit blocks. A CFG may have zero or more exit blocks; CFG representing standard routines will have at least one (generally one) exit block.

Returns
  • a collection of blocks, possibly empty

public abstract long getFirstAddress ()

Routine lowest address (inclusive). Note that this address may not be the entry-point address for this routine.

public abstract void getGraphRepresentation (List<int[]> edges, List<int[]> irregularEdges)

Get the a graph representation of the CFG. The list of edges return use a 1-based node numbering scheme.

Parameters
edges (output) array of regular edges, eg: {{1,2},{1,3},{2,3}}
irregularEdges (output) array of irregular edges

public abstract InsnType getInstruction (long address)

Get the instruction located at the exact address.

Returns
  • an instruction, null if none

public abstract int getInstructionCount ()

Get the total number of instructions in the CFG. This method sums the number of instructions of each block of the CFG.

public abstract Couple<? extends IBasicBlock<InsnType>, Integer> getInstructionLocation (long address)

Locate an instruction.

Parameters
address instruction address
Returns
  • a couple (basic block, instruction index within that block); null on error

public abstract List<InsnType> getInstructions ()

Get the instruction list of this CFG by aggregating each instruction of every block. The list is ordered by ascending address/offset.

public abstract long getLastAddress ()

Routine highest address (inclusive).

public abstract int indexOf (IBasicBlock<InsnType> b)

public abstract int size ()

Get the number of blocks.