Class SimpleDiffUtility

  • Direct Known Subclasses:
    DiffUtility

    public class SimpleDiffUtility
    extends java.lang.Object
    • Constructor Detail

      • SimpleDiffUtility

        public SimpleDiffUtility()
    • Method Detail

      • getCompatibleVariableStorage

        public static VariableStorage getCompatibleVariableStorage​(Program program,
                                                                   VariableStorage storage,
                                                                   Program otherProgram)
        Convert a variable storage object from the specified program to a comparable variable storage object in the specified otherProgram. Certain variable storage (UNIQUE/HASH-based) will always produce a null return object.
        Parameters:
        program - program which contains the specified address instance
        storage - variable storage in program
        otherProgram - other program
        Returns:
        storage for otherProgram or null if storage can not be mapped to other program
      • getCompatibleVarnode

        public static Varnode getCompatibleVarnode​(Program program,
                                                   Varnode varnode,
                                                   Program otherProgram)
        Convert a varnode from the specified program to a comparable varnode in the specified otherProgram. Certain varnode addresses spaces (UNIQUE, HASH) will always produce a null return varnode.
        Parameters:
        program - program which contains the specified address instance
        varnode - varnode in program
        otherProgram - other program
        Returns:
        varnode for otherProgram or null if varnode can not be mapped to other program
      • getStartOfDelaySlots

        public static Address getStartOfDelaySlots​(Instruction instr)
      • getEndOfDelaySlots

        public static Address getEndOfDelaySlots​(Instruction instr)
        If the specified instruction is contained within a delay slot, or has delay slots, the maximum address of the last delay slot instruction will be returned. If a normal instruction is specified the instructions maximum address is returned.
        Parameters:
        instr -
        Returns:
        maximum address of instruction or its last delay slot
      • expandAddressSetToIncludeFullDelaySlots

        public static AddressSetView expandAddressSetToIncludeFullDelaySlots​(Program program,
                                                                             AddressSetView originalSet)
        Expand a specified address set to include complete delay slotted instructions which may be included at the start or end of each range within the specified address set.
        Parameters:
        program - program
        originalSet - original address set
        Returns:
        expanded address set
      • getCompatibleAddress

        public static Address getCompatibleAddress​(Program program,
                                                   Address addr,
                                                   Program otherProgram)
        Convert an address from the specified program to a comparable address in the specified otherProgram.
        Parameters:
        program - program which contains the specified address instance
        addr - address in program
        otherProgram - other program
        Returns:
        address for otherProgram or null if no such address exists.
      • translateMemoryAddress

        protected static Address translateMemoryAddress​(Address addr,
                                                        Program otherProgram,
                                                        boolean exactMatchOnly)
        Convert an address from the specified program to a comparable address in the specified otherProgram.
        Parameters:
        addr - address in program
        otherProgram - other program
        exactMatchOnly - if false and addr is an overlay address, a closest match will be returned if possible
        Returns:
        address for otherProgram or null if no such address exists.
      • getSymbol

        public static Symbol getSymbol​(Symbol symbol,
                                       Program otherProgram)
        Given a symbol for a specified program, get the corresponding symbol from the specified otherProgram.
        Parameters:
        symbol - symbol to look for
        otherProgram - other program
        Returns:
        corresponding symbol for otherProgram or null if no such symbol exists.
      • getMatchingExternalSymbol

        public static Symbol getMatchingExternalSymbol​(Program program,
                                                       Symbol symbol,
                                                       Program otherProgram,
                                                       java.util.Set<java.lang.Long> otherRestrictedSymbolIds)
        Given an external symbol for a specified program, get the corresponding symbol, which has the same name and path, from the specified otherProgram.
        Note: The type of the returned symbol may be different than the type of the symbol
        Parameters:
        program - program which contains the specified symbol instance
        symbol - symbol to look for
        otherProgram - other program
        otherRestrictedSymbolIds - an optional set of symbol ID's from the other program which will be treated as the exclusive set of candidate symbols to consider.
        Returns:
        corresponding external symbol for otherProgram or null if no such symbol exists.
      • getMatchingExternalLocation

        public static ExternalLocation getMatchingExternalLocation​(Program program,
                                                                   ExternalLocation externalLocation,
                                                                   Program otherProgram)
        Given an external location for a specified program, get the corresponding external location, which has the same name and path, from the specified otherProgram.
        Note: The type of the returned external location may be different than the type of the original external location.
        Parameters:
        program - program which contains the specified external location instance
        externalLocation - external location to look for
        otherProgram - other program
        Returns:
        corresponding external location for otherProgram or null if no such external location exists.
      • getVariableSymbol

        public static Symbol getVariableSymbol​(Symbol symbol,
                                               Program otherProgram)
        Find the variable symbol in otherProgram which corresponds to the specified varSym.
        Parameters:
        symbol - variable symbol
        otherProgram - other program
        Returns:
        the variable symbol or null
      • getVariableSymbol

        protected static Symbol getVariableSymbol​(Symbol varSym,
                                                  Function otherFunction)
        Find the variable symbol in otherFunction which corresponds to the specified varSym.
        Parameters:
        varSym - variable symbol
        otherFunction - other function
        Returns:
        the variable symbol or null
      • getOverlappingVariable

        protected static Variable getOverlappingVariable​(SymbolTable otherSymTable,
                                                         Variable var,
                                                         VariableStorage otherStorage,
                                                         Symbol otherFunctionSymbol)
        Find overlapping variable which meets the following conditions 1. First use offset matches 2. Ordinal matches (for parameters only) 3. Minimum or maximum address matches
        Parameters:
        otherSymTable - other symbol table
        var - variable
        otherStorage - other variable storage
        otherFunctionSymbol - other function symbol
        Returns:
        the overlapping variable or null