public class

BasicBlock

extends Object
implements IBasicBlock<InsnType extends IInstruction> Iterable<T>
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.android.controlflow.BasicBlock<InsnType extends com.pnfsoftware.jeb.core.units.code.ILocatedInstruction>

Class Overview

This class represents a basic block of generic instructions.

See Also

Summary

Public Constructors
BasicBlock()
Create a new empty basic block.
Public Methods
void add(InsnType insn)
DANGEROUS! Append an instruction to the block.
int allinsize()
Get the total number of input edges to this block.
int alloutsize()
boolean canThrow()
InsnType get(int index)
Get the instruction at the specified index.
long getAddress()
long getAddressOfInstruction(int index)
List<BasicBlock<InsnType>> getAllInputBlocks()
List<BasicBlock<InsnType>> getAllOutputBlocks()
Get regular and irregular output blocks.
long getEndAddress()
Address following the last instruction of the block (ie, last exclusive address).
long getFirstAddress()
Address of first instruction in the block.
int getIndexOfInstruction(long address)
BasicBlock<InsnType> getInputBlock(int index)
Get a regular input block.
List<BasicBlock<InsnType>> getInputBlocks()
Get the regular input blocks.
List<BasicBlock<InsnType>> getInputs()
Retrieve a read-only list of input blocks (regular).
InsnType getInstruction(int index)
List<InsnType> getInstructions()
Get a copy of the list of instructions that make up this basic block.
BasicBlock<InsnType> getIrregularInputBlock(int index)
Get an irregular input block.
List<BasicBlock<InsnType>> getIrregularInputBlocks()
List<BasicBlock<InsnType>> getIrregularInputs()
Retrieve a read-only list of irregular input blocks.
BasicBlock<InsnType> getIrregularOutputBlock(int index)
Get an irregular output block.
List<BasicBlock<InsnType>> getIrregularOutputBlocks()
Get irregular output blocks.
List<Long> getIrregularOutputOffsets()
List<BasicBlock<InsnType>> getIrregularOutputs()
Retrieve a read-only list of irregular output blocks.
InsnType getLast()
Get the last instruction of the block.
long getLastAddress()
Address of last instruction in the block.
BasicBlock<InsnType> getOutputBlock(int index)
Get a regular output block.
List<BasicBlock<InsnType>> getOutputBlocks()
Get the regular output blocks.
List<Long> getOutputOffsets()
List<BasicBlock<InsnType>> getOutputs()
Retrieve a read-only list of output blocks (regular).
int getSizeOfInstructions()
int insize()
Get the number of regular input edges to this block.
int irrinsize()
Get the number of irregular input edges to this block.
int irroutsize()
boolean isEmpty()
Determine if the block has 0 instruction.
boolean isInfiniteLoop()
Check if the block has a single regular out-edge which points to itself.
boolean isSelfReferencing()
Check if the block has at least one regular out-edge pointing to itself.
Iterator<InsnType> iterator()
int outsize()
InsnType remove(int index)
DANGEROUS! Remove an instruction from the block.
InsnType set(int index, InsnType insn)
Replace an instruction.
int size()
Get the number of instructions in the block.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.units.code.IBasicBlock
From interface java.lang.Iterable

Public Constructors

public BasicBlock ()

Create a new empty basic block.

Public Methods

public void add (InsnType insn)

DANGEROUS! Append an instruction to the block.

The instruction is appended to the block. The edges are not updated.
The caller is solely responsible for maintaining the consistency of the block and of the CFG.

Parameters
insn the instruction to be appended

public int allinsize ()

Get the total number of input edges to this block.

public int alloutsize ()

public boolean canThrow ()

public InsnType get (int index)

Get the instruction at the specified index.

public long getAddress ()

public long getAddressOfInstruction (int index)

public List<BasicBlock<InsnType>> getAllInputBlocks ()

public List<BasicBlock<InsnType>> getAllOutputBlocks ()

Get regular and irregular output blocks.

Returns
  • a copy of the list of all output blocks

public long getEndAddress ()

Address following the last instruction of the block (ie, last exclusive address).

public long getFirstAddress ()

Address of first instruction in the block.

public int getIndexOfInstruction (long address)

public BasicBlock<InsnType> getInputBlock (int index)

Get a regular input block.

Parameters
index block index
Returns
  • a block

public List<BasicBlock<InsnType>> getInputBlocks ()

Get the regular input blocks.

Returns
  • a copy of the list of regular input blocks

public List<BasicBlock<InsnType>> getInputs ()

Retrieve a read-only list of input blocks (regular).

NOTE: This method is faster than getInputBlocks() since it does not provide a copy of the list.

public InsnType getInstruction (int index)

public List<InsnType> getInstructions ()

Get a copy of the list of instructions that make up this basic block.

public BasicBlock<InsnType> getIrregularInputBlock (int index)

Get an irregular input block.

Parameters
index block index
Returns
  • a block

public List<BasicBlock<InsnType>> getIrregularInputBlocks ()

public List<BasicBlock<InsnType>> getIrregularInputs ()

Retrieve a read-only list of irregular input blocks.

NOTE: This method is faster than getIrregularInputBlocks() since it does not provide a copy of the list.

public BasicBlock<InsnType> getIrregularOutputBlock (int index)

Get an irregular output block.

public List<BasicBlock<InsnType>> getIrregularOutputBlocks ()

Get irregular output blocks.

Returns
  • a copy of the list of irregular output blocks

public List<Long> getIrregularOutputOffsets ()

public List<BasicBlock<InsnType>> getIrregularOutputs ()

Retrieve a read-only list of irregular output blocks.

NOTE: This method is faster than getIrregularOutputBlocks() since it does not provide a copy of the list.

public InsnType getLast ()

Get the last instruction of the block.

public long getLastAddress ()

Address of last instruction in the block.

public BasicBlock<InsnType> getOutputBlock (int index)

Get a regular output block.

public List<BasicBlock<InsnType>> getOutputBlocks ()

Get the regular output blocks.

Returns
  • a copy of the list of regular output blocks

public List<Long> getOutputOffsets ()

public List<BasicBlock<InsnType>> getOutputs ()

Retrieve a read-only list of output blocks (regular).

NOTE: This method is faster than getOutputBlocks() since it does not provide a copy of the list.

public int getSizeOfInstructions ()

public int insize ()

Get the number of regular input edges to this block.

public int irrinsize ()

Get the number of irregular input edges to this block.

public int irroutsize ()

public boolean isEmpty ()

Determine if the block has 0 instruction.

public boolean isInfiniteLoop ()

Check if the block has a single regular out-edge which points to itself.

public boolean isSelfReferencing ()

Check if the block has at least one regular out-edge pointing to itself.

public Iterator<InsnType> iterator ()

public int outsize ()

public InsnType remove (int index)

DANGEROUS! Remove an instruction from the block.

The instruction is removed from the block. The edges are not updated. The block may end up empty.

Returns
  • true if the CFG need refreshing

public InsnType set (int index, InsnType insn)

Replace an instruction. Sizes must match.

Parameters
insn the instruction
Returns
  • the instruction that was replaced

public int size ()

Get the number of instructions in the block.

public String toString ()