Interface IEGlobalContext


@Ser public interface IEGlobalContext
Global IR context. A native decompiler instance holds a single global IR context. The global context is also a factory for non-local IR objects, such as IR constants or IR operations.
  • Method Details

    • getNativeMemory

      IVirtualMemory getNativeMemory()
      Convenience method.
      Returns:
    • getWildcardTypeManager

      IWildcardTypeManager getWildcardTypeManager()
    • getCandidatePrototype

      IWildcardPrototype getCandidatePrototype(INativeMethodItem routine)
    • setCandidatePrototype

      boolean setCandidatePrototype(INativeMethodItem routine, IWildcardPrototype proto, int guarantee)
      Parameters:
      routine -
      proto -
      guarantee - use 0 for an unknown guarantee
      Returns:
    • createRoutineContext

      IERoutineContext createRoutineContext()
      Create a new routine-less routine context. The newly created routine context is not attached to this global context. Use addRoutineContext(IERoutineContext) to add it to the global context.
      Returns:
    • createRoutineContext

      IERoutineContext createRoutineContext(INativeMethodItem routine)
      Create a new routine context. The newly created routine context is not attached to this global context. Use addRoutineContext(IERoutineContext) to add it to the global context.
      Parameters:
      routine -
      Returns:
    • getRoutineContexts

      List<IERoutineContext> getRoutineContexts()
      Retrieve a list of all converted routines.
      Returns:
    • getRoutineContext

      IERoutineContext getRoutineContext(int index)
    • addRoutineContext

      void addRoutineContext(IERoutineContext ctx)
      Register a routine context with this global context.
      Parameters:
      ctx -
    • removeRoutineContext

      boolean removeRoutineContext(IERoutineContext ctx, boolean stopTrackingNativeDeps)
      Delete a converted routine.
      Parameters:
      ctx -
      stopTrackingNativeDeps -
      Returns:
    • getRegisterBitsize

      int getRegisterBitsize()
    • getAddressBitsize

      int getAddressBitsize()
    • isBigEndian

      boolean isBigEndian()
    • getConverter

      AbstractConverter<?> getConverter()
    • getNativeContext

      INativeContext getNativeContext()
    • getObjectTracker

      INativeObjectTracker getObjectTracker()
    • createBranchDetails

      IEBranchDetails createBranchDetails(List<IEVar> def, List<IEVar> use, List<IEVar> spoiled, int fallbackStackPointerDelta)
      Create basic branch details information.
      Parameters:
      def -
      use -
      spoiled -
      fallbackStackPointerDelta - the provided SP delta will have unknown guarantee and unknown origin
      Returns:
    • createBranchDetails

      IEBranchDetails createBranchDetails(List<IEVar> def, List<IEVar> use, List<IEVar> spoiled, int fallbackStackPointerDelta, IPrototypeItem nativePrototypeHint, List<IBranchTarget> dynamicTargetCandidates)
      Create basic branch details information.
      Parameters:
      def -
      use -
      spoiled -
      fallbackStackPointerDelta -
      nativePrototypeHint -
      dynamicTargetCandidates -
      Returns:
    • createCompose

      IECompose createCompose(IEGeneric... elts)
      Create a composition of IR elements.
      Parameters:
      elts - at least two elements, from lowest-significant to highest-significant
      Returns:
    • createCompose

      IECompose createCompose(Collection<IEGeneric> elts)
    • createCond

      IECond createCond(IEGeneric p, IEGeneric a, IEGeneric b)
    • createGroupElt

      IEGroupElt createGroupElt(IEGroup collection, IEGeneric index)
    • createImm

      IEImm createImm(long v, int bitsize)
    • createImm

      IEImm createImm(byte[] v, int bitsize)
    • createImm

      IEImm createImm(BigInteger v, int bitsize)
    • createImm

      IEImm createImm(String v, int bitsize)
    • createImm

      IEImm createImm(float v)
    • createImm

      IEImm createImm(double v)
    • createMem

      IEMem createMem(IEGeneric opaddr, int bitsize)
    • createMem

      IEMem createMem(IEGeneric segment, IEGeneric opaddr, int bitsize)
    • createOperation

      IEOperation createOperation(OperationType optype, IEGeneric op1)
    • createOperation

      IEOperation createOperation(OperationType optype, IEGeneric op1, IEGeneric op2)
    • createOperation

      IEOperation createOperation(FunctionOptype functionOptype, IEGeneric... opnds)
    • createFunctionType

      FunctionOptype createFunctionType(String name, int flags, int minOpndCount, int maxOpndCount, int resultBitsize)
      Create a new function operation type.
      Parameters:
      name - function name (cannot be blank)
      flags - function flags, see FLAG_xxx in FunctionOptype for a list of legal flags
      minOpndCount - 0+
      maxOpndCount - 0+
      resultBitsize - leave to 0 to signify that the resulting bitsize must be the same as the first operand's (in which case minOpndCount must be at least 1), else a valid positive bitsize must be specified
      Returns:
      the function (never null; this method throws on error)
    • getFunctionType

      FunctionOptype getFunctionType(String name)
      Retrieve a function operation type by name.
      Parameters:
      name - function name
      Returns:
      the function, null if it does not exist (was not previously created)
    • createResizeOperation

      IEOperation createResizeOperation(IEGeneric opnd, int bitsize, boolean signed)
      Create a resize operation operation: truncation, zero-extension, or sign-extension.
      Parameters:
      opnd - the source to be extended (dstSize > srcSize) or truncated (dstSize < srcSize)
      bitsize - the destination size; should be different than the source's
      signed - for extensions, else N/A
      Returns:
      the operation IRE
    • createConversionOperation

      IEOperation createConversionOperation(OperationType convOperator, IEGeneric src, int dstSize)
      Create a conversion operation: an integer truncation, integer extension (zero or signed), float truncation or extension, float-to-int and int-to-float conversion.
      Parameters:
      convOperator - one of for which OperationType.isConversion() returns true (eg, OperationType.CAST, OperationType.CAST_S, OperationType.FP2FP, OperationType.FP2INT, OperationType.INT2FP)
      src - operand to be extended, truncated, or converted
      dstSize - resulting bitsize
      Returns:
      the operation IRE
    • createRange

      IERange createRange(int begin, int end)
    • createSlice

      IESlice createSlice(IEGeneric e, int bitstart, int bitend)
    • createSlice

      IESlice createSlice(IEGeneric e, IERange range)
    • createRegister

      IEVar createRegister(int id, String name, int bitsize)
      Create a physical register with a manually assigned id (use with care). Shared across routines boundaries. No address, no type.
      Parameters:
      id -
      name -
      bitsize -
      Returns:
    • createRegister

      IEVar createRegister(String name, int bitsize)
      Create a physical register. Shared across routines boundaries. No address, no type.
      Parameters:
      name -
      bitsize -
      Returns:
    • createVirtualRegister

      IEVar createVirtualRegister(int id, String name, int bitsize)
      Create a virtual register with a manually assigned id (use with care). Preserved/not shared across routines boundaries. No address, no type.
      Parameters:
      id -
      name -
      bitsize -
      Returns:
    • createVirtualRegister

      IEVar createVirtualRegister(String name, int bitsize)
      Create a virtual register. Preserved/not shared across routines boundaries. No address, no type.
      Parameters:
      name -
      bitsize -
      Returns:
    • createGlobalReference

      IEVar createGlobalReference(String name, Long address)
      Create or retrieve a variable referencing a global element. Reference variables cannot be assigned to. The reference is not tracked.
      Parameters:
      name - optional name
      address - optional address referenced (e.g. if the reference is a concrete data element); if the name is null, an address must be specified
      Returns:
      a reference variable
    • getGlobalVariable

      IEVar getGlobalVariable(long address)
    • createGlobalVariable

      IEVar createGlobalVariable(long address, int bitsize)
      Create a global, memory-mapped variable.
      Parameters:
      address -
      bitsize -
      Returns:
    • getGlobalVariables

      Collection<IEVar> getGlobalVariables()
      Retrieve the list of globals (memory) variables defined in this context.
      Returns:
    • createSymbolForRoutine

      IEVar createSymbolForRoutine(INativeMethodItem routine, IERoutineContext userctx)
    • retrieveRoutineFromSymbol

      INativeMethodItem retrieveRoutineFromSymbol(IEVar var)
    • createSymbolForData

      IEVar createSymbolForData(INativeDataItem data, IERoutineContext userctx)
    • retrieveDataFromSymbol

      INativeDataItem retrieveDataFromSymbol(IEVar var)
    • getVariableByName

      IEVar getVariableByName(String name)
      Retrieve a global-scope variable by name.
      Parameters:
      name -
      Returns:
      the variable or null
    • getVarSafe

      IEVar getVarSafe(int id)
    • getVar

      IEVar getVar(int id)
      Retrieve a global context IEVar by id. Throws if does not exist.
      Parameters:
      id -
      Returns:
    • canCreateVariable

      boolean canCreateVariable(int id, int bitsize)
    • getVariables

      Collection<IEVar> getVariables(int idStart, int idEnd)
    • getAllVariables

      Collection<IEVar> getAllVariables()
    • getAllRegisters

      Collection<IEVar> getAllRegisters()
    • getAllRegisters

      Collection<IEVar> getAllRegisters(Set<Integer> exclusions)
    • buildState

      EState buildState(boolean initRegisters, boolean initSymbols, boolean initGlobals)
      Create a machine state for IR emulation.
      Parameters:
      initRegisters - initialize all global IEVar-registers to 0
      initSymbols - initialize all global symbols IEVars to 0
      initGlobals - initialize all global memory IEVars to 0
      Returns:
      a fresh state
    • buildState

      default EState buildState()
      Create a machine state for IR emulation with all defined registers, symbols, and globals reset to 0.

      Same as buildState(true, true, true)

      Returns:
      a fresh state
    • buildEmptyState

      default EState buildEmptyState()
      Create a machine state for IR emulation.

      Same as buildState(false, false, false)

      Returns:
      a fresh state
    • setData

      void setData(Object key, Object value)
      Store a piece of transient data.
      Parameters:
      key -
      value -
    • getData

      Object getData(Object key)
      Retrieve a piece of transient data.
      Parameters:
      key -
      Returns: