Package ghidra.program.model.block

# 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:
  - `CodeBlockModel`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `NAME`

  ### Fields inherited from class ghidra.program.model.block.SimpleBlockModel

  `emptyArray, followIndirectFlows, foundBlockMap, includeExternals, listing, program, referenceMgr`

  ### Fields inherited from interface ghidra.program.model.block.CodeBlockModel

  `emptyBlockArray`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BasicBlockModel(Program program)`
  `BasicBlockModel(Program program, boolean includeExternals)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `hasEndOfBlockFlow(Instruction instr)`
  Examine an instruction for out-bound flows which qualify it as an end-of-block.

  ### Methods inherited from class ghidra.program.model.block.SimpleBlockModel

  `allowsBlockOverlap, createSimpleDataBlock, externalsIncluded, getBasicBlockModel, getCodeBlockAt, getCodeBlocks, getCodeBlocksContaining, getCodeBlocksContaining, getDestinations, getFirstCodeBlockContaining, getFlowType, getListing, getName, getName, getNumDestinations, getNumSources, getProgram, getSources, isBlockStart, isBlockStart`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NAME

    public static final String NAME
    See Also:
      - Constant Field Values

- ## 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.