Interface CodeBlockModel

All Known Subinterfaces:
SubroutineBlockModel
All Known Implementing Classes:
BasicBlockModel, IsolatedEntrySubModel, MultEntSubModel, OverlapCodeSubModel, PartitionCodeSubModel, SimpleBlockModel

public interface CodeBlockModel
An implementation of a CodeBlockModel will produce CodeBlocks based on some algorithm.
  • Field Details

    • emptyBlockArray

      static final CodeBlock[] emptyBlockArray
  • Method Details

    • getName

      String getName()
      Returns the model name.
      Returns:
      the model name
    • getCodeBlockAt

      CodeBlock getCodeBlockAt(Address addr, TaskMonitor monitor) throws CancelledException
      Get the code block with a starting address (i.e., entry-point) of addr.
      Parameters:
      addr - starting address of a codeblock.
      monitor - task monitor which allows user to cancel operation.
      Returns:
      null if there is no codeblock starting at the address.
      Throws:
      CancelledException - if the monitor cancels the operation.
    • getFirstCodeBlockContaining

      CodeBlock getFirstCodeBlockContaining(Address addr, TaskMonitor monitor) throws CancelledException
      Get the first code block that contains the given address.
      Parameters:
      addr - address to find a containing block.
      monitor - task monitor which allows user to cancel operation.
      Returns:
      a block that contains the address, or null otherwise.
      Throws:
      CancelledException - if the monitor cancels the operation.
    • getCodeBlocksContaining

      CodeBlock[] getCodeBlocksContaining(Address addr, TaskMonitor monitor) throws CancelledException
      Get all the code blocks containing the address.
      Parameters:
      addr - address to find a containing block.
      monitor - task monitor which allows user to cancel operation.
      Returns:
      an array of blocks that contains the address, null otherwise.
      Throws:
      CancelledException - if the monitor cancels the operation.
    • getCodeBlocks

      CodeBlockIterator getCodeBlocks(TaskMonitor monitor) throws CancelledException
      Get an iterator over the code blocks in the entire program.
      Parameters:
      monitor - task monitor which allows user to cancel operation.
      Throws:
      CancelledException - if the monitor cancels the operation.
    • getCodeBlocksContaining

      CodeBlockIterator getCodeBlocksContaining(AddressSetView addrSet, TaskMonitor monitor) throws CancelledException
      Get an iterator over code blocks which overlap the specified address set.
      Parameters:
      addrSet - an address set within program
      monitor - task monitor which allows user to cancel operation.
      Throws:
      CancelledException - if the monitor cancels the operation.
    • getSources

      Get an iterator over the source flows into the block.
      Parameters:
      block - the block to get the destination flows for.
      monitor - task monitor which allows user to cancel operation.
      Throws:
      CancelledException - if the monitor cancels the operation.
    • getNumSources

      int getNumSources(CodeBlock block, TaskMonitor monitor) throws CancelledException
      Get the number of source flows into the block.
      Parameters:
      block - the code blocks to get the destination flows for.
      monitor - task monitor which allows user to cancel operation.
      Throws:
      CancelledException - if the monitor cancels the operation.
    • getDestinations

      CodeBlockReferenceIterator getDestinations(CodeBlock block, TaskMonitor monitor) throws CancelledException
      Get an iterator over the destination flows out of the block.
      Parameters:
      block - the block to get the destination flows for.
      monitor - task monitor which allows user to cancel operation.
      Throws:
      CancelledException - if the monitor cancels the operation.
    • getNumDestinations

      int getNumDestinations(CodeBlock block, TaskMonitor monitor) throws CancelledException
      Get the number of destination flows out of the block.
      Parameters:
      block - the code blocks to get the destination flows for.
      monitor - task monitor which allows user to cancel operation.
      Throws:
      CancelledException - if the monitor cancels the operation.
    • getBasicBlockModel

      CodeBlockModel getBasicBlockModel()
      Get the basic block model used by this model.
    • externalsIncluded

      boolean externalsIncluded()
      Returns true if externals are handled by the model, false if externals are ignored. When handled, externals are represented by an ExtCodeBlockImpl.
    • getFlowType

      FlowType getFlowType(CodeBlock block)
      Return in general how things flow out of this node. If there are any abnormal ways to flow out of this node, (ie: jump, call, etc...) then the flow type of the node takes on that type. If there are multiple unique ways out of the node, then we should return FlowType.UNKNOWN (or FlowType.MULTIFLOW ?). Fallthrough is returned if that is the only way out.
      Returns:
      flow type of this node
    • getName

      String getName(CodeBlock block)
      Get a name for this block.
      Returns:
      usually the label at the start address of the block however the model can choose any name it wants for its blocks.
    • getProgram

      Program getProgram()
      Returns the program object associated with this CodeBlockModel instance.
      Returns:
      program associated with this CodeBlockModel.
    • allowsBlockOverlap

      boolean allowsBlockOverlap()
      Return true if this model allows overlapping of address sets for the blocks it returns.
      Returns:
      true if this model allows overlapping of address sets for the blocks it returns. This implies that getBlocksContaining() can return more than one block. false implies that getBlocksContaining() will return at most one block.