Package ghidra.program.model
Class ProgramTestDouble
- java.lang.Object
-
- ghidra.program.model.ProgramTestDouble
-
- All Implemented Interfaces:
DataTypeManagerOwner
,DomainObject
,Undoable
,UndoableDomainObject
,DataTypeManagerDomainObject
,Program
public class ProgramTestDouble extends java.lang.Object implements Program
-
-
Field Summary
-
Fields inherited from interface ghidra.framework.model.DomainObject
DO_DOMAIN_FILE_CHANGED, DO_OBJECT_CLOSED, DO_OBJECT_ERROR, DO_OBJECT_RENAMED, DO_OBJECT_RESTORED, DO_OBJECT_SAVED, DO_PROPERTY_CHANGED, undoLock
-
Fields inherited from interface ghidra.program.model.listing.Program
ANALYSIS_PROPERTIES, ANALYSIS_START_DATE, ANALYSIS_START_DATE_FORMAT, ANALYZED, CREATED_WITH_GHIDRA_VERSION, DATE_CREATED, DISASSEMBLER_PROPERTIES, JANUARY_1_1970, MAX_OPERANDS, PROGRAM_INFO, PROGRAM_SETTINGS
-
-
Constructor Summary
Constructors Constructor Description ProgramTestDouble()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCloseListener(DomainObjectClosedListener listener)
Adds a listener that will be notified when this DomainObject is closed.boolean
addConsumer(java.lang.Object consumer)
Adds the given object as a consumer.void
addListener(DomainObjectListener dol)
Adds a listener for this object.void
addSynchronizedDomainObject(DomainObject domainObj)
Synchronize the specified domain object with this domain object using a shared transaction manager.void
addTransactionListener(TransactionListener listener)
Adds the given transaction listener to this domain objectboolean
canLock()
Returns true if a modification lock can be obtained on this domain object.boolean
canRedo()
Returns true if there is a later state to "redo" to.boolean
canSave()
Returns true if this object can be saved; a read-only file cannot be saved.boolean
canUndo()
Returns true if there is a previous state to "undo" to.void
clearUndo()
Clear all undoable/redoable transactionsAddressSetPropertyMap
createAddressSetPropertyMap(java.lang.String name)
Create a new AddressSetPropertyMap with the specified name.IntRangeMap
createIntRangeMap(java.lang.String name)
Create a new IntRangeMap with the specified name.EventQueueID
createPrivateEventQueue(DomainObjectListener listener, int maxDelay)
Creates a private event queue that can be flushed independently from the main event queue.void
deleteAddressSetPropertyMap(java.lang.String name)
Remove the property map from the program.void
deleteIntRangeMap(java.lang.String name)
Remove the property map from the program.void
endTransaction(int transactionID, boolean commit)
Terminate the specified transaction for this domain object.void
flushEvents()
Makes sure all pending domainEvents have been sent.void
flushPrivateEventQueue(EventQueueID id)
Flush events from the specified event queue.void
forceLock(boolean rollback, java.lang.String reason)
Cancels any previous lock and aquires it.AddressFactory
getAddressFactory()
Returns the AddressFactory for this program.AddressMap
getAddressMap()
AddressSetPropertyMap
getAddressSetPropertyMap(java.lang.String name)
Get the property map with the given name.BookmarkManager
getBookmarkManager()
Get the bookmark manager.ProgramChangeSet
getChanges()
Get the program changes since the last save as a set of addresses.java.lang.String
getCompiler()
Gets the name of the compiler believed to have been used to create this program.CompilerSpec
getCompilerSpec()
Returns the CompilerSpec currently used by this program.java.util.ArrayList<java.lang.Object>
getConsumerList()
Returns the list of consumers on this domainObjectjava.util.Date
getCreationDate()
Returns the creation date of this program.Transaction
getCurrentTransaction()
Returns the current transactionProgramDataTypeManager
getDataTypeManager()
Returns the program's datatype manager.int
getDefaultPointerSize()
Gets the default pointer size in bytes as it may be stored within the program listing.java.lang.String
getDescription()
Returns a word or short phrase that best describes or categorizes the object in terms that a user will understand.DomainFile
getDomainFile()
Get the domain file for this domain object.EquateTable
getEquateTable()
Get the equate table object.java.lang.String
getExecutableFormat()
Returns a value corresponding to the original file format.java.lang.String
getExecutableMD5()
Returns a value corresponding to the original binary file MD5 hash.java.lang.String
getExecutablePath()
Gets the path to the program's executable file.ExternalManager
getExternalManager()
Returns the external manager.FunctionManager
getFunctionManager()
Returns the programs function manager.Namespace
getGlobalNamespace()
Returns the global namespace for this programAddress
getImageBase()
Returns the current program image base address;IntRangeMap
getIntRangeMap(java.lang.String name)
Get the property map with the given name.Language
getLanguage()
Returns the language used by this program.LanguageID
getLanguageID()
Return the name of the language used by this program.Listing
getListing()
Get the listing object.Address
getMaxAddress()
Get the programs maximum address.Memory
getMemory()
Get the memory object.java.util.Map<java.lang.String,java.lang.String>
getMetadata()
Returns a map containing all the stored metadata associated with this domain object.Address
getMinAddress()
get the program's minimum address.long
getModificationNumber()
Returns a long value that gets incremented every time a change, undo, or redo takes place.java.lang.String
getName()
Get the name of this domain object.Options
getOptions(java.lang.String propertyListName)
Get the property list for the given name.java.util.List<java.lang.String>
getOptionsNames()
Returns all properties lists contained by this domain object.ProgramContext
getProgramContext()
Returns the program context.ProgramUserData
getProgramUserData()
Returns the user-specific data manager for this program.java.lang.String
getRedoName()
Returns a description of the change that would be "redone".ReferenceManager
getReferenceManager()
Get the reference manager.Register
getRegister(Address addr)
Returns the largest register located at the specified addressRegister
getRegister(Address addr, int size)
Returns a specific register based upon its address and sizeRegister
getRegister(Varnode varnode)
Returns the register which corresponds to the specified varnodeRegister
getRegister(java.lang.String name)
Returns the register with the given name;Register[]
getRegisters(Address addr)
Returns all registers located at the specified addressRelocationTable
getRelocationTable()
Gets the relocation table.SymbolTable
getSymbolTable()
Get the symbol table object.DomainObject[]
getSynchronizedDomainObjects()
Return array of all domain objects synchronized with a shared transaction manager.java.lang.String
getUndoName()
Returns a description of the chanage that would be "undone".long
getUniqueProgramID()
Returns an ID that is unique for this program.PropertyMapManager
getUsrPropertyManager()
Get the user propertyMangager stored with this program.boolean
hasExclusiveAccess()
Returns true if the user has exclusive access to the domain object.boolean
hasTerminatedTransaction()
Returns true if the last transaction was terminated externally from the action that started it.void
invalidate()
Invalidates any caching in a program.boolean
isChangeable()
Returns true if changes are permitted.boolean
isChanged()
Returns whether the object has changed.boolean
isClosed()
Returns true if this domain object has been closed as a result of the last releaseboolean
isLocked()
Returns true if the domain object currenly has a modification lock enabled.boolean
isSendingEvents()
Returns true if this object is sending out events as it is changed.boolean
isTemporary()
Returns true if this object has been marked as Temporary.boolean
isUsedBy(java.lang.Object consumer)
Returns true if the given consumer is using (has open) this domain object.boolean
lock(java.lang.String reason)
Attempt to obtain a modification lock on the domain object.Address[]
parseAddress(java.lang.String addrStr)
Return an array of Addresses that could represent the given string.Address[]
parseAddress(java.lang.String addrStr, boolean caseSensitive)
Return an array of Addresses that could represent the given string.void
redo()
Returns to a latter state that exists because of an undo.void
release(java.lang.Object consumer)
Notify the domain object that the specified consumer is no longer using it.void
releaseSynchronizedDomainObject()
Remove this domain object from a shared transaction manager.void
removeCloseListener(DomainObjectClosedListener listener)
Removes the given close listener.void
removeListener(DomainObjectListener dol)
Remove the listener for this object.boolean
removePrivateEventQueue(EventQueueID id)
Removes the specified private event queuevoid
removeTransactionListener(TransactionListener listener)
Removes the given transaction listener from this domain object.void
restoreImageBase()
Restores the last committed image base.void
save(java.lang.String comment, TaskMonitor monitor)
Saves changes to the DomainFile.void
saveToPackedFile(java.io.File outputFile, TaskMonitor monitor)
Saves (i.e., serializes) the current content to a packed file.void
setCompiler(java.lang.String compiler)
Sets the name of the compiler which created this program.void
setEventsEnabled(boolean v)
If true, domain object change events are sent.void
setExecutableFormat(java.lang.String format)
Sets the value corresponding to the original file format.void
setExecutableMD5(java.lang.String md5)
Sets the value corresponding to the original binary file MD5 hash.void
setExecutablePath(java.lang.String path)
Sets the path to the program's executable file.void
setImageBase(Address base, boolean commit)
Sets the program's image base address.void
setLanguage(Language language, CompilerSpecID compilerSpecID, boolean forceRedisassembly, TaskMonitor monitor)
Sets the language for the program.void
setName(java.lang.String name)
Set the name for this domain object.void
setTemporary(boolean state)
Set the temporary state of this object.int
startTransaction(java.lang.String description)
Start a new transaction in order to make changes to this domain object.int
startTransaction(java.lang.String description, AbortedTransactionListener listener)
Start a new transaction in order to make changes to this domain object.void
undo()
Returns to the previous state.void
unlock()
Release a modification lock previously granted with the lock method.
-
-
-
Method Detail
-
startTransaction
public int startTransaction(java.lang.String description)
Description copied from interface:UndoableDomainObject
Start a new transaction in order to make changes to this domain object. All changes must be made in the context of a transaction. If a transaction is already in progress, a sub-transaction of the current transaction will be returned.- Specified by:
startTransaction
in interfaceUndoableDomainObject
- Parameters:
description
- brief description of transaction- Returns:
- transaction ID
-
startTransaction
public int startTransaction(java.lang.String description, AbortedTransactionListener listener)
Description copied from interface:UndoableDomainObject
Start a new transaction in order to make changes to this domain object. All changes must be made in the context of a transaction. If a transaction is already in progress, a sub-transaction of the current transaction will be returned.- Specified by:
startTransaction
in interfaceUndoableDomainObject
- Parameters:
description
- brief description of transactionlistener
- listener to be notified if the transaction is aborted.- Returns:
- transaction ID
-
endTransaction
public void endTransaction(int transactionID, boolean commit)
Description copied from interface:UndoableDomainObject
Terminate the specified transaction for this domain object.- Specified by:
endTransaction
in interfaceUndoableDomainObject
- Parameters:
transactionID
- transaction ID obtained from startTransaction methodcommit
- if true the changes made in this transaction will be marked for commit, if false this and any concurrent transaction will be rolled-back.
-
getCurrentTransaction
public Transaction getCurrentTransaction()
Description copied from interface:UndoableDomainObject
Returns the current transaction- Specified by:
getCurrentTransaction
in interfaceUndoableDomainObject
- Returns:
- the current transaction
-
hasTerminatedTransaction
public boolean hasTerminatedTransaction()
Description copied from interface:UndoableDomainObject
Returns true if the last transaction was terminated externally from the action that started it.- Specified by:
hasTerminatedTransaction
in interfaceUndoableDomainObject
-
getSynchronizedDomainObjects
public DomainObject[] getSynchronizedDomainObjects()
Description copied from interface:UndoableDomainObject
Return array of all domain objects synchronized with a shared transaction manager.- Specified by:
getSynchronizedDomainObjects
in interfaceUndoableDomainObject
- Returns:
- returns array of synchronized domain objects or null if this domain object is not synchronized with others.
-
addSynchronizedDomainObject
public void addSynchronizedDomainObject(DomainObject domainObj) throws LockException
Description copied from interface:UndoableDomainObject
Synchronize the specified domain object with this domain object using a shared transaction manager. If either or both is already shared, a transition to a single shared transaction manager will be performed.- Specified by:
addSynchronizedDomainObject
in interfaceUndoableDomainObject
- Throws:
LockException
- if lock or open transaction is active on either this or the specified domain object
-
releaseSynchronizedDomainObject
public void releaseSynchronizedDomainObject() throws LockException
Description copied from interface:UndoableDomainObject
Remove this domain object from a shared transaction manager. If this object has not been synchronized with others via a shared transaction manager, this method will have no affect.- Specified by:
releaseSynchronizedDomainObject
in interfaceUndoableDomainObject
- Throws:
LockException
- if lock or open transaction is active
-
isChanged
public boolean isChanged()
Description copied from interface:DomainObject
Returns whether the object has changed.- Specified by:
isChanged
in interfaceDomainObject
-
setTemporary
public void setTemporary(boolean state)
Description copied from interface:DomainObject
Set the temporary state of this object. If this object is temporary, the isChanged() method will always return false. The default temporary state is false.- Specified by:
setTemporary
in interfaceDomainObject
- Parameters:
state
- if true object is marked as temporary
-
isTemporary
public boolean isTemporary()
Description copied from interface:DomainObject
Returns true if this object has been marked as Temporary.- Specified by:
isTemporary
in interfaceDomainObject
-
isChangeable
public boolean isChangeable()
Description copied from interface:DomainObject
Returns true if changes are permitted.- Specified by:
isChangeable
in interfaceDomainObject
-
canSave
public boolean canSave()
Description copied from interface:DomainObject
Returns true if this object can be saved; a read-only file cannot be saved.- Specified by:
canSave
in interfaceDomainObject
-
save
public void save(java.lang.String comment, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from interface:DomainObject
Saves changes to the DomainFile.- Specified by:
save
in interfaceDomainObject
- Parameters:
comment
- comment used for new versionmonitor
- monitor that shows the progress of the save- Throws:
java.io.IOException
- thrown if there was an error accessing this domain objectReadOnlyException
- thrown if this DomainObject is read only and cannot be savedCancelledException
- thrown if the user canceled the save operation
-
saveToPackedFile
public void saveToPackedFile(java.io.File outputFile, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from interface:DomainObject
Saves (i.e., serializes) the current content to a packed file.- Specified by:
saveToPackedFile
in interfaceDomainObject
- Parameters:
outputFile
- packed output filemonitor
- progress monitor- Throws:
java.io.IOException
CancelledException
-
release
public void release(java.lang.Object consumer)
Description copied from interface:DomainObject
Notify the domain object that the specified consumer is no longer using it. When the last consumer invokes this method, the domain object will be closed and will become invalid.- Specified by:
release
in interfaceDomainObject
- Parameters:
consumer
- the consumer (e.g., tool, plugin, etc) of the domain object previously established with the addConsumer method.
-
addListener
public void addListener(DomainObjectListener dol)
Description copied from interface:DomainObject
Adds a listener for this object.- Specified by:
addListener
in interfaceDomainObject
- Parameters:
dol
- listener notified when any change occurs to this domain object
-
removeListener
public void removeListener(DomainObjectListener dol)
Description copied from interface:DomainObject
Remove the listener for this object.- Specified by:
removeListener
in interfaceDomainObject
- Parameters:
dol
- listener
-
addCloseListener
public void addCloseListener(DomainObjectClosedListener listener)
Description copied from interface:DomainObject
Adds a listener that will be notified when this DomainObject is closed. This is meant for clients to have a chance to cleanup, such as reference removal.- Specified by:
addCloseListener
in interfaceDomainObject
- Parameters:
listener
- the reference to add
-
removeCloseListener
public void removeCloseListener(DomainObjectClosedListener listener)
Description copied from interface:DomainObject
Removes the given close listener.- Specified by:
removeCloseListener
in interfaceDomainObject
- Parameters:
listener
- the listener to remove.
-
createPrivateEventQueue
public EventQueueID createPrivateEventQueue(DomainObjectListener listener, int maxDelay)
Description copied from interface:DomainObject
Creates a private event queue that can be flushed independently from the main event queue.- Specified by:
createPrivateEventQueue
in interfaceDomainObject
- Parameters:
listener
- the listener to be notified of domain object events.maxDelay
- the time interval (in milliseconds) used to buffer events.- Returns:
- a unique identifier for this private queue.
-
removePrivateEventQueue
public boolean removePrivateEventQueue(EventQueueID id)
Description copied from interface:DomainObject
Removes the specified private event queue- Specified by:
removePrivateEventQueue
in interfaceDomainObject
- Parameters:
id
- the id of the queue to remove.- Returns:
- true if the id represents a valid queue that was removed.
-
getDescription
public java.lang.String getDescription()
Description copied from interface:DomainObject
Returns a word or short phrase that best describes or categorizes the object in terms that a user will understand.- Specified by:
getDescription
in interfaceDomainObject
-
getName
public java.lang.String getName()
Description copied from interface:DomainObject
Get the name of this domain object.- Specified by:
getName
in interfaceDomainObject
-
setName
public void setName(java.lang.String name)
Description copied from interface:DomainObject
Set the name for this domain object.- Specified by:
setName
in interfaceDomainObject
- Parameters:
name
- object name
-
getDomainFile
public DomainFile getDomainFile()
Description copied from interface:DomainObject
Get the domain file for this domain object.- Specified by:
getDomainFile
in interfaceDomainObject
- Returns:
- the associated domain file
-
addConsumer
public boolean addConsumer(java.lang.Object consumer)
Description copied from interface:DomainObject
Adds the given object as a consumer. The release method must be invoked with this same consumer instance when this domain object is no longer in-use.- Specified by:
addConsumer
in interfaceDomainObject
- Parameters:
consumer
- domain object consumer- Returns:
- false if this domain object has already been closed
-
getConsumerList
public java.util.ArrayList<java.lang.Object> getConsumerList()
Description copied from interface:DomainObject
Returns the list of consumers on this domainObject- Specified by:
getConsumerList
in interfaceDomainObject
- Returns:
- the list of consumers.
-
isUsedBy
public boolean isUsedBy(java.lang.Object consumer)
Description copied from interface:DomainObject
Returns true if the given consumer is using (has open) this domain object.- Specified by:
isUsedBy
in interfaceDomainObject
- Parameters:
consumer
- the object to test to see if it is a consumer of this domain object.- Returns:
- true if the given consumer is using (has open) this domain object;
-
setEventsEnabled
public void setEventsEnabled(boolean v)
Description copied from interface:DomainObject
If true, domain object change events are sent. If false, no events are sent.NOTE: disabling events could cause plugins to be out of sync!
NOTE: when re-enabling events, an event will be sent to the system to signal that every listener should update.
- Specified by:
setEventsEnabled
in interfaceDomainObject
- Parameters:
v
- true means to enable events
-
isSendingEvents
public boolean isSendingEvents()
Description copied from interface:DomainObject
Returns true if this object is sending out events as it is changed. The default is true. You can change this value by callingDomainObject.setEventsEnabled(boolean)
.- Specified by:
isSendingEvents
in interfaceDomainObject
- See Also:
DomainObject.setEventsEnabled(boolean)
-
flushEvents
public void flushEvents()
Description copied from interface:DomainObject
Makes sure all pending domainEvents have been sent.- Specified by:
flushEvents
in interfaceDomainObject
-
flushPrivateEventQueue
public void flushPrivateEventQueue(EventQueueID id)
Description copied from interface:DomainObject
Flush events from the specified event queue.- Specified by:
flushPrivateEventQueue
in interfaceDomainObject
- Parameters:
id
- the id specifying the event queue to be flushed.
-
canLock
public boolean canLock()
Description copied from interface:DomainObject
Returns true if a modification lock can be obtained on this domain object. Care should be taken with using this method since this will not prevent another thread from modifying the domain object.- Specified by:
canLock
in interfaceDomainObject
-
isLocked
public boolean isLocked()
Description copied from interface:DomainObject
Returns true if the domain object currenly has a modification lock enabled.- Specified by:
isLocked
in interfaceDomainObject
-
lock
public boolean lock(java.lang.String reason)
Description copied from interface:DomainObject
Attempt to obtain a modification lock on the domain object. Multiple locks may be granted on this domain object, although all lock owners must release their lock in a timely fashion.- Specified by:
lock
in interfaceDomainObject
- Parameters:
reason
- very short reason for requesting lock- Returns:
- true if lock obtained successfully, else false which indicates that a modification is in process.
-
forceLock
public void forceLock(boolean rollback, java.lang.String reason)
Description copied from interface:DomainObject
Cancels any previous lock and aquires it.- Specified by:
forceLock
in interfaceDomainObject
- Parameters:
rollback
- if true, any changes in made with the previous lock should be discarded.reason
- very short reason for requesting lock
-
unlock
public void unlock()
Description copied from interface:DomainObject
Release a modification lock previously granted with the lock method.- Specified by:
unlock
in interfaceDomainObject
-
getOptionsNames
public java.util.List<java.lang.String> getOptionsNames()
Description copied from interface:DomainObject
Returns all properties lists contained by this domain object.- Specified by:
getOptionsNames
in interfaceDomainObject
- Returns:
- all property lists contained by this domain object.
-
getOptions
public Options getOptions(java.lang.String propertyListName)
Description copied from interface:DomainObject
Get the property list for the given name.- Specified by:
getOptions
in interfaceDomainObject
- Parameters:
propertyListName
- name of property list
-
isClosed
public boolean isClosed()
Description copied from interface:DomainObject
Returns true if this domain object has been closed as a result of the last release- Specified by:
isClosed
in interfaceDomainObject
-
hasExclusiveAccess
public boolean hasExclusiveAccess()
Description copied from interface:DomainObject
Returns true if the user has exclusive access to the domain object. Exclusive access means either the object is not shared or the user has an exclusive checkout on the object.- Specified by:
hasExclusiveAccess
in interfaceDomainObject
-
getMetadata
public java.util.Map<java.lang.String,java.lang.String> getMetadata()
Description copied from interface:DomainObject
Returns a map containing all the stored metadata associated with this domain object. The map contains key,value pairs and are ordered by their insertion order.- Specified by:
getMetadata
in interfaceDomainObject
- Returns:
- a map containing all the stored metadata associated with this domain object.
-
getModificationNumber
public long getModificationNumber()
Description copied from interface:DomainObject
Returns a long value that gets incremented every time a change, undo, or redo takes place. Useful for implementing a lazy caching system.- Specified by:
getModificationNumber
in interfaceDomainObject
- Returns:
- a long value that is incremented for every change to the program.
-
canUndo
public boolean canUndo()
Description copied from interface:Undoable
Returns true if there is a previous state to "undo" to.
-
canRedo
public boolean canRedo()
Description copied from interface:Undoable
Returns true if there is a later state to "redo" to.
-
clearUndo
public void clearUndo()
Description copied from interface:Undoable
Clear all undoable/redoable transactions
-
undo
public void undo() throws java.io.IOException
Description copied from interface:Undoable
Returns to the previous state. Normally, this will cause the current state to appear on the "redo" stack. This method will do nothing if there are no previous states to "undo".
-
redo
public void redo() throws java.io.IOException
Description copied from interface:Undoable
Returns to a latter state that exists because of an undo. Normally, this will cause the current state to appear on the "undo" stack. This method will do nothing if there are no latter states to "redo".
-
getUndoName
public java.lang.String getUndoName()
Description copied from interface:Undoable
Returns a description of the chanage that would be "undone".- Specified by:
getUndoName
in interfaceUndoable
-
getRedoName
public java.lang.String getRedoName()
Description copied from interface:Undoable
Returns a description of the change that would be "redone".- Specified by:
getRedoName
in interfaceUndoable
-
addTransactionListener
public void addTransactionListener(TransactionListener listener)
Description copied from interface:Undoable
Adds the given transaction listener to this domain object- Specified by:
addTransactionListener
in interfaceUndoable
- Parameters:
listener
- the new transaction listener to add
-
removeTransactionListener
public void removeTransactionListener(TransactionListener listener)
Description copied from interface:Undoable
Removes the given transaction listener from this domain object.- Specified by:
removeTransactionListener
in interfaceUndoable
- Parameters:
listener
- the transaction listener to remove
-
getListing
public Listing getListing()
Description copied from interface:Program
Get the listing object.- Specified by:
getListing
in interfaceProgram
- Returns:
- the Listing interface to the listing object.
-
getAddressMap
public AddressMap getAddressMap()
- Specified by:
getAddressMap
in interfaceProgram
-
getDataTypeManager
public ProgramDataTypeManager getDataTypeManager()
Description copied from interface:Program
Returns the program's datatype manager.- Specified by:
getDataTypeManager
in interfaceDataTypeManagerOwner
- Specified by:
getDataTypeManager
in interfaceProgram
- Returns:
- the data type manager.
-
getFunctionManager
public FunctionManager getFunctionManager()
Description copied from interface:Program
Returns the programs function manager.- Specified by:
getFunctionManager
in interfaceProgram
-
getProgramUserData
public ProgramUserData getProgramUserData()
Description copied from interface:Program
Returns the user-specific data manager for this program.- Specified by:
getProgramUserData
in interfaceProgram
-
getSymbolTable
public SymbolTable getSymbolTable()
Description copied from interface:Program
Get the symbol table object.- Specified by:
getSymbolTable
in interfaceProgram
- Returns:
- the symbol table object.
-
getExternalManager
public ExternalManager getExternalManager()
Description copied from interface:Program
Returns the external manager.- Specified by:
getExternalManager
in interfaceProgram
-
getEquateTable
public EquateTable getEquateTable()
Description copied from interface:Program
Get the equate table object.- Specified by:
getEquateTable
in interfaceProgram
- Returns:
- the equate table.
-
getMemory
public Memory getMemory()
Description copied from interface:Program
Get the memory object.
-
getReferenceManager
public ReferenceManager getReferenceManager()
Description copied from interface:Program
Get the reference manager.- Specified by:
getReferenceManager
in interfaceProgram
-
getBookmarkManager
public BookmarkManager getBookmarkManager()
Description copied from interface:Program
Get the bookmark manager.- Specified by:
getBookmarkManager
in interfaceProgram
-
getDefaultPointerSize
public int getDefaultPointerSize()
Description copied from interface:Program
Gets the default pointer size in bytes as it may be stored within the program listing.- Specified by:
getDefaultPointerSize
in interfaceProgram
- Returns:
- default pointer size.
- See Also:
DataOrganization.getPointerSize()
-
getCompiler
public java.lang.String getCompiler()
Description copied from interface:Program
Gets the name of the compiler believed to have been used to create this program. If the compiler hasn't been determined then "unknown" is returned.- Specified by:
getCompiler
in interfaceProgram
- Returns:
- name of the compiler or "unknown".
-
setCompiler
public void setCompiler(java.lang.String compiler)
Description copied from interface:Program
Sets the name of the compiler which created this program.- Specified by:
setCompiler
in interfaceProgram
- Parameters:
compiler
- the name
-
getExecutablePath
public java.lang.String getExecutablePath()
Description copied from interface:Program
Gets the path to the program's executable file. For example,C:\Temp\test.exe
. This will allow plugins to execute the program.- Specified by:
getExecutablePath
in interfaceProgram
- Returns:
- String path to program's exe file
-
setExecutablePath
public void setExecutablePath(java.lang.String path)
Description copied from interface:Program
Sets the path to the program's executable file. For example,C:\Temp\test.exe
.- Specified by:
setExecutablePath
in interfaceProgram
- Parameters:
path
- the path to the program's exe
-
getExecutableFormat
public java.lang.String getExecutableFormat()
Description copied from interface:Program
Returns a value corresponding to the original file format.- Specified by:
getExecutableFormat
in interfaceProgram
-
setExecutableFormat
public void setExecutableFormat(java.lang.String format)
Description copied from interface:Program
Sets the value corresponding to the original file format.- Specified by:
setExecutableFormat
in interfaceProgram
- Parameters:
format
- the format string to set.
-
getExecutableMD5
public java.lang.String getExecutableMD5()
Description copied from interface:Program
Returns a value corresponding to the original binary file MD5 hash. May be null if program source did not correspond to a binary file.- Specified by:
getExecutableMD5
in interfaceProgram
-
setExecutableMD5
public void setExecutableMD5(java.lang.String md5)
Description copied from interface:Program
Sets the value corresponding to the original binary file MD5 hash.- Specified by:
setExecutableMD5
in interfaceProgram
- Parameters:
md5
- MD5 binary file hash
-
getCreationDate
public java.util.Date getCreationDate()
Description copied from interface:Program
Returns the creation date of this program. If the program was created before this property existed, then Jan 1, 1970 is returned.- Specified by:
getCreationDate
in interfaceProgram
- Returns:
- the creation date of this program
-
getRelocationTable
public RelocationTable getRelocationTable()
Description copied from interface:Program
Gets the relocation table.- Specified by:
getRelocationTable
in interfaceProgram
-
getLanguage
public Language getLanguage()
Description copied from interface:Program
Returns the language used by this program.- Specified by:
getLanguage
in interfaceProgram
- Returns:
- the language used by this program.
-
getCompilerSpec
public CompilerSpec getCompilerSpec()
Description copied from interface:Program
Returns the CompilerSpec currently used by this program.- Specified by:
getCompilerSpec
in interfaceProgram
- Returns:
- the compilerSpec currently used by this program.
-
getLanguageID
public LanguageID getLanguageID()
Description copied from interface:Program
Return the name of the language used by this program.- Specified by:
getLanguageID
in interfaceProgram
- Returns:
- the name of the language
-
getUsrPropertyManager
public PropertyMapManager getUsrPropertyManager()
Description copied from interface:Program
Get the user propertyMangager stored with this program. The user property manager is used to store arbitrary address indexed information associated with the program.- Specified by:
getUsrPropertyManager
in interfaceProgram
- Returns:
- the user property manager.
-
getProgramContext
public ProgramContext getProgramContext()
Description copied from interface:Program
Returns the program context.- Specified by:
getProgramContext
in interfaceProgram
-
getMinAddress
public Address getMinAddress()
Description copied from interface:Program
get the program's minimum address.- Specified by:
getMinAddress
in interfaceProgram
- Returns:
- the program's minimum address or null if no memory blocks have been defined in the program.
-
getMaxAddress
public Address getMaxAddress()
Description copied from interface:Program
Get the programs maximum address.- Specified by:
getMaxAddress
in interfaceProgram
- Returns:
- the program's maximum address or null if no memory blocks have been defined in the program.
-
getChanges
public ProgramChangeSet getChanges()
Description copied from interface:Program
Get the program changes since the last save as a set of addresses.- Specified by:
getChanges
in interfaceProgram
- Returns:
- set of changed addresses within program.
-
getAddressFactory
public AddressFactory getAddressFactory()
Description copied from interface:Program
Returns the AddressFactory for this program.- Specified by:
getAddressFactory
in interfaceProgram
-
parseAddress
public Address[] parseAddress(java.lang.String addrStr)
Description copied from interface:Program
Return an array of Addresses that could represent the given string.- Specified by:
parseAddress
in interfaceProgram
- Parameters:
addrStr
- the string to parse.- Returns:
- zero length array if addrStr is properly formatted but no matching addresses were found or if the address is improperly formatted.
-
parseAddress
public Address[] parseAddress(java.lang.String addrStr, boolean caseSensitive)
Description copied from interface:Program
Return an array of Addresses that could represent the given string.- Specified by:
parseAddress
in interfaceProgram
- Parameters:
addrStr
- the string to parse.caseSensitive
- whether or not to process any addressSpace names as case sensitive.- Returns:
- zero length array if addrStr is properly formatted but no matching addresses were found or if the address is improperly formatted.
-
invalidate
public void invalidate()
Description copied from interface:Program
Invalidates any caching in a program. NOTE: Over-using this method can adversely affect system performance.- Specified by:
invalidate
in interfaceProgram
-
getRegister
public Register getRegister(java.lang.String name)
Description copied from interface:Program
Returns the register with the given name;- Specified by:
getRegister
in interfaceProgram
- Parameters:
name
- the name of the register to retrieve- Returns:
- register or null
-
getRegister
public Register getRegister(Address addr)
Description copied from interface:Program
Returns the largest register located at the specified address- Specified by:
getRegister
in interfaceProgram
- Returns:
- largest register or null
-
getRegisters
public Register[] getRegisters(Address addr)
Description copied from interface:Program
Returns all registers located at the specified address- Specified by:
getRegisters
in interfaceProgram
- Returns:
- largest register
-
getRegister
public Register getRegister(Address addr, int size)
Description copied from interface:Program
Returns a specific register based upon its address and size- Specified by:
getRegister
in interfaceProgram
- Parameters:
addr
- register addresssize
- the size of the register (in bytes);- Returns:
- register or null
-
getRegister
public Register getRegister(Varnode varnode)
Description copied from interface:Program
Returns the register which corresponds to the specified varnode- Specified by:
getRegister
in interfaceProgram
- Returns:
- register or null
-
getImageBase
public Address getImageBase()
Description copied from interface:Program
Returns the current program image base address;- Specified by:
getImageBase
in interfaceProgram
-
setImageBase
public void setImageBase(Address base, boolean commit) throws AddressOverflowException, LockException, java.lang.IllegalStateException
Description copied from interface:Program
Sets the program's image base address.- Specified by:
setImageBase
in interfaceProgram
- Parameters:
base
- the new image base address;commit
- if false, then the image base change is temporary and does not really change the program and will be lost once the program is closed. If true, the change is permanent and marks the program as "changed" (needs saving).- Throws:
AddressOverflowException
- if the new image would cause a memory block to end past the the address space.LockException
- if the program is shared and the user does not have an exclusive checkout. This will never be thrown if commit is false.java.lang.IllegalStateException
- if the program state is not suitable for setting the image base.
-
restoreImageBase
public void restoreImageBase()
Description copied from interface:Program
Restores the last committed image base.- Specified by:
restoreImageBase
in interfaceProgram
-
setLanguage
public void setLanguage(Language language, CompilerSpecID compilerSpecID, boolean forceRedisassembly, TaskMonitor monitor) throws java.lang.IllegalStateException, IncompatibleLanguageException, LockException
Description copied from interface:Program
Sets the language for the program. If the new language is "compatible" with the old language, the addressMap is adjusted then the program is "re-disassembled".- Specified by:
setLanguage
in interfaceProgram
- Parameters:
language
- the new language to use.forceRedisassembly
- if true a redisassembly will be forced. This should always be false.monitor
- the task monitor- Throws:
java.lang.IllegalStateException
- thrown if any error occurs, including a cancelled monitor, which leaves this program object in an unusable state. The current transaction should be aborted and the program instance discarded.IncompatibleLanguageException
- thrown if the new language is too different from the existing language.LockException
- if the program is shared and not checked out exclusively.
-
getGlobalNamespace
public Namespace getGlobalNamespace()
Description copied from interface:Program
Returns the global namespace for this program- Specified by:
getGlobalNamespace
in interfaceProgram
-
createAddressSetPropertyMap
public AddressSetPropertyMap createAddressSetPropertyMap(java.lang.String name) throws DuplicateNameException
Description copied from interface:Program
Create a new AddressSetPropertyMap with the specified name.- Specified by:
createAddressSetPropertyMap
in interfaceProgram
- Parameters:
name
- name of the property map.- Returns:
- the newly created property map.
- Throws:
DuplicateNameException
- if a property map already exists with the given name.
-
createIntRangeMap
public IntRangeMap createIntRangeMap(java.lang.String name) throws DuplicateNameException
Description copied from interface:Program
Create a new IntRangeMap with the specified name.- Specified by:
createIntRangeMap
in interfaceProgram
- Parameters:
name
- name of the property map.- Returns:
- the newly created property map.
- Throws:
DuplicateNameException
- if a property map already exists with the given name.
-
getAddressSetPropertyMap
public AddressSetPropertyMap getAddressSetPropertyMap(java.lang.String name)
Description copied from interface:Program
Get the property map with the given name.- Specified by:
getAddressSetPropertyMap
in interfaceProgram
- Parameters:
name
- name of the property map- Returns:
- null if no property map exist with the given name
-
getIntRangeMap
public IntRangeMap getIntRangeMap(java.lang.String name)
Description copied from interface:Program
Get the property map with the given name.- Specified by:
getIntRangeMap
in interfaceProgram
- Parameters:
name
- name of the property map- Returns:
- null if no property map exist with the given name
-
deleteAddressSetPropertyMap
public void deleteAddressSetPropertyMap(java.lang.String name)
Description copied from interface:Program
Remove the property map from the program.- Specified by:
deleteAddressSetPropertyMap
in interfaceProgram
- Parameters:
name
- name of the property map to remove
-
deleteIntRangeMap
public void deleteIntRangeMap(java.lang.String name)
Description copied from interface:Program
Remove the property map from the program.- Specified by:
deleteIntRangeMap
in interfaceProgram
- Parameters:
name
- name of the property map to remove
-
getUniqueProgramID
public long getUniqueProgramID()
Description copied from interface:Program
Returns an ID that is unique for this program. This provides an easy way to store references to a program across client persistence.- Specified by:
getUniqueProgramID
in interfaceProgram
-
-