Class ProgramMerge

  • All Implemented Interfaces:
    PropertyVisitor

    public class ProgramMerge
    extends java.lang.Object
    implements PropertyVisitor
    ProgramMerge is a class for merging the differences between two programs. The differences are merged from program2 into program1.

    Program1 is the program being modified by the merge. Program2 is source for obtaining differences to apply to program1.

    If name conflicts occur while merging, the item (for example, symbol) will be merged with a new name that consists of the original name followed by "_conflict" and a one up number.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String SYMBOL_CONFLICT_SUFFIX
      Suffix that is attached to a symbol name and then followed by a number to create a new unique symbol name.
    • Constructor Summary

      Constructors 
      Constructor Description
      ProgramMerge​(Program resultProgram, Program originProgram)
      ProgramMerge allows the merging of differences from program2 into program1 (the result program).
      ProgramMerge​(AddressTranslator originToResultTranslator)
      ProgramMerge allows the merging of differences from program2 (the origin program) into program1 (the result program).
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Reference addReference​(Reference originRef, long toSymbolID, boolean replaceExtLoc)
      addReference creates a reference in program1 that is equivalent to the one specified as a parameter.
      void applyFunctionTagChanges​(AddressSetView originAddressSet, int setting, java.util.Set<FunctionTag> discardTags, java.util.Set<FunctionTag> keepTags, TaskMonitor monitor)
      Merges/replaces tags of program2 into program1.
      void clearErrorMessage()
      This method clears the current error message.
      void clearInfoMessage()
      This method clears the current informational message.
      java.lang.String getErrorMessage()
      Get the error messages that resulted from the last call to a merge or replace method.
      java.lang.String getInfoMessage()
      Get the information messages that resulted from the last call to a merge or replace method.
      Program getOriginProgram()
      Gets the origin program.
      Program getResultProgram()
      Gets the result program.
      static java.lang.String getUniqueName​(SymbolTable symbolTable, java.lang.String name, Address address, Namespace namespace1, Namespace namespace2, SymbolType type)
      Create a name that is unique in both namespaces of the given symbolTable.
      static java.lang.String getUniqueName​(SymbolTable symbolTable, java.lang.String name, Address address, Namespace namespace, SymbolType type)
      Create a name that is unique in the indicated namespace of the symbol table.
      boolean hasErrorMessage()
      Determines if this ProgramMerge currently has an error message.
      boolean hasInfoMessage()
      Determines if this ProgramMerge currently has an informational message.
      void mergeBookmark​(Address originAddress, java.lang.String type, java.lang.String category, TaskMonitor monitor)
      mergeBookmark merges the indicated bookmark from the origin program into the result program at an address equivalent to the originAddress.
      void mergeBytes​(AddressSetView originAddressSet, boolean overwriteInstructions, TaskMonitor monitor)
      mergeBytes merges byte differences within the specified address set.
      void mergeCodeUnits​(AddressSetView originAddressSet, AddressSetView byteDiffs, boolean mergeDataBytes, TaskMonitor monitor)
      mergeCodeUnits merges all instructions &/or data (as indicated) in the specified address set from the origin program.
      void mergeComment​(AddressSet originAddressSet, int type, boolean both, TaskMonitor monitor)
      mergeComment merges/replaces comments of the indicated type wherever they occur in the specified address set.
      void mergeComments​(int commentType, Address originAddress)
      mergeComments merges the comment of the indicated type in program1 with the comment in program2 at the specified address.
      void mergeCommentType​(AddressSetView originAddressSet, int type, int setting, TaskMonitor monitor)
      mergeCommentType merges/replaces comments of the indicated type wherever they occur in the specified address set.
      void mergeEquate​(Address originAddress, int opIndex, long value)
      mergeEquate replaces the current equates in program1 with those in program2.
      void mergeEquates​(AddressSetView originAddressSet, TaskMonitor monitor)
      mergeEquates merges the equate differences in the specified address set.
      Function mergeFunction​(Address entry, TaskMonitor monitor)
      mergeFunction completely replaces any function at the indicated address in program1 with the function, if any, in program2.
      void mergeFunctionLocalSize​(Address entry2, TaskMonitor monitor)
      mergeFunctionLocalSize replaces the local size of the function in program1 with the local size of the function in program2 at the specified entry point address.
      void mergeFunctionName​(Address entry2, TaskMonitor monitor)
      mergeFunctionName replaces the name of the function in program1 with the name of the function in program2 at the specified entry point address.
      void mergeFunctionReturn​(Address entry2)
      mergeFunctionReturn replaces the return type/storage of the function in program1 with the return type/storage of the function in program2 at the specified entry point address.
      void mergeFunctionReturnAddressOffset​(Address entry2, TaskMonitor monitor)
      mergeFunctionReturnAddressOffset replaces the return address offset of the function in program1 with the return address offset of the function in program2 at the specified entry point address.
      void mergeFunctions​(AddressSetView addrSet, TaskMonitor monitor)
      mergeFunctions merges function differences within the specified address set.
      void mergeFunctionStackPurgeSize​(Address entry2, TaskMonitor monitor)
      mergeFunctionStackPurgeSize replaces the stack purge size of the function in program1 with the stack purge size of the function in program2 at the specified entry point address.
      void mergeLabels​(AddressSetView originAddressSet, int setting, TaskMonitor monitor)
      mergeLabels merges all symbols and aliases in the specified address set from the second program.
      void mergeProperties​(AddressSetView originAddressSet, TaskMonitor monitor)
      mergeProperties merges user defined property differences within the specified address set.
      void mergeReferences​(AddressSetView originAddressSet, boolean onlyKeepDefaults, TaskMonitor monitor)
      mergeReferences merges the references in program1 for the specified address set with the references from program2.
      void mergeUserProperty​(java.lang.String userPropertyName, Address originAddress)
      Replaces the user defined properties from the specified origin address in the origin program to the equivalent result address in the result program.
      void replaceComment​(int commentType, Address originAddress)
      replaceComment replaces the comment of the indicated type in program1 with the comment in program2 at the specified address.
      Function replaceExternalFunction​(Function toFunction, Function fromFunction, TaskMonitor monitor)
      Replaces the external result function with the origin Function.
      void replaceFallThroughs​(AddressSetView originAddressSet, TaskMonitor monitor)
      replaceFallThroughs replaces all fallthroughs in program1 for the specified address set with those in program2 where they differ.
      void replaceFunctionCallingConvention​(Address originEntryPoint, TaskMonitor monitor)
      replaceFunctionCallingConvention changes the function calling convention in program1 if it doesn't match the function calling convention in program2 at the specified entry point address.
      void replaceFunctionCustomStorageFlag​(Address originEntryPoint, TaskMonitor monitor)
      replaceFunctionCustomStorageFlag changes whether the flag is set indicating the function does not return in program1 if it doesn't match the "custom storage" flag in the function in program2 at the specified entry point address.
      void replaceFunctionInlineFlag​(Address originEntryPoint, TaskMonitor monitor)
      replaceFunctionInlineFlag changes whether the function is inline in program1 if it doesn't match whether the function is inline in program2 at the specified entry point address.
      void replaceFunctionNames​(AddressSetView originAddressSet, TaskMonitor monitor)
      replaceFunctionNames merges function name and namespace differences within the specified address set.
      void replaceFunctionNoReturnFlag​(Address originEntryPoint, TaskMonitor monitor)
      replaceFunctionNoReturnFlag changes whether the flag is set indicating the function does not return in program1 if it doesn't match the "does not return" flag in the function in program2 at the specified entry point address.
      void replaceFunctionParameterComment​(Address originEntryPoint, int ordinal, TaskMonitor monitor)
      replaceFunctionParameterComment replaces the comment of the indicated function parameter in program1 with the comment from the origin program.
      void replaceFunctionParameterDataType​(Address originEntryPoint, int ordinal, TaskMonitor monitor)
      replaceFunctionParameterDataType replaces the data type of the indicated function parameter in program1 with the data type from the origin program.
      void replaceFunctionParameterName​(Address originEntryPoint, int ordinal, TaskMonitor monitor)
      replaceFunctionParameterName replaces the name of the indicated function parameter in program1 with the name from the origin program.
      void replaceFunctionParameters​(Address originEntryPoint, TaskMonitor monitor)
      replaceFunctionParameters replaces the parameters of the function in program1 with the parameters of the function in program2 at the specified entry point address.
      void replaceFunctionParameters​(Function toFunc, Function fromFunc)
      replaceFunctionParameters replaces the parameters of the function in program1 with the parameters of the function in program2 at the specified entry point address.
      void replaceFunctionSignatureSource​(Address originEntryPoint, TaskMonitor monitor)
      replaceFunctionSignatureSource changes the result function's signature source to match the origin program's signature source.
      void replaceFunctionVarArgs​(Address entry2, TaskMonitor monitor)
      replaceFunctionVarArgs changes whether the function has VarArgs in program1 if it doesn't match the use of VarArgs in the function in program2 at the specified entry point address.
      void replaceFunctionVariable​(Address originEntryPoint, Variable var, TaskMonitor monitor)
      replaceFunctionVariable replaces the name of the indicated function variable in program1 with that from the origin program.
      void replaceFunctionVariableComment​(Address originEntryPoint, Variable var, TaskMonitor monitor)
      replaceFunctionVariableComment replaces the comment on the indicated function variable in program1 with the comment from the equivalent variable in program2.
      void replaceFunctionVariableDataType​(Address originEntryPoint, Variable var, TaskMonitor monitor)
      replaceFunctionVariableDataType replaces the data type on the indicated function variable in program1 with the data type from the equivalent variable in program2.
      void replaceFunctionVariableName​(Address originEntryPoint, Variable var, TaskMonitor monitor)
      replaceFunctionVariableName replaces the name on the indicated function variable in program1 with the name from the equivalent variable in program2.
      void replaceLabels​(AddressSet originAddressSet, boolean replaceFunction, TaskMonitor monitor)
      replaceLabels replaces all symbols and aliases in the specified address set from the second program.
      Reference replaceReference​(Reference resultRef, Reference originRef)
      Replaces the reference in program1 with the reference from the origin program.
      Reference replaceReference​(Reference resultRef, Reference originRef, long toSymbolID)
      Replaces the reference in program1 with the reference from the origin program.
      void replaceReferences​(Address originAddress, int operandIndex)
      replaceReferences replaces all references in program1 for the specified address and operand index with those in program2.
      void replaceReferences​(AddressSetView originAddressSet, boolean onlyKeepDefaults, TaskMonitor monitor)
      replaceReferences replaces all references in program1 for the specified address set with the references from program2.
      void replaceReferences​(AddressSetView originAddressSet, TaskMonitor monitor)
      replaceReferences replaces all references in program1 for the specified address set with those in program2.
      void replaceVariables​(Address originEntryPoint, java.util.List<Variable> varList, TaskMonitor monitor)
      replaceFunctionVariables replaces the function variables/parameters in program1 with that from the origin program.
      void visit()
      Set the property on the merge program's code unit if the named property is a void property type.
      void visit​(int value)
      Set the property on the merge program's code unit if the named property is an int property type.
      void visit​(Saveable value)
      Set the property on the merge program's code unit if the named property is an Object property type.
      void visit​(java.lang.Object value)
      Set the property on the merge program's code unit if the named property is an Object property type.
      void visit​(java.lang.String value)
      Set the property on the merge program's code unit if the named property is a String property type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SYMBOL_CONFLICT_SUFFIX

        public static java.lang.String SYMBOL_CONFLICT_SUFFIX
        Suffix that is attached to a symbol name and then followed by a number to create a new unique symbol name.
    • Constructor Detail

      • ProgramMerge

        public ProgramMerge​(Program resultProgram,
                            Program originProgram)
        ProgramMerge allows the merging of differences from program2 into program1 (the result program).
        Parameters:
        resultProgram - The result program that will get modified by merge.
        originProgram - The program (used as read only) for obtaining differences to merge.
      • ProgramMerge

        public ProgramMerge​(AddressTranslator originToResultTranslator)
        ProgramMerge allows the merging of differences from program2 (the origin program) into program1 (the result program).
        If the address translator is not a "one for one translator" then certain methods within this class will throw an UnsupportedOperationException. The destination program from the address translator should be the result program into which changes are made. The source program from the translator is the origin program for obtaining the changes.
        Parameters:
        addressTranslator - converts addresses from the origin program into an equivalent address in the destination program.
        See Also:
        AddressTranslator
    • Method Detail

      • getResultProgram

        public Program getResultProgram()
        Gets the result program. Merge changes are applied to this program.
        Returns:
        the program being changed by the merge.
      • getOriginProgram

        public Program getOriginProgram()
        Gets the origin program. This program is used for obtaining things to merge into program1.
        Returns:
        the program we are obtaining the changes from which we will merge.
      • hasErrorMessage

        public boolean hasErrorMessage()
        Determines if this ProgramMerge currently has an error message.
        Returns:
        true if there is an error message.
      • hasInfoMessage

        public boolean hasInfoMessage()
        Determines if this ProgramMerge currently has an informational message.
        Returns:
        true if there is an information message.
      • getErrorMessage

        public java.lang.String getErrorMessage()
        Get the error messages that resulted from the last call to a merge or replace method. These are errors that prevented something from being merged.
        Important: Call clearErrorMessage() to clear the current error message after this returns it.
        Returns:
        the error message string or an empty string if there were no problems with the merge.
      • getInfoMessage

        public java.lang.String getInfoMessage()
        Get the information messages that resulted from the last call to a merge or replace method. These messages are non-critical changes that were necessary during the merge. For example giving a symbol a name with a conflict extension because another symbol with that name existed elsewhere in the program already.
        Important: Call clearInfoMessage() to clear the current info message after this returns it.
        Returns:
        the information message string or an empty string if there were no informational messages for the merge.
      • clearErrorMessage

        public void clearErrorMessage()
        This method clears the current error message.
      • clearInfoMessage

        public void clearInfoMessage()
        This method clears the current informational message.
      • mergeBytes

        public void mergeBytes​(AddressSetView originAddressSet,
                               boolean overwriteInstructions,
                               TaskMonitor monitor)
                        throws MemoryAccessException,
                               CancelledException,
                               java.lang.UnsupportedOperationException
        mergeBytes merges byte differences within the specified address set.
        Note: Any instructions at the equivalent byte addresses in the result program will get cleared and re-created resulting in the existing references being dropped.
        Parameters:
        originAddressSet - the addresses to be merged. The addresses in this set are derived from the origin program.
        overwriteInstructions - if true affected instructions will be cleared and re-disassmebled after bytes are modified
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        MemoryAccessException - if bytes can't be merged.
        CancelledException - if user cancels via the monitor.
        java.lang.UnsupportedOperationException - if the ProgramMerge translator is not a "one for one translator".
      • mergeCodeUnits

        public void mergeCodeUnits​(AddressSetView originAddressSet,
                                   AddressSetView byteDiffs,
                                   boolean mergeDataBytes,
                                   TaskMonitor monitor)
                            throws MemoryAccessException,
                                   CancelledException,
                                   java.lang.UnsupportedOperationException
        mergeCodeUnits merges all instructions &/or data (as indicated) in the specified address set from the origin program. It merges them into the result program. When merging instructions, the bytes are also replaced if they differ. This assumes originToResultTranslator maps address spaces and does not do fine-grained mapping of addresses.
        Parameters:
        addrSet - the addresses to be merged. The addresses in this set should be derived from the origin program.
        byteDiffs - address set indicating addresses where the bytes differ between the result program and the origin program. The addresses in this set should be derived from the origin program.
        mergeDataBytes - true indicates bytes that differ should be copied when merging Data. false means don't copy any bytes for Data.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        MemoryAccessException - if bytes can't be copied.
        CancelledException - if user cancels via the monitor.
        java.lang.UnsupportedOperationException - if the ProgramMerge translator is not a "one for one translator".
      • mergeEquates

        public void mergeEquates​(AddressSetView originAddressSet,
                                 TaskMonitor monitor)
                          throws CancelledException,
                                 java.lang.UnsupportedOperationException
        mergeEquates merges the equate differences in the specified address set.
        Parameters:
        originAddressSet - the addresses to be merged. The addresses in this set should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if user cancels via the monitor.
        java.lang.UnsupportedOperationException - if the ProgramMerge translators are not "one for one translators".
      • mergeEquate

        public void mergeEquate​(Address originAddress,
                                int opIndex,
                                long value)
        mergeEquate replaces the current equates in program1 with those in program2.
        Parameters:
        originAddress - the address where the equates should be merged. This address should be derived from the origin program.
        opIndex - the operand index where the equates should be merged.
        value - the scalar value where the equate is used.
      • replaceReferences

        public void replaceReferences​(AddressSetView originAddressSet,
                                      TaskMonitor monitor)
                               throws CancelledException,
                                      java.lang.UnsupportedOperationException
        replaceReferences replaces all references in program1 for the specified address set with those in program2. If an equivalent reference already exists then it is updated to match the new reference.
        Note: All reference types (memory, stack, external) get replaced where possible. i.e. If a function or variable doesn't exist for a variable reference then it will not be able to replace the reference.
        Parameters:
        originAddressSet - the addresses to be merged. The addresses in this set should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if the user cancels the replace via the monitor.
        java.lang.UnsupportedOperationException - if the ProgramMerge translators are not "one for one translators".
      • replaceReferences

        public void replaceReferences​(AddressSetView originAddressSet,
                                      boolean onlyKeepDefaults,
                                      TaskMonitor monitor)
                               throws CancelledException,
                                      java.lang.UnsupportedOperationException
        replaceReferences replaces all references in program1 for the specified address set with the references from program2. If an equivalent reference already exists then it is updated to match the new reference.
        Note: All reference types (memory, stack, external) get replaced where possible. i.e. If a function or variable doesn't exist for a variable reference then it will not be able to replace the reference.
        Parameters:
        originAddressSet - the addresses to be merged. The addresses in this set should be derived from the origin program.
        onlyKeepDefaults - true indicates to replace all references with only the default references from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if the user cancels the replace via the monitor.
        java.lang.UnsupportedOperationException - if the ProgramMerge translators are not "one for one translators".
      • mergeReferences

        public void mergeReferences​(AddressSetView originAddressSet,
                                    boolean onlyKeepDefaults,
                                    TaskMonitor monitor)
                             throws CancelledException,
                                    java.lang.UnsupportedOperationException
        mergeReferences merges the references in program1 for the specified address set with the references from program2. If an equivalent reference already exists then it is updated to match the new reference if possible. A merge of references prevents the loss of any non-default references already in the result program.
        Important: Fallthrough references will not be merged by this method. Fallthroughs are handled by merging code units.
        Note: All reference types (memory, stack, external) get replaced where possible. i.e. If a function or variable doesn't exist for a variable reference then it will not be able to replace the reference.
        Parameters:
        originAddressSet - the addresses to be merged. The addresses in this set should be derived from the origin program.
        onlyKeepDefaults - true indicates to merge only the default references from the origin program into the result program. Non-default references will not be merged. false indicates merge all references except fallthroughs.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if the user cancels the replace via the monitor.
        java.lang.UnsupportedOperationException - if the ProgramMerge translators are not "one for one translators".
      • replaceReferences

        public void replaceReferences​(Address originAddress,
                                      int operandIndex)
        replaceReferences replaces all references in program1 for the specified address and operand index with those in program2. If an equivalent reference already exists then it is updated to match the new reference.
        Note: All reference types (memory, stack, external) get replaced where possible. i.e. If a function or variable doesn't exist for a variable reference then it will not be able to replace the reference.
        Parameters:
        originAddress - the "from" address where references are to be replaced
        operandIndex - the operand of the code unit at the address where references are to be replaced.
      • replaceReference

        public Reference replaceReference​(Reference resultRef,
                                          Reference originRef)
        Replaces the reference in program1 with the reference from the origin program.
        Parameters:
        resultRef - the program1 reference to be replaced.
        originRef - the program2 reference used to replace what's in program1.
        Returns:
        the resulting reference in program1. null if reference is removed by the replace.
      • replaceReference

        public Reference replaceReference​(Reference resultRef,
                                          Reference originRef,
                                          long toSymbolID)
        Replaces the reference in program1 with the reference from the origin program.
        Parameters:
        resultRef - the program1 reference to be replaced.
        originRef - the program2 reference used to replace what's in program1.
        toSymbolID - ID of the symbol in program1 the resulting reference is to.
        Returns:
        the resulting reference in program1. null if reference is removed by the replace.
      • addReference

        public Reference addReference​(Reference originRef,
                                      long toSymbolID,
                                      boolean replaceExtLoc)
        addReference creates a reference in program1 that is equivalent to the one specified as a parameter. If a symbol ID is specified, the reference will refer to the symbol in program1 with that ID. If the reference is an external reference, then the external location associated with it can be replaced also by setting the replace external location flag.
        Parameters:
        originRef - the reference equivalent to the one to be created.
        toSymbolID - ID of the symbol to referred to. null indicates don't refer directly to a symbol.
        replaceExtLoc - the replace external location flag. true indicates to replace the external location, if applicable, with the one defined for the reference passed to this method.
        Returns:
        the reference that was created. null if none created.
      • replaceFallThroughs

        public void replaceFallThroughs​(AddressSetView originAddressSet,
                                        TaskMonitor monitor)
                                 throws CancelledException
        replaceFallThroughs replaces all fallthroughs in program1 for the specified address set with those in program2 where they differ.
        Parameters:
        originAddressSet - the addresses to be merged. The addresses in this set should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if the user cancels the replace via the monitor.
      • mergeComment

        public void mergeComment​(AddressSet originAddressSet,
                                 int type,
                                 boolean both,
                                 TaskMonitor monitor)
                          throws CancelledException
        mergeComment merges/replaces comments of the indicated type wherever they occur in the specified address set.
        Parameters:
        originAddressSet - the addresses where comments should be merged/replaced. The addresses in this set should be from the origin program.
        type - ProgramMergeFilter comment type. The comment type can be PLATE, PRE, EOL, REPEATABLE, POST.
        both - true means merge both program1 and program2 comments. false means replace the program1 comment with the program2 comment.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if user cancels via the monitor.
      • mergeCommentType

        public void mergeCommentType​(AddressSetView originAddressSet,
                                     int type,
                                     int setting,
                                     TaskMonitor monitor)
                              throws CancelledException
        mergeCommentType merges/replaces comments of the indicated type wherever they occur in the specified address set. It merges them from program2 into program1. This merges eol, pre, post, repeatable, and plate comments.
        Parameters:
        originAddressSet - the addresses to be merged. The addresses in this set should be derived from the origin program.
        type - the comment type. PLATE, PRE, EOL, REPEATABLE, POST
        setting - how to merge. IGNORE, REPLACE, MERGE
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if user cancels via the monitor.
      • mergeComments

        public void mergeComments​(int commentType,
                                  Address originAddress)
        mergeComments merges the comment of the indicated type in program1 with the comment in program2 at the specified address.
        Parameters:
        commentType - comment type to merge (from CodeUnit class).
        EOL_COMMENT, PRE_COMMENT, POST_COMMENT, REPEATABLE_COMMENT, OR PLATE_COMMENT.
        addr - the address This address should be derived from the origin program.
      • replaceComment

        public void replaceComment​(int commentType,
                                   Address originAddress)
        replaceComment replaces the comment of the indicated type in program1 with the comment in program2 at the specified address.
        Parameters:
        commentType - comment type to replace (from CodeUnit class).
        EOL_COMMENT, PRE_COMMENT, POST_COMMENT, REPEATABLE_COMMENT, OR PLATE_COMMENT.
        addr - the address This address should be derived from the origin program.
      • applyFunctionTagChanges

        public void applyFunctionTagChanges​(AddressSetView originAddressSet,
                                            int setting,
                                            java.util.Set<FunctionTag> discardTags,
                                            java.util.Set<FunctionTag> keepTags,
                                            TaskMonitor monitor)
                                     throws CancelledException
        Merges/replaces tags of program2 into program1. When merging, tags that are in conflict are replaced according to the user setting (ignore, replace, merge).
        Parameters:
        originAddressSet - the addresses to be merged.
        setting - how to merge. IGNORE, REPLACE, MERGE
        discardTags - tags to keep out of the final result
        keepTags - tags to add to the final result
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if user cancels via the monitor.
      • mergeLabels

        public void mergeLabels​(AddressSetView originAddressSet,
                                int setting,
                                TaskMonitor monitor)
                         throws CancelledException
        mergeLabels merges all symbols and aliases in the specified address set from the second program. It merges them into the merge program.
        Parameters:
        originAddressSet - the addresses to be merged. The addresses in this address set should be derived from program1.
        setting - the current label setting.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if user cancels via the monitor.
      • replaceLabels

        public void replaceLabels​(AddressSet originAddressSet,
                                  boolean replaceFunction,
                                  TaskMonitor monitor)
                           throws CancelledException
        replaceLabels replaces all symbols and aliases in the specified address set from the second program.
        Parameters:
        originAddressSet - the addresses to be replaced The addresses in this address set should be derived from program1.
        replaceFunction - true indicates the function symbol should be replaced
        monitor - the task monitor for notifying the user of this merge's progress
        Throws:
        CancelledException - if user cancels via the monitor.
      • replaceFunctionNames

        public void replaceFunctionNames​(AddressSetView originAddressSet,
                                         TaskMonitor monitor)
                                  throws CancelledException
        replaceFunctionNames merges function name and namespace differences within the specified address set.
        Parameters:
        originAddressSet - the addresses to be merged. The addresses in this set should be derived from program1.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if user cancels via the monitor.
      • mergeFunctions

        public void mergeFunctions​(AddressSetView addrSet,
                                   TaskMonitor monitor)
                            throws CancelledException
        mergeFunctions merges function differences within the specified address set.
        Parameters:
        addrSet - the addresses to be merged. The addresses in this set should be derived from program1.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if user cancels via the monitor.
      • mergeFunction

        public Function mergeFunction​(Address entry,
                                      TaskMonitor monitor)
                               throws CancelledException
        mergeFunction completely replaces any function at the indicated address in program1 with the function, if any, in program2.
        Parameters:
        entry - the entry point address of the function to be merged. This address should be derived from program1.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if user cancels via the monitor.
      • mergeFunctionReturn

        public void mergeFunctionReturn​(Address entry2)
        mergeFunctionReturn replaces the return type/storage of the function in program1 with the return type/storage of the function in program2 at the specified entry point address.
        Parameters:
        entry - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
      • mergeFunctionName

        public void mergeFunctionName​(Address entry2,
                                      TaskMonitor monitor)
        mergeFunctionName replaces the name of the function in program1 with the name of the function in program2 at the specified entry point address.
        Parameters:
        entry - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        InvalidInputException
        DuplicateNameException
      • replaceFunctionSignatureSource

        public void replaceFunctionSignatureSource​(Address originEntryPoint,
                                                   TaskMonitor monitor)
        replaceFunctionSignatureSource changes the result function's signature source to match the origin program's signature source.
        Parameters:
        originEntryPoint - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
      • mergeFunctionReturnAddressOffset

        public void mergeFunctionReturnAddressOffset​(Address entry2,
                                                     TaskMonitor monitor)
        mergeFunctionReturnAddressOffset replaces the return address offset of the function in program1 with the return address offset of the function in program2 at the specified entry point address.
        Parameters:
        entry2 - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
      • mergeFunctionLocalSize

        public void mergeFunctionLocalSize​(Address entry2,
                                           TaskMonitor monitor)
        mergeFunctionLocalSize replaces the local size of the function in program1 with the local size of the function in program2 at the specified entry point address.
        Parameters:
        entry2 - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
      • mergeFunctionStackPurgeSize

        public void mergeFunctionStackPurgeSize​(Address entry2,
                                                TaskMonitor monitor)
        mergeFunctionStackPurgeSize replaces the stack purge size of the function in program1 with the stack purge size of the function in program2 at the specified entry point address.
        Parameters:
        entry2 - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
      • replaceFunctionVarArgs

        public void replaceFunctionVarArgs​(Address entry2,
                                           TaskMonitor monitor)
        replaceFunctionVarArgs changes whether the function has VarArgs in program1 if it doesn't match the use of VarArgs in the function in program2 at the specified entry point address.
        Parameters:
        entry2 - the entry point address of the function. This address should be derived from program1.
        monitor - the task monitor for notifying the user of this merge's progress.
      • replaceFunctionCallingConvention

        public void replaceFunctionCallingConvention​(Address originEntryPoint,
                                                     TaskMonitor monitor)
        replaceFunctionCallingConvention changes the function calling convention in program1 if it doesn't match the function calling convention in program2 at the specified entry point address.
        Parameters:
        originEntryPoint - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
      • replaceFunctionInlineFlag

        public void replaceFunctionInlineFlag​(Address originEntryPoint,
                                              TaskMonitor monitor)
        replaceFunctionInlineFlag changes whether the function is inline in program1 if it doesn't match whether the function is inline in program2 at the specified entry point address.
        Parameters:
        originEntryPoint - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
      • replaceFunctionNoReturnFlag

        public void replaceFunctionNoReturnFlag​(Address originEntryPoint,
                                                TaskMonitor monitor)
        replaceFunctionNoReturnFlag changes whether the flag is set indicating the function does not return in program1 if it doesn't match the "does not return" flag in the function in program2 at the specified entry point address.
        Parameters:
        originEntryPoint - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
      • replaceFunctionCustomStorageFlag

        public void replaceFunctionCustomStorageFlag​(Address originEntryPoint,
                                                     TaskMonitor monitor)
        replaceFunctionCustomStorageFlag changes whether the flag is set indicating the function does not return in program1 if it doesn't match the "custom storage" flag in the function in program2 at the specified entry point address.
        Parameters:
        originEntryPoint - the entry point address of the function. This address should be derived from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
      • replaceFunctionParameters

        public void replaceFunctionParameters​(Address originEntryPoint,
                                              TaskMonitor monitor)
        replaceFunctionParameters replaces the parameters of the function in program1 with the parameters of the function in program2 at the specified entry point address. It also replaces the return type/storage as well as custom storage use.
        Parameters:
        originEntryPoint - the entry point address of the function. This address should be derived from the origin program.
      • replaceFunctionParameters

        public void replaceFunctionParameters​(Function toFunc,
                                              Function fromFunc)
        replaceFunctionParameters replaces the parameters of the function in program1 with the parameters of the function in program2 at the specified entry point address. It also replaces the return type/storage as well as custom storage use.
        Parameters:
        toFunc - target function
        fromFunc - source function
      • getUniqueName

        public static java.lang.String getUniqueName​(SymbolTable symbolTable,
                                                     java.lang.String name,
                                                     Address address,
                                                     Namespace namespace1,
                                                     Namespace namespace2,
                                                     SymbolType type)
        Create a name that is unique in both namespaces of the given symbolTable.
        Parameters:
        symbolTable - the symbolTable where the symbol will be created.
        name - the desired name. This name will be given a conflict suffix if necessary to make it unique.
        address - the address of the symbol.
        namespace1 - the first namespace where the new symbol should be unique. This namespace must be from the same program as the symbol table.
        namespace2 - the second namespace where the new symbol should be unique. This namespace must be from the same program as the symbol table.
        type - the symbol type of the symbol.
        Returns:
        a unique name for both namespaces.
      • getUniqueName

        public static java.lang.String getUniqueName​(SymbolTable symbolTable,
                                                     java.lang.String name,
                                                     Address address,
                                                     Namespace namespace,
                                                     SymbolType type)
        Create a name that is unique in the indicated namespace of the symbol table.
        Parameters:
        symbolTable - the symbolTable where the symbol will be created.
        name - the desired name. This name will be given a conflict suffix if necessary to make it unique.
        address - the address of the symbol.
        namespace - the namespace where the new symbol would be created. This namespace must be from the same program as the symbol table.
        type - the type of symbol.
        Returns:
        a unique name within the namespace.
      • replaceExternalFunction

        public Function replaceExternalFunction​(Function toFunction,
                                                Function fromFunction,
                                                TaskMonitor monitor)
                                         throws CancelledException,
                                                java.lang.UnsupportedOperationException
        Replaces the external result function with the origin Function.
        Note: This method will replace the function, but does not create the parent namespace or put the function in the parent namespace. This must be done separately.
        Parameters:
        toFunction - the result function to replace.
        fromFunction - the function to use as the model when replacing the result function.
        monitor - the task monitor for notifying the user of this merge's progress.
        Returns:
        the new function that was created in the resultListing or null if no function was created. If null is returned you should call getErrorMessage() to see if an error occurred.
        Throws:
        CancelledException - if user cancels via the monitor.
        java.lang.UnsupportedOperationException - if the ProgramMerge translators are not "one for one translators".
      • replaceFunctionParameterName

        public void replaceFunctionParameterName​(Address originEntryPoint,
                                                 int ordinal,
                                                 TaskMonitor monitor)
                                          throws DuplicateNameException,
                                                 InvalidInputException
        replaceFunctionParameterName replaces the name of the indicated function parameter in program1 with the name from the origin program.
        Parameters:
        originEntryPoint - the entry point address of the function to modify. This address should be derived from the origin program.
        ordinal - the index of the parameter to change.
        monitor - the task monitor for notifying the user of progress.
        Throws:
        InvalidInputException
        DuplicateNameException
      • replaceFunctionParameterDataType

        public void replaceFunctionParameterDataType​(Address originEntryPoint,
                                                     int ordinal,
                                                     TaskMonitor monitor)
        replaceFunctionParameterDataType replaces the data type of the indicated function parameter in program1 with the data type from the origin program.
        Parameters:
        originEntryPoint - the entry point address of the function to modify. This address should be derived from the origin program.
        ordinal - the index of the parameter to change.
        monitor - the task monitor for notifying the user of progress.
      • replaceFunctionParameterComment

        public void replaceFunctionParameterComment​(Address originEntryPoint,
                                                    int ordinal,
                                                    TaskMonitor monitor)
        replaceFunctionParameterComment replaces the comment of the indicated function parameter in program1 with the comment from the origin program.
        Parameters:
        originEntryPoint - the entry point address of the function to modify. This address should be derived from the origin program.
        ordinal - the index of the parameter to change.
        monitor - the task monitor for notifying the user of progress.
      • replaceFunctionVariable

        public void replaceFunctionVariable​(Address originEntryPoint,
                                            Variable var,
                                            TaskMonitor monitor)
        replaceFunctionVariable replaces the name of the indicated function variable in program1 with that from the origin program.
        Parameters:
        entry - the entry point address of the function to modify. This address should be derived from program1.
        var - a variable that is equivalent to the one in program1 to be replaced. The variable passed here could be from another program.
        monitor - the task monitor for notifying the user of progress.
        Throws:
        DuplicateNameException
      • replaceVariables

        public void replaceVariables​(Address originEntryPoint,
                                     java.util.List<Variable> varList,
                                     TaskMonitor monitor)
                              throws CancelledException
        replaceFunctionVariables replaces the function variables/parameters in program1 with that from the origin program.
        Parameters:
        entry - the entry point address of the function to modify. This address should be derived from program1.
        var - a variable that is equivalent to the one in program1 to be replaced. The variable passed here could be from another program.
        monitor - the task monitor for notifying the user of progress.
        Throws:
        DuplicateNameException
        CancelledException
      • replaceFunctionVariableName

        public void replaceFunctionVariableName​(Address originEntryPoint,
                                                Variable var,
                                                TaskMonitor monitor)
                                         throws DuplicateNameException,
                                                InvalidInputException
        replaceFunctionVariableName replaces the name on the indicated function variable in program1 with the name from the equivalent variable in program2.
        Parameters:
        originEntryPoint - the entry point address of the function to modify. This address should be derived from the origin program.
        var - a variable that is equivalent to the one in program1 to be changed. The variable passed here could be from another program.
        monitor - the task monitor for notifying the user of progress.
        Throws:
        InvalidInputException
        DuplicateNameException
      • replaceFunctionVariableDataType

        public void replaceFunctionVariableDataType​(Address originEntryPoint,
                                                    Variable var,
                                                    TaskMonitor monitor)
        replaceFunctionVariableDataType replaces the data type on the indicated function variable in program1 with the data type from the equivalent variable in program2.
        Parameters:
        originEntryPoint - the entry point address of the function to modify. This address should be derived from the origin program.
        var - a variable that is equivalent to the one in program1 to be changed. The variable passed here could be from another program.
        monitor - the task monitor for notifying the user of progress.
      • replaceFunctionVariableComment

        public void replaceFunctionVariableComment​(Address originEntryPoint,
                                                   Variable var,
                                                   TaskMonitor monitor)
        replaceFunctionVariableComment replaces the comment on the indicated function variable in program1 with the comment from the equivalent variable in program2.
        Parameters:
        originEntryPoint - entry point address of the function whose variable is getting the comment replaced. This address should be derived from the origin program.
        var - a variable that is equivalent to the one in program1 to be changed. The variable passed here could be from another program.
        monitor - the task monitor for notifying the user of progress.
      • mergeBookmark

        public void mergeBookmark​(Address originAddress,
                                  java.lang.String type,
                                  java.lang.String category,
                                  TaskMonitor monitor)
                           throws CancelledException
        mergeBookmark merges the indicated bookmark from the origin program into the result program at an address equivalent to the originAddress. Merging means replace any existing bookmark of the specified type for NOTEs or of the specified type and category for non-NOTE types.

        Note: This method merges a single bookmark without affecting other bookmarks at the indicated address.

        Parameters:
        originAddress - the address in the origin program where the bookmark is to be merged.
        type - indicates the type of bookmark to merge.
        category - indicates the category of the bookmark.
        monitor - a task monitor for providing feedback to the user.
        Throws:
        CancelledException - if the user cancels the bookmark merge from the monitor dialog.
      • mergeProperties

        public void mergeProperties​(AddressSetView originAddressSet,
                                    TaskMonitor monitor)
                             throws CancelledException,
                                    java.lang.UnsupportedOperationException
        mergeProperties merges user defined property differences within the specified address set.
        Parameters:
        originAddressSet - the addresses to be merged from the origin program.
        monitor - the task monitor for notifying the user of this merge's progress.
        Throws:
        CancelledException - if user cancels via the monitor.
        java.lang.UnsupportedOperationException - if the ProgramMerge translator is not a "one for one translator".
      • mergeUserProperty

        public void mergeUserProperty​(java.lang.String userPropertyName,
                                      Address originAddress)
        Replaces the user defined properties from the specified origin address in the origin program to the equivalent result address in the result program. Note: To merge properties, there must be a code unit AT the equivalent address in the result program.
        Parameters:
        originAddress - the address of the code unit to get the properties from in the origin program.
      • visit

        public void visit()
        Set the property on the merge program's code unit if the named property is a void property type.
        Specified by:
        visit in interface PropertyVisitor
      • visit

        public void visit​(java.lang.String value)
        Set the property on the merge program's code unit if the named property is a String property type.
        Specified by:
        visit in interface PropertyVisitor
        Parameters:
        value - the value for the named property.
      • visit

        public void visit​(java.lang.Object value)
        Set the property on the merge program's code unit if the named property is an Object property type.
        Specified by:
        visit in interface PropertyVisitor
        Parameters:
        value - the value for the named property.
      • visit

        public void visit​(Saveable value)
        Set the property on the merge program's code unit if the named property is an Object property type.
        Specified by:
        visit in interface PropertyVisitor
        Parameters:
        value - the value for the named property.
      • visit

        public void visit​(int value)
        Set the property on the merge program's code unit if the named property is an int property type.
        Specified by:
        visit in interface PropertyVisitor
        Parameters:
        value - the value for the named property.