Interface Program

  • All Superinterfaces:
    DataTypeManagerDomainObject, DataTypeManagerOwner, DomainObject, Undoable, UndoableDomainObject
    All Known Implementing Classes:
    ProgramDB

    public interface Program
    extends DataTypeManagerDomainObject
    This interface represents the main entry point into an object which stores all information relating to a single program. This program model divides a program into four major parts: the memory, the symbol table, the equate table, and the listing. Each of these parts has an extensive interface and can be retrieved via this program interface. Although the components are divided into separate objects, they are not independent. Any changes to one component may and probably will affect the other components. Also, the state of one component will restrict the actions of another component. For example, the createCodeUnit() method of listing will fail if memory is undefined at the address where the codeUnit is to be created.
    • Field Detail

      • DISASSEMBLER_PROPERTIES

        static final java.lang.String DISASSEMBLER_PROPERTIES
        See Also:
        Constant Field Values
      • PROGRAM_INFO

        static final java.lang.String PROGRAM_INFO
        Name of program information property list
        See Also:
        Constant Field Values
      • PROGRAM_SETTINGS

        static final java.lang.String PROGRAM_SETTINGS
        Name of program settings property list
        See Also:
        Constant Field Values
      • ANALYZED

        static final java.lang.String ANALYZED
        Name of boolean analyzed property
        See Also:
        Constant Field Values
      • DATE_CREATED

        static final java.lang.String DATE_CREATED
        Name of date created property
        See Also:
        Constant Field Values
      • CREATED_WITH_GHIDRA_VERSION

        static final java.lang.String CREATED_WITH_GHIDRA_VERSION
        Name of ghidra version property
        See Also:
        Constant Field Values
      • ANALYSIS_START_DATE

        static final java.lang.String ANALYSIS_START_DATE
        Creation date to ask for analysis
        See Also:
        Constant Field Values
      • ANALYSIS_START_DATE_FORMAT

        static final java.lang.String ANALYSIS_START_DATE_FORMAT
        Format string of analysis date
        See Also:
        Constant Field Values
      • JANUARY_1_1970

        static final java.util.Date JANUARY_1_1970
        A date from January 1, 1970
      • MAX_OPERANDS

        static final int MAX_OPERANDS
        The maximum number of operands for any assembly language
        See Also:
        Constant Field Values
    • Method Detail

      • getListing

        Listing getListing()
        Get the listing object.
        Returns:
        the Listing interface to the listing object.
      • getAddressMap

        AddressMap getAddressMap()
        Get the internal program address map
        Returns:
        internal address map
      • getFunctionManager

        FunctionManager getFunctionManager()
        Returns the programs function manager.
        Returns:
        the function manager
      • getProgramUserData

        ProgramUserData getProgramUserData()
        Returns the user-specific data manager for this program.
        Returns:
        the program-specific user data manager
      • getSymbolTable

        SymbolTable getSymbolTable()
        Get the symbol table object.
        Returns:
        the symbol table object.
      • getExternalManager

        ExternalManager getExternalManager()
        Returns the external manager.
        Returns:
        the external manager
      • getEquateTable

        EquateTable getEquateTable()
        Get the equate table object.
        Returns:
        the equate table.
      • getMemory

        Memory getMemory()
        Get the memory object.
        Returns:
        the memory object.
      • getReferenceManager

        ReferenceManager getReferenceManager()
        Get the reference manager.
        Returns:
        the reference manager
      • getBookmarkManager

        BookmarkManager getBookmarkManager()
        Get the bookmark manager.
        Returns:
        the bookmark manager
      • getDefaultPointerSize

        int getDefaultPointerSize()
        Gets the default pointer size in bytes as it may be stored within the program listing.
        Returns:
        default pointer size.
        See Also:
        DataOrganization.getPointerSize()
      • getCompiler

        java.lang.String getCompiler()
        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.
        Returns:
        name of the compiler or "unknown".
      • setCompiler

        void setCompiler​(java.lang.String compiler)
        Sets the name of the compiler which created this program.
        Parameters:
        compiler - the name
      • getExecutablePath

        java.lang.String getExecutablePath()
        Gets the path to the program's executable file. For example, C:\Temp\test.exe. This will allow plugins to execute the program.
        Returns:
        String path to program's exe file
      • setExecutablePath

        void setExecutablePath​(java.lang.String path)
        Sets the path to the program's executable file. For example, C:\Temp\test.exe.
        Parameters:
        path - the path to the program's exe
      • getExecutableFormat

        java.lang.String getExecutableFormat()
        Returns a value corresponding to the original file format.
        Returns:
        original file format used to load program or null if unknown
      • setExecutableFormat

        void setExecutableFormat​(java.lang.String format)
        Sets the value corresponding to the original file format.
        Parameters:
        format - the binary file format string to set.
      • getExecutableMD5

        java.lang.String getExecutableMD5()
        Returns a value corresponding to the original binary file MD5 hash.
        Returns:
        original loaded file MD5 or null
      • setExecutableMD5

        void setExecutableMD5​(java.lang.String md5)
        Sets the value corresponding to the original binary file MD5 hash.
        Parameters:
        md5 - MD5 binary file hash
      • setExecutableSHA256

        void setExecutableSHA256​(java.lang.String sha256)
        Sets the value corresponding to the original binary file SHA256 hash.
        Parameters:
        sha256 - SHA256 binary file hash
      • getExecutableSHA256

        java.lang.String getExecutableSHA256()
        Returns a value corresponding to the original binary file SHA256 hash.
        Returns:
        original loaded file SHA256 or null
      • getCreationDate

        java.util.Date getCreationDate()
        Returns the creation date of this program. If the program was created before this property existed, then Jan 1, 1970 is returned.
        Returns:
        the creation date of this program
      • getRelocationTable

        RelocationTable getRelocationTable()
        Gets the relocation table.
        Returns:
        relocation table object
      • getLanguage

        Language getLanguage()
        Returns the language used by this program.
        Returns:
        the language used by this program.
      • getCompilerSpec

        CompilerSpec getCompilerSpec()
        Returns the CompilerSpec currently used by this program.
        Returns:
        the compilerSpec currently used by this program.
      • getLanguageID

        LanguageID getLanguageID()
        Return the name of the language used by this program.
        Returns:
        the name of the language
      • getUsrPropertyManager

        PropertyMapManager getUsrPropertyManager()
        Get the user propertyMangager stored with this program. The user property manager is used to store arbitrary address indexed information associated with the program.
        Returns:
        the user property manager.
      • getProgramContext

        ProgramContext getProgramContext()
        Returns the program context.
        Returns:
        the program context object
      • getMinAddress

        Address getMinAddress()
        get the program's minimum address.
        Returns:
        the program's minimum address or null if no memory blocks have been defined in the program.
      • getMaxAddress

        Address getMaxAddress()
        Get the programs maximum address.
        Returns:
        the program's maximum address or null if no memory blocks have been defined in the program.
      • getChanges

        ProgramChangeSet getChanges()
        Get the program changes since the last save as a set of addresses.
        Returns:
        set of changed addresses within program.
      • getAddressFactory

        AddressFactory getAddressFactory()
        Returns the AddressFactory for this program.
        Returns:
        the program address factory
      • parseAddress

        Address[] parseAddress​(java.lang.String addrStr)
        Return an array of Addresses that could represent the given string.
        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

        Address[] parseAddress​(java.lang.String addrStr,
                               boolean caseSensitive)
        Return an array of Addresses that could represent the given string.
        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

        void invalidate()
        Invalidates any caching in a program. NOTE: Over-using this method can adversely affect system performance.
      • getRegister

        Register getRegister​(java.lang.String name)
        Returns the register with the given name;
        Parameters:
        name - the name of the register to retrieve
        Returns:
        register or null
      • getRegister

        Register getRegister​(Address addr)
        Returns the largest register located at the specified address
        Parameters:
        addr - register minimum address
        Returns:
        largest register at addr or null
      • getRegisters

        Register[] getRegisters​(Address addr)
        Returns all registers located at the specified address
        Parameters:
        addr - register minimum address
        Returns:
        all registers at addr
      • getRegister

        Register getRegister​(Address addr,
                             int size)
        Returns a specific register based upon its address and size
        Parameters:
        addr - register address
        size - the size of the register (in bytes);
        Returns:
        register or null
      • getRegister

        Register getRegister​(Varnode varnode)
        Returns the register which corresponds to the specified varnode
        Parameters:
        varnode - the varnode
        Returns:
        register or null
      • getImageBase

        Address getImageBase()
        Returns the current program image base address
        Returns:
        program image base address within default space
      • setImageBase

        void setImageBase​(Address base,
                          boolean commit)
                   throws AddressOverflowException,
                          LockException,
                          java.lang.IllegalStateException
        Sets the program's image base address.
        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

        void restoreImageBase()
        Restores the last committed image base.
      • setLanguage

        void setLanguage​(Language language,
                         CompilerSpecID compilerSpecID,
                         boolean forceRedisassembly,
                         TaskMonitor monitor)
                  throws java.lang.IllegalStateException,
                         IncompatibleLanguageException,
                         LockException
        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".
        Parameters:
        language - the new language to use.
        compilerSpecID - the new compiler specification ID
        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

        Namespace getGlobalNamespace()
        Returns the global namespace for this program
        Returns:
        the global namespace
      • createAddressSetPropertyMap

        AddressSetPropertyMap createAddressSetPropertyMap​(java.lang.String name)
                                                   throws DuplicateNameException
        Create a new AddressSetPropertyMap with the specified name.
        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

        IntRangeMap createIntRangeMap​(java.lang.String name)
                               throws DuplicateNameException
        Create a new IntRangeMap with the specified name.
        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

        AddressSetPropertyMap getAddressSetPropertyMap​(java.lang.String name)
        Get the property map with the given name.
        Parameters:
        name - name of the property map
        Returns:
        null if no property map exist with the given name
      • getIntRangeMap

        IntRangeMap getIntRangeMap​(java.lang.String name)
        Get the property map with the given name.
        Parameters:
        name - name of the property map
        Returns:
        null if no property map exist with the given name
      • deleteAddressSetPropertyMap

        void deleteAddressSetPropertyMap​(java.lang.String name)
        Remove the property map from the program.
        Parameters:
        name - name of the property map to remove
      • deleteIntRangeMap

        void deleteIntRangeMap​(java.lang.String name)
        Remove the property map from the program.
        Parameters:
        name - name of the property map to remove
      • getUniqueProgramID

        long getUniqueProgramID()
        Returns an ID that is unique for this program. This provides an easy way to store references to a program across client persistence.
        Returns:
        unique program ID