Class DExecutionParameters

java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.ir.DExecutionParameters

public class DExecutionParameters extends Object
dexdec IR emulation parameters object. Such objects are used with a State's execute() method.

This object is used to specify a list of IR instructions, execute them or a region of that list, with restrictions.

  • Field Details

    • pc

      public Integer pc
      Starting IR program counter.
    • pcExpectedTermination

      public Integer pcExpectedTermination
      Optional. The emulation will stopped, and the last execution return result, if the PC gets to reach this value. (The IR instruction at pcExpectedTermination is not executed!)
    • pcThresholdMin

      public Integer pcThresholdMin
      Optional. The emulation will stop if the PC gets less than this value.
    • pcThresholdMax

      public Integer pcThresholdMax
      Optional. The emulation will stop if the PC gets greater or equal than this value.
    • iterationCountLeft

      public Integer iterationCountLeft
      The count of iterations left. This counter is separate than IDState.getIterationCountLeft()! Every time an IR instruction is emulated, this counter is decreased. An exception is raised if it reaches 0. (An exception would also be raised if the IDState's counter reaches 0.)
  • Constructor Details

    • DExecutionParameters

      public DExecutionParameters(SortedMap<Integer,IDInstruction> insnmap)
      Create an object.
      Parameters:
      insnmap - mandatory instruction map: key=IR offset, value= IR instruction
    • DExecutionParameters

      public DExecutionParameters(SortedMap<Integer,IDInstruction> insnmap, Map<Integer,Integer> dalvik2irmap, Map<Integer,Integer> ir2dalvikmap)
      Create an object.
      Parameters:
      insnmap - mandatory instruction map: key=IR offset, value= IR instruction
      dalvik2irmap - optional map of dalvik offset mapping to a matching IR instruction offset
      ir2dalvikmap - optional map
    • DExecutionParameters

      public DExecutionParameters(CFG<IDInstruction> cfg)
      Create an object, ready to emulate an entire IR routine.
      Parameters:
      cfg - mandatory
    • DExecutionParameters

      public DExecutionParameters(IDMethodContext ctx)
      Create an object, ready to emulate an entire IR routine.
      Parameters:
      ctx - method context
    • DExecutionParameters

      public DExecutionParameters(CFG<IDInstruction> cfg, IDTryData exdata)
      Create an object, ready to emulate an entire IR routine.
      Parameters:
      cfg - CFG to emulate
      exdata - optional exception data
  • Method Details

    • getInstructionMap

      public Map<Integer,IDInstruction> getInstructionMap()
      Get the IR instruction map.
      Returns:
      instruction map keyed by IR offset
    • getDalvikToIRMap

      public Map<Integer,Integer> getDalvikToIRMap()
      Get the Dalvik-to-IR offset map.
      Returns:
      Dalvik-to-IR offset map, or null
    • getIRToDalvikMap

      public Map<Integer,Integer> getIRToDalvikMap()
      Get the IR-to-Dalvik offset map.
      Returns:
      IR-to-Dalvik offset map, or null
    • getCFG

      public CFG<IDInstruction> getCFG()
      Get the CFG being emulated.
      Returns:
      CFG, or null
    • getExceptionData

      public IDTryData getExceptionData()
      Get the exception data used during emulation.
      Returns:
      exception data, or null
    • getInitialValues

      public Map<Integer,IDImm> getInitialValues()
      Get the initial variable values.
      Returns:
      read-only map of variable ids to initial values
    • addInitialValue

      public void addInitialValue(int varid, IDImm value)
      Add an initial variable value.
      Parameters:
      varid - variable id
      value - initial value
    • prepareIterations

      public void prepareIterations(Integer itercnt)
      Reset all parameters to null, except for the instruction map (and associated optional maps like dalvik-to-ir, ir-to-dalvik maps).
      Parameters:
      itercnt - new iteration count limit