Class ProgramTestDouble

    • Constructor Detail

      • ProgramTestDouble

        public ProgramTestDouble()
    • 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 interface UndoableDomainObject
        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 interface UndoableDomainObject
        Parameters:
        description - brief description of transaction
        listener - 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 interface UndoableDomainObject
        Parameters:
        transactionID - transaction ID obtained from startTransaction method
        commit - if true the changes made in this transaction will be marked for commit, if false this and any concurrent transaction will be rolled-back.
      • 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 interface UndoableDomainObject
        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 interface UndoableDomainObject
        Throws:
        LockException - if lock or open transaction is active on either this or the specified domain object
      • isChanged

        public boolean isChanged()
        Description copied from interface: DomainObject
        Returns whether the object has changed.
        Specified by:
        isChanged in interface DomainObject
      • 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 interface DomainObject
        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 interface DomainObject
      • isChangeable

        public boolean isChangeable()
        Description copied from interface: DomainObject
        Returns true if changes are permitted.
        Specified by:
        isChangeable in interface DomainObject
      • 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 interface DomainObject
      • 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 interface DomainObject
        Parameters:
        comment - comment used for new version
        monitor - monitor that shows the progress of the save
        Throws:
        java.io.IOException - thrown if there was an error accessing this domain object
        ReadOnlyException - thrown if this DomainObject is read only and cannot be saved
        CancelledException - 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 interface DomainObject
        Parameters:
        outputFile - packed output file
        monitor - 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 interface DomainObject
        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 interface DomainObject
        Parameters:
        dol - listener notified when any change occurs to this domain object
      • 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 interface DomainObject
        Parameters:
        listener - the reference to add
      • 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 interface DomainObject
        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 interface DomainObject
        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 interface DomainObject
      • getName

        public java.lang.String getName()
        Description copied from interface: DomainObject
        Get the name of this domain object.
        Specified by:
        getName in interface DomainObject
      • setName

        public void setName​(java.lang.String name)
        Description copied from interface: DomainObject
        Set the name for this domain object.
        Specified by:
        setName in interface DomainObject
        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 interface DomainObject
        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 interface DomainObject
        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 interface DomainObject
        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 interface DomainObject
        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 interface DomainObject
        Parameters:
        v - true means to enable events
      • flushEvents

        public void flushEvents()
        Description copied from interface: DomainObject
        Makes sure all pending domainEvents have been sent.
        Specified by:
        flushEvents in interface DomainObject
      • flushPrivateEventQueue

        public void flushPrivateEventQueue​(EventQueueID id)
        Description copied from interface: DomainObject
        Flush events from the specified event queue.
        Specified by:
        flushPrivateEventQueue in interface DomainObject
        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 interface DomainObject
      • 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 interface DomainObject
      • 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 interface DomainObject
        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 interface DomainObject
        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 interface DomainObject
      • 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 interface DomainObject
        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 interface DomainObject
        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 interface DomainObject
      • 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 interface DomainObject
      • 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 interface DomainObject
        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 interface DomainObject
        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.
        Specified by:
        canUndo in interface Undoable
      • canRedo

        public boolean canRedo()
        Description copied from interface: Undoable
        Returns true if there is a later state to "redo" to.
        Specified by:
        canRedo in interface Undoable
      • clearUndo

        public void clearUndo()
        Description copied from interface: Undoable
        Clear all undoable/redoable transactions
        Specified by:
        clearUndo in interface Undoable
      • 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".
        Specified by:
        undo in interface Undoable
        Throws:
        java.io.IOException - if an IO error occurs
      • 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".
        Specified by:
        redo in interface Undoable
        Throws:
        java.io.IOException - if an IO error occurs
      • 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 interface Undoable
      • 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 interface Undoable
      • addTransactionListener

        public void addTransactionListener​(TransactionListener listener)
        Description copied from interface: Undoable
        Adds the given transaction listener to this domain object
        Specified by:
        addTransactionListener in interface Undoable
        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 interface Undoable
        Parameters:
        listener - the transaction listener to remove
      • getListing

        public Listing getListing()
        Description copied from interface: Program
        Get the listing object.
        Specified by:
        getListing in interface Program
        Returns:
        the Listing interface to the listing object.
      • getSymbolTable

        public SymbolTable getSymbolTable()
        Description copied from interface: Program
        Get the symbol table object.
        Specified by:
        getSymbolTable in interface Program
        Returns:
        the symbol table object.
      • getEquateTable

        public EquateTable getEquateTable()
        Description copied from interface: Program
        Get the equate table object.
        Specified by:
        getEquateTable in interface Program
        Returns:
        the equate table.
      • getMemory

        public Memory getMemory()
        Description copied from interface: Program
        Get the memory object.
        Specified by:
        getMemory in interface Program
        Returns:
        the memory object.
      • 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 interface Program
        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 interface Program
        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 interface Program
        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 interface Program
        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 interface Program
      • 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 interface Program
        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 interface Program
      • 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 interface Program
        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 interface Program
        Returns:
        the creation date of this program
      • getLanguage

        public Language getLanguage()
        Description copied from interface: Program
        Returns the language used by this program.
        Specified by:
        getLanguage in interface Program
        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 interface Program
        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 interface Program
        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 interface Program
        Returns:
        the user property manager.
      • getMinAddress

        public Address getMinAddress()
        Description copied from interface: Program
        get the program's minimum address.
        Specified by:
        getMinAddress in interface Program
        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 interface Program
        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 interface Program
        Returns:
        set of changed addresses within program.
      • 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 interface Program
        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 interface Program
        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 interface Program
      • getRegister

        public Register getRegister​(java.lang.String name)
        Description copied from interface: Program
        Returns the register with the given name;
        Specified by:
        getRegister in interface Program
        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 interface Program
        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 interface Program
        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 interface Program
        Parameters:
        addr - register address
        size - 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 interface Program
        Returns:
        register or null
      • getImageBase

        public Address getImageBase()
        Description copied from interface: Program
        Returns the current program image base address;
        Specified by:
        getImageBase in interface Program
      • 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 interface Program
        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 interface Program
      • 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 interface Program
        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 interface Program
      • 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 interface Program
        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 interface Program
        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 interface Program
        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 interface Program
        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 interface Program
        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 interface Program