Package ghidra.program.util
Class ProgramMerge
- java.lang.Object
-
- ghidra.program.util.ProgramMerge
-
- All Implemented Interfaces:
PropertyVisitor
public class ProgramMerge extends java.lang.Object implements PropertyVisitor
ProgramMergeis 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.StringSYMBOL_CONFLICT_SUFFIXSuffix 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)ProgramMergeallows the merging of differences from program2 into program1 (the result program).ProgramMerge(AddressTranslator originToResultTranslator)ProgramMergeallows 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 ReferenceaddReference(Reference originRef, long toSymbolID, boolean replaceExtLoc)addReferencecreates a reference in program1 that is equivalent to the one specified as a parameter.voidapplyFunctionTagChanges(AddressSetView originAddressSet, int setting, java.util.Set<FunctionTag> discardTags, java.util.Set<FunctionTag> keepTags, TaskMonitor monitor)Merges/replaces tags of program2 into program1.voidclearErrorMessage()This method clears the current error message.voidclearInfoMessage()This method clears the current informational message.java.lang.StringgetErrorMessage()Get the error messages that resulted from the last call to a merge or replace method.java.lang.StringgetInfoMessage()Get the information messages that resulted from the last call to a merge or replace method.ProgramgetOriginProgram()Gets the origin program.ProgramgetResultProgram()Gets the result program.static java.lang.StringgetUniqueName(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.StringgetUniqueName(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.booleanhasErrorMessage()Determines if this ProgramMerge currently has an error message.booleanhasInfoMessage()Determines if this ProgramMerge currently has an informational message.voidmergeBookmark(Address originAddress, java.lang.String type, java.lang.String category, TaskMonitor monitor)mergeBookmarkmerges the indicated bookmark from the origin program into the result program at an address equivalent to the originAddress.voidmergeBytes(AddressSetView originAddressSet, boolean overwriteInstructions, TaskMonitor monitor)mergeBytesmerges byte differences within the specified address set.voidmergeCodeUnits(AddressSetView originAddressSet, AddressSetView byteDiffs, boolean mergeDataBytes, TaskMonitor monitor)mergeCodeUnitsmerges all instructions and/or data (as indicated) in the specified address set from the origin program.voidmergeComment(AddressSet originAddressSet, int type, boolean both, TaskMonitor monitor)mergeCommentmerges/replaces comments of the indicated type wherever they occur in the specified address set.voidmergeComments(int commentType, Address originAddress)mergeCommentsmerges the comment of the indicated type in program1 with the comment in program2 at the specified address.voidmergeCommentType(AddressSetView originAddressSet, int type, int setting, TaskMonitor monitor)mergeCommentTypemerges/replaces comments of the indicated type wherever they occur in the specified address set.voidmergeEquate(Address originAddress, int opIndex, long value)mergeEquatereplaces the current equates in program1 with those in program2.voidmergeEquates(AddressSetView originAddressSet, TaskMonitor monitor)mergeEquatesmerges the equate differences in the specified address set.FunctionmergeFunction(Address entry, TaskMonitor monitor)mergeFunctioncompletely replaces any function at the indicated address in program1 with the function, if any, in program2.voidmergeFunctionLocalSize(Address entry2, TaskMonitor monitor)mergeFunctionLocalSizereplaces the local size of the function in program1 with the local size of the function in program2 at the specified entry point address.voidmergeFunctionName(Address entry2, TaskMonitor monitor)mergeFunctionNamereplaces the name of the function in program1 with the name of the function in program2 at the specified entry point address.voidmergeFunctionReturn(Address entry2)mergeFunctionReturnreplaces 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.voidmergeFunctionReturnAddressOffset(Address entry2, TaskMonitor monitor)mergeFunctionReturnAddressOffsetreplaces 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.voidmergeFunctions(AddressSetView addrSet, TaskMonitor monitor)mergeFunctionsmerges function differences within the specified address set.voidmergeFunctionStackPurgeSize(Address entry2, TaskMonitor monitor)mergeFunctionStackPurgeSizereplaces 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.voidmergeLabels(AddressSetView originAddressSet, int setting, TaskMonitor monitor)mergeLabelsmerges all symbols and aliases in the specified address set from the second program.voidmergeProperties(AddressSetView originAddressSet, TaskMonitor monitor)mergePropertiesmerges user defined property differences within the specified address set.voidmergeReferences(AddressSetView originAddressSet, boolean onlyKeepDefaults, TaskMonitor monitor)mergeReferencesmerges the references in program1 for the specified address set with the references from program2.voidmergeUserProperty(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.voidreplaceComment(int commentType, Address originAddress)replaceCommentreplaces the comment of the indicated type in program1 with the comment in program2 at the specified address.FunctionreplaceExternalFunction(Function toFunction, Function fromFunction, TaskMonitor monitor)Replaces the external result function with the origin Function.voidreplaceFallThroughs(AddressSetView originAddressSet, TaskMonitor monitor)replaceFallThroughsreplaces all fallthroughs in program1 for the specified address set with those in program2 where they differ.voidreplaceFunctionCallingConvention(Address originEntryPoint, TaskMonitor monitor)replaceFunctionCallingConventionchanges the function calling convention in program1 if it doesn't match the function calling convention in program2 at the specified entry point address.voidreplaceFunctionCustomStorageFlag(Address originEntryPoint, TaskMonitor monitor)replaceFunctionCustomStorageFlagchanges 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.voidreplaceFunctionInlineFlag(Address originEntryPoint, TaskMonitor monitor)replaceFunctionInlineFlagchanges 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.voidreplaceFunctionNames(AddressSetView originAddressSet, TaskMonitor monitor)replaceFunctionNamesmerges function name and namespace differences within the specified address set.voidreplaceFunctionNoReturnFlag(Address originEntryPoint, TaskMonitor monitor)replaceFunctionNoReturnFlagchanges 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.voidreplaceFunctionParameterComment(Address originEntryPoint, int ordinal, TaskMonitor monitor)replaceFunctionParameterCommentreplaces the comment of the indicated function parameter in program1 with the comment from the origin program.voidreplaceFunctionParameterDataType(Address originEntryPoint, int ordinal, TaskMonitor monitor)replaceFunctionParameterDataTypereplaces the data type of the indicated function parameter in program1 with the data type from the origin program.voidreplaceFunctionParameterName(Address originEntryPoint, int ordinal, TaskMonitor monitor)replaceFunctionParameterNamereplaces the name of the indicated function parameter in program1 with the name from the origin program.voidreplaceFunctionParameters(Address originEntryPoint, TaskMonitor monitor)replaceFunctionParametersreplaces the parameters of the function in program1 with the parameters of the function in program2 at the specified entry point address.voidreplaceFunctionParameters(Function toFunc, Function fromFunc)replaceFunctionParametersreplaces the parameters of the function in program1 with the parameters of the function in program2 at the specified entry point address.voidreplaceFunctionSignatureSource(Address originEntryPoint, TaskMonitor monitor)replaceFunctionSignatureSourcechanges the result function's signature source to match the origin program's signature source.voidreplaceFunctionVarArgs(Address entry2, TaskMonitor monitor)replaceFunctionVarArgschanges 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.voidreplaceFunctionVariable(Address originEntryPoint, Variable var, TaskMonitor monitor)replaceFunctionVariablereplaces the name of the indicated function variable in program1 with that from the origin program.voidreplaceFunctionVariableComment(Address originEntryPoint, Variable var, TaskMonitor monitor)replaceFunctionVariableCommentreplaces the comment on the indicated function variable in program1 with the comment from the equivalent variable in program2.voidreplaceFunctionVariableDataType(Address originEntryPoint, Variable var, TaskMonitor monitor)replaceFunctionVariableDataTypereplaces the data type on the indicated function variable in program1 with the data type from the equivalent variable in program2.voidreplaceFunctionVariableName(Address originEntryPoint, Variable var, TaskMonitor monitor)replaceFunctionVariableNamereplaces the name on the indicated function variable in program1 with the name from the equivalent variable in program2.voidreplaceLabels(AddressSet originAddressSet, boolean replaceFunction, TaskMonitor monitor)replaceLabelsreplaces all symbols and aliases in the specified address set from the second program.ReferencereplaceReference(Reference resultRef, Reference originRef)Replaces the reference in program1 with the reference from the origin program.ReferencereplaceReference(Reference resultRef, Reference originRef, long toSymbolID)Replaces the reference in program1 with the reference from the origin program.voidreplaceReferences(Address originAddress, int operandIndex)replaceReferencesreplaces all references in program1 for the specified address and operand index with those in program2.voidreplaceReferences(AddressSetView originAddressSet, boolean onlyKeepDefaults, TaskMonitor monitor)replaceReferencesreplaces all references in program1 for the specified address set with the references from program2.voidreplaceReferences(AddressSetView originAddressSet, TaskMonitor monitor)replaceReferencesreplaces all references in program1 for the specified address set with those in program2.voidreplaceVariables(Address originEntryPoint, java.util.List<Variable> varList, TaskMonitor monitor)replaceFunctionVariablesreplaces the function variables/parameters in program1 with that from the origin program.voidvisit()Set the property on the merge program's code unit if the named property is a void property type.voidvisit(int value)Set the property on the merge program's code unit if the named property is an int property type.voidvisit(Saveable value)Set the property on the merge program's code unit if the named property is an Object property type.voidvisit(java.lang.Object value)Set the property on the merge program's code unit if the named property is an Object property type.voidvisit(java.lang.String value)Set the property on the merge program's code unit if the named property is a String property type.
-
-
-
Constructor Detail
-
ProgramMerge
public ProgramMerge(Program resultProgram, Program originProgram)
ProgramMergeallows 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)
ProgramMergeallows 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:
originToResultTranslator- 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
mergeBytesmerges 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 modifiedmonitor- 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
mergeCodeUnitsmerges all instructions and/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:
originAddressSet- 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
mergeEquatesmerges 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)
mergeEquatereplaces 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
replaceReferencesreplaces 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
replaceReferencesreplaces 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
mergeReferencesmerges 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)
replaceReferencesreplaces 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 replacedoperandIndex- 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)
addReferencecreates 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
replaceFallThroughsreplaces 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
mergeCommentmerges/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
mergeCommentTypemerges/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, POSTsetting- how to merge. IGNORE, REPLACE, MERGEmonitor- 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)mergeCommentsmerges 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.originAddress- the address This address should be derived from the origin program.
-
replaceComment
public void replaceComment(int commentType, Address originAddress)replaceCommentreplaces 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.originAddress- 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, MERGEdiscardTags- tags to keep out of the final resultkeepTags- tags to add to the final resultmonitor- 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
mergeLabelsmerges 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
replaceLabelsreplaces 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 replacedmonitor- 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
replaceFunctionNamesmerges 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
mergeFunctionsmerges 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
mergeFunctioncompletely 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)
mergeFunctionReturnreplaces 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:
entry2- the entry point address of the function. This address should be derived from the origin program.
-
mergeFunctionName
public void mergeFunctionName(Address entry2, TaskMonitor monitor)
mergeFunctionNamereplaces the name of the function in program1 with the name 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.
-
replaceFunctionSignatureSource
public void replaceFunctionSignatureSource(Address originEntryPoint, TaskMonitor monitor)
replaceFunctionSignatureSourcechanges 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)
mergeFunctionReturnAddressOffsetreplaces 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)
mergeFunctionLocalSizereplaces 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)
mergeFunctionStackPurgeSizereplaces 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)
replaceFunctionVarArgschanges 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)
replaceFunctionCallingConventionchanges 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)
replaceFunctionInlineFlagchanges 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)
replaceFunctionNoReturnFlagchanges 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)
replaceFunctionCustomStorageFlagchanges 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)
replaceFunctionParametersreplaces 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)
replaceFunctionParametersreplaces 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 functionfromFunc- 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
replaceFunctionParameterNamereplaces 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:
InvalidInputExceptionDuplicateNameException
-
replaceFunctionParameterDataType
public void replaceFunctionParameterDataType(Address originEntryPoint, int ordinal, TaskMonitor monitor)
replaceFunctionParameterDataTypereplaces 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)
replaceFunctionParameterCommentreplaces 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)
replaceFunctionVariablereplaces the name of the indicated function variable in program1 with that from the origin program.- Parameters:
originEntryPoint- 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.
-
replaceVariables
public void replaceVariables(Address originEntryPoint, java.util.List<Variable> varList, TaskMonitor monitor) throws CancelledException
replaceFunctionVariablesreplaces the function variables/parameters in program1 with that from the origin program.- Parameters:
originEntryPoint- the entry point address of the function to modify. This address should be derived from program1.varList- the list of variables to replace.monitor- the task monitor for notifying the user of progress.- Throws:
CancelledException- if the user canceled the operation via the task monitor.
-
replaceFunctionVariableName
public void replaceFunctionVariableName(Address originEntryPoint, Variable var, TaskMonitor monitor) throws DuplicateNameException, InvalidInputException
replaceFunctionVariableNamereplaces 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:
InvalidInputExceptionDuplicateNameException
-
replaceFunctionVariableDataType
public void replaceFunctionVariableDataType(Address originEntryPoint, Variable var, TaskMonitor monitor)
replaceFunctionVariableDataTypereplaces 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)
replaceFunctionVariableCommentreplaces 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
mergeBookmarkmerges 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
mergePropertiesmerges 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:
visitin interfacePropertyVisitor
-
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:
visitin interfacePropertyVisitor- 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:
visitin interfacePropertyVisitor- 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:
visitin interfacePropertyVisitor- 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:
visitin interfacePropertyVisitor- Parameters:
value- the value for the named property.
-
-