Class BasicBlockModel

java.lang.Object
ghidra.program.model.block.SimpleBlockModel
ghidra.program.model.block.BasicBlockModel
All Implemented Interfaces:
CodeBlockModel

public class BasicBlockModel extends SimpleBlockModel
This BlockModel implements the Basic block model. Each Codeblock is made up of contiguous instructions in address order. Blocks satisfy the following:
  1. Any instruction with a label starts a block.
  2. Each instruction that could cause program control flow to change local to the containing function (i.e., excludes calls) is the last instruction of a Codeblock.
  3. All other instructions are "NOP" fallthroughs, meaning after execution the program counter will be at the instruction immediately following.
  4. Any instruction that is unreachable and has no label is also considered the start of a block.
So a CodeBlock in this model consists of contiguous code that has zero or more fallthrough or call instructions followed by a single flow instruction. Each block may or may not have a label at the first instruction, but may not have a label at any other instruction contained in the block. This model handles delay slot instructions with the following assumptions:
  1. The delay slot depth of the delayed instruction will always correspond to the number of delay slot instructions immediately following the instruction. The model may not behave properly if the disassembled code violates this assumption.
See Also:
  • Field Details

  • Constructor Details

    • BasicBlockModel

      public BasicBlockModel(Program program)
    • BasicBlockModel

      public BasicBlockModel(Program program, boolean includeExternals)
  • Method Details

    • hasEndOfBlockFlow

      protected boolean hasEndOfBlockFlow(Instruction instr)
      Description copied from class: SimpleBlockModel
      Examine an instruction for out-bound flows which qualify it as an end-of-block.
      Overrides:
      hasEndOfBlockFlow in class SimpleBlockModel
      Returns:
      true if end-of-block flow exists from specified instruction.