Package ghidra.program.model.lang
Class InstructionSet
- java.lang.Object
- 
- ghidra.program.model.lang.InstructionSet
 
- 
- All Implemented Interfaces:
- java.lang.Iterable<InstructionBlock>
 
 public class InstructionSet extends java.lang.Object implements java.lang.Iterable<InstructionBlock> A set of instructions organized as a graph of basic blocks.
- 
- 
Constructor SummaryConstructors Constructor Description InstructionSet(AddressFactory addrFactory)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBlock(InstructionBlock block)Add an Instruction block to this Instruction Set.booleancontainsBlockAt(Address blockAddr)java.util.Iterator<InstructionBlock>emptyBlockIterator()Returns an iterator over all empty blocks which likely contain a conflict error.InstructionBlockfindFirstIntersectingBlock(Address min, Address max)Find the first block within this InstructionSet which intersects the specified range.AddressSetViewgetAddressSet()Returns the address set that makes up all the instructions contained in this set.java.util.List<InstructionError>getConflicts()Returns a list of conflicts for this set.InstructiongetInstructionAt(Address address)Returns the instruction at the specified address within this instruction setInstructionBlockgetInstructionBlockContaining(Address address)Returns the non-empty InstructionBlock containing the specified addressintgetInstructionCount()Returns the number of instructions in this instruction set.AddressgetMinAddress()Returns the minimum address for this Instruction set;booleanintersects(Address minAddress, Address maxAddress)Returns true if this instruction set intersects the specified rangejava.util.Iterator<InstructionBlock>iterator()Returns an iterator over the blocks in this Instruction set, giving preference to fall through flows.java.lang.StringtoString()
 
- 
- 
- 
Constructor Detail- 
InstructionSetpublic InstructionSet(AddressFactory addrFactory) 
 
- 
 - 
Method Detail- 
addBlockpublic void addBlock(InstructionBlock block) 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.
 
 - 
getInstructionBlockContainingpublic InstructionBlock getInstructionBlockContaining(Address address) Returns the non-empty InstructionBlock containing the specified address- Parameters:
- address-
- Returns:
- the InstructionBlock containing the specified address or null if not found
 
 - 
findFirstIntersectingBlockpublic InstructionBlock findFirstIntersectingBlock(Address min, Address max) 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 address
- max- the maximum intersection address
- Returns:
- block within this InstructionSet which intersects the specified range or null if not found
 
 - 
getInstructionAtpublic Instruction getInstructionAt(Address address) 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
 
 - 
getMinAddresspublic Address getMinAddress() Returns the minimum address for this Instruction set;- Returns:
- the minimum address for this Instruction set;
 
 - 
getAddressSetpublic AddressSetView 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.
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
getInstructionCountpublic int getInstructionCount() Returns the number of instructions in this instruction set.- Returns:
- the number of instructions in this instruction set.
 
 - 
containsBlockAtpublic boolean containsBlockAt(Address blockAddr) 
 - 
intersectspublic boolean intersects(Address minAddress, Address maxAddress) Returns true if this instruction set intersects the specified range- Parameters:
- minAddress-
- maxAddress-
- Returns:
- true if this instruction set intersects the specified range
 
 - 
iteratorpublic java.util.Iterator<InstructionBlock> 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:
- iteratorin interface- java.lang.Iterable<InstructionBlock>
 
 - 
emptyBlockIteratorpublic java.util.Iterator<InstructionBlock> emptyBlockIterator() Returns an iterator over all empty blocks which likely contain a conflict error.- Returns:
- empty block iterator
 
 - 
getConflictspublic java.util.List<InstructionError> 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.
 
 
- 
 
-