Package ghidra.program.model.lang
Class InstructionSet
java.lang.Object
ghidra.program.model.lang.InstructionSet
- All Implemented Interfaces:
Iterable<InstructionBlock>
A set of instructions organized as a graph of basic blocks.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBlock
(InstructionBlock block) Add an Instruction block to this Instruction Set.boolean
containsBlockAt
(Address blockAddr) Returns an iterator over all empty blocks which likely contain a conflict error.findFirstIntersectingBlock
(Address min, Address max) Find the first block within this InstructionSet which intersects the specified range.Returns the address set that makes up all the instructions contained in this set.Returns a list of conflicts for this set.getInstructionAt
(Address address) Returns the instruction at the specified address within this instruction setgetInstructionBlockContaining
(Address address) Returns the non-empty InstructionBlock containing the specified addressint
Returns the number of instructions in this instruction set.Returns the minimum address for this Instruction set;boolean
intersects
(Address minAddress, Address maxAddress) Returns true if this instruction set intersects the specified rangeiterator()
Returns an iterator over the blocks in this Instruction set, giving preference to fall through flows.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
InstructionSet
-
-
Method Details
-
addBlock
Add an Instruction block to this Instruction Set. If the block is empty it will only be added to the empty-list and will not be added to the maps or block iterator- Parameters:
block
- the block to add.
-
getInstructionBlockContaining
Returns the non-empty InstructionBlock containing the specified address- Parameters:
address
-- Returns:
- the InstructionBlock containing the specified address or null if not found
-
findFirstIntersectingBlock
Find the first block within this InstructionSet which intersects the specified range. This method should be used sparingly since it uses a brute-force search.- Parameters:
min
- the minimum intersection addressmax
- the maximum intersection address- Returns:
- block within this InstructionSet which intersects the specified range or null if not found
-
getInstructionAt
Returns the instruction at the specified address within this instruction set- Parameters:
address
-- Returns:
- instruction at the specified address within this instruction set or null if not found
-
getMinAddress
Returns the minimum address for this Instruction set;- Returns:
- the minimum address for this Instruction set;
-
getAddressSet
Returns the address set that makes up all the instructions contained in this set.- Returns:
- the address set that makes up all the instructions contained in this set.
-
toString
-
getInstructionCount
public int getInstructionCount()Returns the number of instructions in this instruction set.- Returns:
- the number of instructions in this instruction set.
-
containsBlockAt
-
intersects
Returns true if this instruction set intersects the specified range- Parameters:
minAddress
-maxAddress
-- Returns:
- true if this instruction set intersects the specified range
-
iterator
Returns an iterator over the blocks in this Instruction set, giving preference to fall through flows. This iterator will not follow any flows from a block that has a conflict. If the last block returned from the iterator is marked as a conflict before the next() or hasNext() methods are called, then this iterator will respect the conflict. In other words, this iterator follows block flows on the fly and doesn't pre-compute the blocks to return. Also, if any blocks in this set don't have a flow to path from the start block, it will not be included in this iterator.- Specified by:
iterator
in interfaceIterable<InstructionBlock>
-
emptyBlockIterator
Returns an iterator over all empty blocks which likely contain a conflict error.- Returns:
- empty block iterator
-
getConflicts
Returns a list of conflicts for this set. If a block is not reachable from a non-conflicted block, it's conflicts(if any) will not be included.- Returns:
- the list of conflicts for this set.
-