Package ghidra.program.model.block
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Return true if this model allows overlapping of address sets for the blocks it returns.boolean
Returns true if externals are handled by the model, false if externals are ignored.Get the basic block model used by this model.getCodeBlockAt
(Address addr, TaskMonitor monitor) Get the code block with a starting address (i.e., entry-point) of addr.getCodeBlocks
(TaskMonitor monitor) Get an iterator over the code blocks in the entire program.getCodeBlocksContaining
(Address addr, TaskMonitor monitor) Get all the code blocks containing the address.getCodeBlocksContaining
(AddressSetView addrSet, TaskMonitor monitor) Get an iterator over code blocks which overlap the specified address set.getDestinations
(CodeBlock block, TaskMonitor monitor) Get an iterator over the destination flows out of the block.getFirstCodeBlockContaining
(Address addr, TaskMonitor monitor) Get the first code block that contains the given address.getFlowType
(CodeBlock block) Return in general how things flow out of this node.getName()
Returns the model name.Get a name for this block.int
getNumDestinations
(CodeBlock block, TaskMonitor monitor) Get the number of destination flows out of the block.int
getNumSources
(CodeBlock block, TaskMonitor monitor) Get the number of source flows into the block.Returns the program object associated with this CodeBlockModel instance.getSources
(CodeBlock block, TaskMonitor monitor) Get an iterator over the source flows into the block.
-
Field Details
-
emptyBlockArray
-
-
Method Details
-
getName
String getName()Returns the model name.- Returns:
- the model name
-
getCodeBlockAt
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
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
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
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 programmonitor
- task monitor which allows user to cancel operation.- Throws:
CancelledException
- if the monitor cancels the operation.
-
getSources
CodeBlockReferenceIterator getSources(CodeBlock block, TaskMonitor monitor) throws CancelledException 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
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
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
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
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.
-