Package ghidra.program.model.listing
Interface Listing
- All Known Implementing Classes:
StubListing
public interface Listing
This interface provides all the methods needed to create,delete, retrieve,
modify code level constructs (CodeUnits, Macros, Fragments, and Modules).
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The name of the default tree in the display. -
Method Summary
Modifier and TypeMethodDescriptionaddInstructions
(InstructionSet instructionSet, boolean overwrite) Creates a complete set of instructions.void
clearAll
(boolean clearContext, TaskMonitor monitor) Removes all CodeUnits, comments, properties, and references from the listing.void
clearCodeUnits
(Address startAddr, Address endAddr, boolean clearContext) Clears any code units in the given range returning everything to "db"s, and removing any references in the affected area.void
clearCodeUnits
(Address startAddr, Address endAddr, boolean clearContext, TaskMonitor monitor) Clears any code units in the given range returning everything to "db"s, and removing any references in the affected area.void
clearComments
(Address startAddr, Address endAddr) Clears the comments in the given range.void
clearProperties
(Address startAddr, Address endAddr, TaskMonitor monitor) Clears the properties in the given range.createData
(Address addr, DataType dataType) Creates a new defined Data object at the given address.createData
(Address addr, DataType dataType, int length) Creates a new defined Data object of a given length at the given address.createFunction
(String name, Address entryPoint, AddressSetView body, SourceType source) Create a function with an entry point and a body of addresses.createFunction
(String name, Namespace nameSpace, Address entryPoint, AddressSetView body, SourceType source) Create a function in the specified namespace with an entry point and a body of addresses.createInstruction
(Address addr, InstructionPrototype prototype, MemBuffer memBuf, ProcessorContextView context, int length) Creates a new Instruction object at the given address.createRootModule
(String treeName) Create a new tree that will be identified by the given name.getCodeUnitAfter
(Address addr) get the next code unit that starts an an address that is greater than the given address.getCodeUnitAt
(Address addr) get the code unit that starts at the given address.getCodeUnitBefore
(Address addr) get the next code unit that starts at an address that is less than the given address.getCodeUnitContaining
(Address addr) get the code unit that contains the given address.getCodeUnitIterator
(String property, boolean forward) Get an iterator that contains all code units in the program which have the specified property type defined.getCodeUnitIterator
(String property, Address addr, boolean forward) Get an iterator that contains the code units which have the specified property type defined.getCodeUnitIterator
(String property, AddressSetView addrSet, boolean forward) Get an iterator that contains the code units which have the specified property type defined.getCodeUnits
(boolean forward) get a CodeUnit iterator that will iterate over the entire address space.getCodeUnits
(Address addr, boolean forward) Returns an iterator of the code units in this listing (in proper sequence), starting at the specified address.getCodeUnits
(AddressSetView addrSet, boolean forward) Get an iterator over the address range(s).getComment
(int commentType, Address address) Get the comment for the given type at the specified address.getCommentAddressIterator
(int commentType, AddressSetView addrSet, boolean forward) Get a forward iterator over addresses that have the specified comment type.getCommentAddressIterator
(AddressSetView addrSet, boolean forward) Get a forward iterator over addresses that have any type of comment.getCommentCodeUnitIterator
(int commentType, AddressSetView addrSet) Get a forward code unit iterator over code units that have the specified comment type.getCommentHistory
(Address addr, int commentType) Get the comment history for comments at the given address.getCompositeData
(boolean forward) Get an iterator over all the composite data objects (Arrays, Structures, and Union) in the program.getCompositeData
(Address start, boolean forward) Get an iterator over all the composite data objects (Arrays, Structures, and Union) in the program at or after the given Address.getCompositeData
(AddressSetView addrSet, boolean forward) Get an iterator over all the composite data objects (Arrays, Structures, and Union) within the specified address set in the program.getData
(boolean forward) get a Data iterator that will iterate over the entire address space; returning both defined and undefined Data objects.Returns an iterator of the data in this listing (in proper sequence), starting at the specified address.getData
(AddressSetView addrSet, boolean forward) Get an iterator over the address range(s).getDataAfter
(Address addr) get the closest Data object that starts at an address that is greater than the given address.get the Data (Defined or Undefined) that starts at the given address.getDataBefore
(Address addr) get the closest Data object that starts at an address that is less than the given address.getDataContaining
(Address addr) Gets the data object that is at or contains the given address or null if the address in not in memory or is in an instruction.Get the data type manager for the program.Returns the root module for the default program tree.Returns the next instruction or defined data after the given address;Returns the closest instruction or defined data that starts before the given address.getDefinedData
(boolean forward) get a Data iterator that will iterate over the entire address space; returning only defined Data objects.getDefinedData
(Address addr, boolean forward) Returns an iterator of the defined data in this listing (in proper sequence), starting at the specified address.getDefinedData
(AddressSetView addrSet, boolean forward) Get an iterator over the address range(s).getDefinedDataAfter
(Address addr) get the defined Data object that starts at an address that is greater than the given address.getDefinedDataAt
(Address addr) get the Data (defined) object that starts at the given address.getDefinedDataBefore
(Address addr) get the closest defined Data object that starts at an address that is less than the given address.get the Data object that starts at the given address.Get an iterator over all external functionsgetFirstUndefinedData
(AddressSetView set, TaskMonitor monitor) Get the undefined Data object that falls within the set.getFragment
(String treeName, Address addr) Returns the fragment containing the given address.getFragment
(String treeName, String name) Returns the fragment with the given name.getFunctionAt
(Address entryPoint) Get a function with a given entry point.getFunctionContaining
(Address addr) Get a function containing an address.getFunctions
(boolean forward) Get an iterator over all functionsgetFunctions
(Address start, boolean forward) Get an iterator over all functions starting at addressgetFunctions
(AddressSetView asv, boolean forward) Get an iterator over all functions with entry points in the address set.getFunctions
(String namespace, String name) Returns a list of all functions with the given name in the given namespace.getGlobalFunctions
(String name) Returns a list of all global functions with the given name.getInstructionAfter
(Address addr) get the closest Instruction that starts at an address that is greater than the given address.getInstructionAt
(Address addr) get the Instruction that starts at the given address.getInstructionBefore
(Address addr) get the closest Instruction that starts at an address that is less than the given address.get the Instruction that contains the given address.getInstructions
(boolean forward) get an Instruction iterator that will iterate over the entire address space.getInstructions
(Address addr, boolean forward) Returns an iterator of the instructions in this listing (in proper sequence), starting at the specified address.getInstructions
(AddressSetView addrSet, boolean forward) Get an Instruction iterator over the address range(s).Returns the module with the given name.long
gets the total number of CodeUnits (Instructions, defined Data, and undefined Data)long
gets the total number of defined Data objects in the listing.long
gets the total number of Instructions in the listing.getPropertyMap
(String propertyName) Returns the PropertyMap associated with the given namegetRootModule
(long treeID) Returns the root module of the program tree with the given name;getRootModule
(String treeName) Gets the root module for a tree in this listing.String[]
Get the names of all the trees defined in this listing.getUndefinedDataAfter
(Address addr, TaskMonitor monitor) Get the undefined Data object that starts at an address that is greater than the given address.getUndefinedDataAt
(Address addr) get the Data (undefined) object that starts at the given address.getUndefinedDataBefore
(Address addr, TaskMonitor monitor) get the closest undefined Data object that starts at an address that is less than the given address.getUndefinedRanges
(AddressSetView set, boolean initializedMemoryOnly, TaskMonitor monitor) Get the address set which corresponds to all undefined code units within the specified set of address.Returns an iterator over all user defined property names.boolean
isInFunction
(Address addr) Check if an address is contained in a functionboolean
isUndefined
(Address start, Address end) Checks if the given ranges consists entirely of undefined data.void
removeFunction
(Address entryPoint) Remove a function a given entry point.boolean
removeTree
(String treeName) Remove the tree rooted at the given name.void
removeUserDefinedProperty
(String propertyName) Removes the entire property from the programvoid
renameTree
(String oldName, String newName) Rename the tree.void
setComment
(Address address, int commentType, String comment) Set the comment for the given comment type at the specified address.
-
Field Details
-
DEFAULT_TREE_NAME
The name of the default tree in the display.- See Also:
-
-
Method Details
-
getCodeUnitAt
get the code unit that starts at the given address.- Parameters:
addr
- the address to look for a codeUnit.- Returns:
- the codeUnit that begins at the given address
-
getCodeUnitContaining
get the code unit that contains the given address.- Parameters:
addr
- the address to look for a codeUnit.- Returns:
- the codeUnit that contains the given address
-
getCodeUnitAfter
get the next code unit that starts an an address that is greater than the given address. The search will include instructions, defined data, and undefined data.- Parameters:
addr
- the address from which to search forward.- Returns:
- the next CodeUnit found while searching forward from addr or null if none found.
-
getCodeUnitBefore
get the next code unit that starts at an address that is less than the given address. The search will include instructions, defined data, and undefined data.- Parameters:
addr
- the address from which to search backwards.- Returns:
- The first codeUnit found while searching backwards from addr or null if none found.
-
getCodeUnitIterator
Get an iterator that contains all code units in the program which have the specified property type defined. Standard property types are defined in the CodeUnit class. The property types are: EOL_COMMENT, PRE_COMMENT, POST_COMMENT, USER_REFERENCE, MNEMONIC_REFERENCE, VALUE_REFERENCE. Property types can also be user defined.- Parameters:
property
- the name of the property type.forward
- true means get iterator in forward direction- Returns:
- a CodeUnitIterator that returns all code units from the indicated start address that have the specified property type defined.
-
getCodeUnitIterator
Get an iterator that contains the code units which have the specified property type defined. Only code units at an address greater than or equal to the specified start address will be returned by the iterator. If the start address is null then check the entire program. Standard property types are defined in the CodeUnit class. The property types are: EOL_COMMENT, PRE_COMMENT, POST_COMMENT, USER_REFERENCE, MNEMONIC_REFERENCE, VALUE_REFERENCE. Property types can also be user defined.- Parameters:
property
- the name of the property type. (EOL_COMMENT, PRE_COMMENT, POST_COMMENT, USER_REFERENCE, MNEMONIC_REFERENCE, VALUE_REFERENCE)addr
- the start addressforward
- true means get iterator in forward direction- Returns:
- a CodeUnitIterator that returns all code units from the indicated start address that have the specified property type defined.
-
getCodeUnitIterator
Get an iterator that contains the code units which have the specified property type defined. Only code units starting within the address set will be returned by the iterator. If the address set is null then check the entire program. Standard property types are defined in the CodeUnit class.- Parameters:
property
- the name of the property type.addrSet
- the address setforward
- true means get iterator in forward direction- Returns:
- a CodeUnitIterator that returns all code units from the indicated address set that have the specified property type defined.
-
getCommentCodeUnitIterator
Get a forward code unit iterator over code units that have the specified comment type.- Parameters:
commentType
- type defined in CodeUnitaddrSet
- address set- Returns:
- a CodeUnitIterator that returns all code units from the indicated address set that have the specified comment type defined
-
getCommentAddressIterator
Get a forward iterator over addresses that have the specified comment type.- Parameters:
commentType
- type defined in CodeUnitaddrSet
- address setforward
- true to iterator from lowest address to highest, false highest to lowest- Returns:
- an AddressIterator that returns all addresses from the indicated address set that have the specified comment type defined
-
getCommentAddressIterator
Get a forward iterator over addresses that have any type of comment.- Parameters:
addrSet
- address setforward
- true to iterator from lowest address to highest, false highest to lowest- Returns:
- an AddressIterator that returns all addresses from the indicated address set that have any type of comment.
-
getComment
Get the comment for the given type at the specified address.- Parameters:
commentType
- either EOL_COMMENT, PRE_COMMENT, POST_COMMENT, PLATE_COMMENT, or REPEATABLE_COMMENTaddress
- the address of the comment.- Returns:
- the comment string of the appropriate type or null if no comment of that type exists for this code unit
- Throws:
IllegalArgumentException
- if type is not one of the types of comments supported
-
setComment
Set the comment for the given comment type at the specified address.- Parameters:
address
- the address of the comment.commentType
- either EOL_COMMENT, PRE_COMMENT, POST_COMMENT, PLATE_COMMENT, or REPEATABLE_COMMENTcomment
- comment to set at the address- Throws:
IllegalArgumentException
- if type is not one of the types of comments supported
-
getCodeUnits
get a CodeUnit iterator that will iterate over the entire address space.- Parameters:
forward
- true means get iterator in forward direction- Returns:
- a CodeUnitIterator in forward direction
-
getCodeUnits
Returns an iterator of the code units in this listing (in proper sequence), starting at the specified address. The specified address indicates the first code unit that would be returned by an initial call to thenext
method. An initial call to theprevious
method would return the code unit with an address less than the specified address.- Parameters:
addr
- the start address of the iterator.forward
- true means get iterator in forward direction- Returns:
- a CodeUnitIterator positioned just before addr.
-
getCodeUnits
Get an iterator over the address range(s). Only code units whose start addresses are contained in the given address set will be returned by the iterator.- Parameters:
addrSet
- the AddressRangeSet to iterate over (required).forward
- true means get iterator in forward direction- Returns:
- a CodeUnitIterator that is restricted to the give AddressRangeSet.
-
getInstructionAt
get the Instruction that starts at the given address. If no Instruction has been defined to start at that address, return null.- Parameters:
addr
- the address to check for the start of an instruction- Returns:
- the Instruction object that starts at addr; or null if no Instructions starts at addr.
-
getInstructionContaining
get the Instruction that contains the given address. If an Instruction is defined that contains that address, it will be returned. Otherwise, null will be returned.- Parameters:
addr
- the address to check for containment in an Instruction.- Returns:
- the Instruction object that contains addr; or null if no Instructions contain addr.
-
getInstructionAfter
get the closest Instruction that starts at an address that is greater than the given address.- Parameters:
addr
- The address at which to begin the forward search.- Returns:
- the next Instruction whose starting address is greater than addr.
-
getInstructionBefore
get the closest Instruction that starts at an address that is less than the given address.- Parameters:
addr
- The address at which to begin the backward search.- Returns:
- the closest Instruction whose starting address is less than addr.
-
getInstructions
get an Instruction iterator that will iterate over the entire address space.- Parameters:
forward
- true means get iterator in forward direction- Returns:
- an InstructionIterator that iterates over all instructions in the program.
-
getInstructions
Returns an iterator of the instructions in this listing (in proper sequence), starting at the specified address. The specified address indicates the first instruction that would be returned by an initial call to thenext
method. An initial call to theprevious
method would return the instruction with an address less than the specified address.- Parameters:
addr
- the initial position of the iteratorforward
- true means get iterator in forward direction- Returns:
- an InstructionIterator that iterates over all Instruction objects in the given address range set.
-
getInstructions
Get an Instruction iterator over the address range(s). Only instructions whose start addresses are contained in the given address set will be returned by the iterator.- Parameters:
addrSet
- the address range set to iterate over.forward
- true means get iterator in forward direction- Returns:
- a DataIterator that iterates over all defined and undefined Data objects in the given address range set.
-
getDataAt
get the Data (Defined or Undefined) that starts at the given address.- Parameters:
addr
- the address to check for a Data object.- Returns:
- the Data object that starts at addr; or null if no Data objects(defined or undefined) start at addr.
-
getDataContaining
Gets the data object that is at or contains the given address or null if the address in not in memory or is in an instruction.- Parameters:
addr
- the address for which to find its containing data element.- Returns:
- the Data object containing the given address or null if there is no data that contains the address.
-
getDataAfter
get the closest Data object that starts at an address that is greater than the given address.- Parameters:
addr
- the address at which to begin the forward search.- Returns:
- the next Data object whose starting address is greater than addr.
-
getDataBefore
get the closest Data object that starts at an address that is less than the given address.- Parameters:
addr
- The address at which to begin the backward search.- Returns:
- the closest Data object whose starting address is less than addr.
-
getData
get a Data iterator that will iterate over the entire address space; returning both defined and undefined Data objects.- Parameters:
forward
- true means get iterator in forward direction- Returns:
- a DataIterator that iterates over all defined and undefined Data object in the program.
-
getData
Returns an iterator of the data in this listing (in proper sequence), starting at the specified address. The specified address indicates the first Data that would be returned by an initial call to thenext
method. An initial call to theprevious
method would return the Data with an address less than the specified address.- Parameters:
addr
- the initial position of the iteratorforward
- true means get iterator in forward direction- Returns:
- a DataIterator that iterates over all Data objects in the given address range set.
-
getData
Get an iterator over the address range(s). Only data whose start addresses are contained in the given address set will be returned by the iterator.- Parameters:
addrSet
- the address range set to iterate over.forward
- true means get iterator in forward direction- Returns:
- a DataIterator that iterates over all defined and undefined Data objects in the given address range set.
-
getDefinedDataAt
get the Data (defined) object that starts at the given address. If no Data object is defined at that address, then return null.- Parameters:
addr
- The address to check for defined Data.- Returns:
- a Data object that starts at addr, or null if no Data object has been defined to start at addr.
-
getDefinedDataContaining
get the Data object that starts at the given address. If no Data objects have been defined that contain that address, then return null.- Parameters:
addr
- the address to check for containment in a defined Data object.- Returns:
- the defined Data object containing addr.
-
getDefinedDataAfter
get the defined Data object that starts at an address that is greater than the given address.- Parameters:
addr
- the address at which to begin the forward search.- Returns:
- the next defined Data object whose starting address is greater than addr.
-
getDefinedDataBefore
get the closest defined Data object that starts at an address that is less than the given address.- Parameters:
addr
- The address at which to begin the backward search.- Returns:
- the closest defined Data object whose starting address is less than addr.
-
getDefinedData
get a Data iterator that will iterate over the entire address space; returning only defined Data objects.- Parameters:
forward
- true means get iterator in forward direction- Returns:
- a DataIterator that iterates over all defined Data objects in the program.
-
getDefinedData
Returns an iterator of the defined data in this listing (in proper sequence), starting at the specified address. The specified address indicates the first defined Data that would be returned by an initial call to thenext
method. An initial call to theprevious
method would return the defined Data with an address less than the specified address.- Parameters:
addr
- the initial position of the iteratorforward
- true means get iterator in forward direction- Returns:
- a DataIterator that iterates over all defined Data objects in the given address range set.
-
getDefinedData
Get an iterator over the address range(s). Only defined data whose start addresses are contained in the given address set will be returned by the iterator.- Parameters:
addrSet
- the address range set to iterate over.forward
- true means get iterator in forward direction- Returns:
- a DataIterator that iterates over all defined Data objects in the given address range set.
-
getUndefinedDataAt
get the Data (undefined) object that starts at the given address.- Parameters:
addr
- The address to check for undefined data.- Returns:
- a default DataObject if bytes exist at addr and nothing has been defined to exist there. Otherwise returns null.
-
getUndefinedDataAfter
Get the undefined Data object that starts at an address that is greater than the given address. This operation can be slow for large programs so a TaskMonitor is required.- Parameters:
addr
- the address at which to begin the forward search.monitor
- a task monitor allowing this operation to be cancelled- Returns:
- the next undefined Data object whose starting address is greater than addr.
-
getFirstUndefinedData
Get the undefined Data object that falls within the set. This operation can be slow for large programs so a TaskMonitor is required.- Parameters:
set
- the addressSet at which to find the first undefined address.monitor
- a task monitor allowing this operation to be cancelled- Returns:
- the next undefined Data object whose starting address falls within the addresSet.
-
getUndefinedDataBefore
get the closest undefined Data object that starts at an address that is less than the given address. This operation can be slow for large programs so a TaskMonitor is required.- Parameters:
addr
- The address at which to begin the backward search.monitor
- a task monitor allowing this operation to be cancelled- Returns:
- the closest undefined Data object whose starting address is less than addr.
-
getUndefinedRanges
AddressSetView getUndefinedRanges(AddressSetView set, boolean initializedMemoryOnly, TaskMonitor monitor) throws CancelledException Get the address set which corresponds to all undefined code units within the specified set of address.- Parameters:
set
- set of addresses to searchinitializedMemoryOnly
- if true set will be constrained to initialized memory areas, if false set will be constrained to all defined memory blocks.monitor
- task monitor- Returns:
- address set corresponding to undefined code units
- Throws:
CancelledException
- if monitor cancelled
-
getDefinedCodeUnitAfter
Returns the next instruction or defined data after the given address;- Parameters:
addr
- the address at which to begin the search- Returns:
- the next instruction or defined data at an address higher than the given address.
-
getDefinedCodeUnitBefore
Returns the closest instruction or defined data that starts before the given address.- Parameters:
addr
- the address at which to begin the search- Returns:
- the closest instruction or defined data at an address below the given address.
-
getCompositeData
Get an iterator over all the composite data objects (Arrays, Structures, and Union) in the program.- Parameters:
forward
- true means get iterator that starts at the minimum address and iterates forward. Otherwise it starts at the maximum address and iterates backwards.- Returns:
- an iterator over all the composite data objects.
-
getCompositeData
Get an iterator over all the composite data objects (Arrays, Structures, and Union) in the program at or after the given Address.- Parameters:
start
- start of the iteratorforward
- true means get iterator in forward direction- Returns:
- an iterator over all the composite data objects starting with the given address.
-
getCompositeData
Get an iterator over all the composite data objects (Arrays, Structures, and Union) within the specified address set in the program.- Parameters:
addrSet
- the address setforward
- true means get iterator in forward direction- Returns:
- an iterator over all the composite data objects in the given address set.
-
getUserDefinedProperties
Returns an iterator over all user defined property names.- Returns:
- an iterator over all user defined property names.
-
removeUserDefinedProperty
Removes the entire property from the program- Parameters:
propertyName
- the name of the property to remove.
-
getPropertyMap
Returns the PropertyMap associated with the given name- Parameters:
propertyName
- the property name- Returns:
- PropertyMap the propertyMap object.
-
createInstruction
Instruction createInstruction(Address addr, InstructionPrototype prototype, MemBuffer memBuf, ProcessorContextView context, int length) throws CodeUnitInsertionException Creates a new Instruction object at the given address. The specified context is only used to create the associated prototype. It is critical that the context be written immediately after creation of the instruction and must be done with a single set operation on the program context. Once a set context is done on the instruction address, any subsequent context changes will result in aContextChangeException
- Parameters:
addr
- the address at which to create an instructionprototype
- the InstructionPrototype that describes the type of instruction to create.memBuf
- buffer that provides the bytes that make up the instruction.context
- the processor context at this location.length
- instruction byte-length (must be in the range 0..prototype.getLength()). If smaller than the prototype length it must have a value no greater than 7, otherwise an error will be thrown. A value of 0 or greater-than-or-equal the prototype length will be ignored and not impose and override length. The length value must be a multiple of theinstruction alignment
.- Returns:
- the newly created instruction.
- Throws:
CodeUnitInsertionException
- thrown if the new Instruction would overlap and existingCodeUnit
or the specifiedlength
is unsupported.IllegalArgumentException
- if a negativelength
is specified.
-
addInstructions
AddressSetView addInstructions(InstructionSet instructionSet, boolean overwrite) throws CodeUnitInsertionException Creates a complete set of instructions. A preliminary pass will be made checking for code unit conflicts which will be marked within the instructionSet causing dependent blocks to get pruned.- Parameters:
instructionSet
- the set of instructions to be added. All code unit conflicts will be marked within the instructionSet and associated blocks.overwrite
- if true, overwrites existing code units.- Returns:
- the set of addresses over which instructions were actually added to the program. This may differ from the InstructionSet address set if conflict errors occurred. Such conflict errors will be recorded within the InstructionSet and its InstructionBlocks.
- Throws:
CodeUnitInsertionException
- if the instruction set is incompatible with the program memory
-
createData
Creates a new defined Data object of a given length at the given address. This ignores the bytes that are present- Parameters:
addr
- the address at which to create a new Data object.dataType
- the Data Type that describes the type of Data object to create.length
- the length of the datatype.- Returns:
- newly created data unit
- Throws:
CodeUnitInsertionException
- thrown if the new Instruction would overlap and existing Instruction or defined data.
-
createData
Creates a new defined Data object at the given address. This ignores the bytes that are present- Parameters:
addr
- the address at which to create a new Data object.dataType
- the Data Type that describes the type of Data object to create.- Returns:
- newly created data unit
- Throws:
CodeUnitInsertionException
- thrown if the new Instruction would overlap and existing Instruction or defined data.
-
clearCodeUnits
Clears any code units in the given range returning everything to "db"s, and removing any references in the affected area. Note that the module and fragment structure is unaffected. If part of a code unit is contained in the given address range then the whole code unit will be cleared.- Parameters:
startAddr
- the start address of the area to be cleared.endAddr
- the end address of the area to be cleared.clearContext
- clear context register values if true
-
clearCodeUnits
void clearCodeUnits(Address startAddr, Address endAddr, boolean clearContext, TaskMonitor monitor) throws CancelledException Clears any code units in the given range returning everything to "db"s, and removing any references in the affected area. Note that the module and fragment structure is unaffected. If part of a code unit is contained in the given address range then the whole code unit will be cleared.- Parameters:
startAddr
- the start address of the area to be cleared.endAddr
- the end address of the area to be cleared.clearContext
- clear context register values if truemonitor
- monitor that can be used to cancel the clear operation- Throws:
CancelledException
- if the operation was cancelled.
-
isUndefined
Checks if the given ranges consists entirely of undefined data.- Parameters:
start
- The start address of the range to check.end
- The end address of the range to check.- Returns:
- boolean true if the given range is in memory and has no instructions or defined data.
-
clearComments
Clears the comments in the given range.- Parameters:
startAddr
- the start address of the range to be clearedendAddr
- the end address of the range to be cleared
-
clearProperties
void clearProperties(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException Clears the properties in the given range.- Parameters:
startAddr
- the start address of the range to be clearedendAddr
- the end address of the range to be clearedmonitor
- task monitor for cancelling operation.- Throws:
CancelledException
- if the operation was cancelled.
-
clearAll
Removes all CodeUnits, comments, properties, and references from the listing.- Parameters:
clearContext
- if true, also clear any instruction context that has been laid down from previous disassembly.monitor
- used for tracking progress and cancelling the clear operation.
-
getFragment
Returns the fragment containing the given address.- Parameters:
treeName
- name of the tree to searchaddr
- the address that is contained within a fragment.- Returns:
- will return null if the address is not in the program.
-
getModule
Returns the module with the given name.- Parameters:
treeName
- name of the tree to searchname
- the name of the module to find.- Returns:
- will return null if there is no module with the given name.
-
getFragment
Returns the fragment with the given name.- Parameters:
treeName
- name of the tree to searchname
- the name of the fragment to find.- Returns:
- will return null if there is no fragment with the given name.
-
createRootModule
Create a new tree that will be identified by the given name. By default, the new root module is populated with fragments based on memory blocks. Note that the root module's name is not the same as its tree name. The root module name defaults to the name of the program.- Parameters:
treeName
- name of the tree to search- Returns:
- root module
- Throws:
DuplicateNameException
- if a tree with the given name already exists
-
getRootModule
Gets the root module for a tree in this listing.- Parameters:
treeName
- name of tree- Returns:
- the root module for the listing; returns null if there is no tree rooted at a module with the given name.
-
getRootModule
Returns the root module of the program tree with the given name;- Parameters:
treeID
- id of the program tree- Returns:
- the root module of the specified tree.
-
getDefaultRootModule
ProgramModule getDefaultRootModule()Returns the root module for the default program tree. This would be the program tree that has existed the longest.- Returns:
- the root module for the oldest existing program tree.
-
getTreeNames
String[] getTreeNames()Get the names of all the trees defined in this listing.- Returns:
- the names of all program trees defined in the program.
-
removeTree
Remove the tree rooted at the given name.- Parameters:
treeName
- the name of the tree to remove.- Returns:
- true if the tree was removed; return false if this is the last tree for the program; cannot delete the last tree.
-
renameTree
Rename the tree. This method does not change the root module's name only the identifier for the tree.- Parameters:
oldName
- old name of the treenewName
- new name of the tree.- Throws:
DuplicateNameException
- if newName already exists for a root module
-
getNumCodeUnits
long getNumCodeUnits()gets the total number of CodeUnits (Instructions, defined Data, and undefined Data)- Returns:
- the total number of CodeUnits in the listing.
-
getNumDefinedData
long getNumDefinedData()gets the total number of defined Data objects in the listing.- Returns:
- the total number of defined Data objects in the listing.
-
getNumInstructions
long getNumInstructions()gets the total number of Instructions in the listing.- Returns:
- number of Instructions
-
getDataTypeManager
DataTypeManager getDataTypeManager()Get the data type manager for the program.- Returns:
- the datatype manager for the program.
-
createFunction
Function createFunction(String name, Address entryPoint, AddressSetView body, SourceType source) throws InvalidInputException, OverlappingFunctionException Create a function with an entry point and a body of addresses.- Parameters:
name
- the name of the function to createentryPoint
- the entry point for the functionbody
- the address set that makes up the functions bodysource
- the source of this function- Returns:
- the created function
- Throws:
InvalidInputException
- if the name contains invalid charactersOverlappingFunctionException
- if the given body overlaps with an existing function.
-
createFunction
Function createFunction(String name, Namespace nameSpace, Address entryPoint, AddressSetView body, SourceType source) throws InvalidInputException, OverlappingFunctionException Create a function in the specified namespace with an entry point and a body of addresses.- Parameters:
name
- the name of the function to createnameSpace
- the namespace in which to create the functionentryPoint
- the entry point for the functionbody
- the address set that makes up the functions bodysource
- the source of this function- Returns:
- the created function
- Throws:
InvalidInputException
- if the name contains invalid charactersOverlappingFunctionException
- if the given body overlaps with an existing function.
-
removeFunction
Remove a function a given entry point.- Parameters:
entryPoint
- entry point of function to be removed.
-
getFunctionAt
Get a function with a given entry point.- Parameters:
entryPoint
- entry point of the function- Returns:
- function at the entry point
-
getGlobalFunctions
Returns a list of all global functions with the given name.- Parameters:
name
- the name of the functions to retrieve.- Returns:
- a list of all global functions with the given name.
-
getFunctions
Returns a list of all functions with the given name in the given namespace.- Parameters:
namespace
- the namespace to search for functions of the given name. Can be null, in which case it will search the global namespace.name
- the name of the functions to retrieve.- Returns:
- a list of all global functions with the given name.
-
getFunctionContaining
Get a function containing an address.- Parameters:
addr
- the address to search.- Returns:
- function containing this address, null otherwise
-
getExternalFunctions
FunctionIterator getExternalFunctions()Get an iterator over all external functions- Returns:
- an iterator over all currently defined external functions.
-
getFunctions
Get an iterator over all functions- Parameters:
forward
- if true functions are return in address order, otherwise backwards address order- Returns:
- an iterator over all currently defined functions.
-
getFunctions
Get an iterator over all functions starting at address- Parameters:
start
- the address to start iterating at.forward
- if true functions are return in address order, otherwise backwards address order- Returns:
- an iterator over functions
-
getFunctions
Get an iterator over all functions with entry points in the address set.- Parameters:
asv
- the set of addresses to iterator function entry points over.forward
- if true functions are return in address order, otherwise backwards address order- Returns:
- an iterator over functions
-
isInFunction
Check if an address is contained in a function- Parameters:
addr
- address to test- Returns:
- true if this address is in one or more functions
-
getCommentHistory
Get the comment history for comments at the given address.- Parameters:
addr
- address for commentscommentType
- comment type defined in CodeUnit- Returns:
- array of comment history records
-