java.lang.Object
com.pnfsoftware.jeb.core.units.code.asm.decompiler.ast.simulator.CEnvironment

public class CEnvironment extends Object
Simulation environment. Serves as a proxy to access outside method world. In particular it provides:
  • concrete values for parameters, routine calls, global variables
  • access to the underlying native unit
The environment might be modified by a simulation, namely by writing into global variables or into memory. The stateful information should be cleared before an environment can be re-used for a simulation (see clearState()).
  • Constructor Details

  • Method Details

    • copy

      public static CEnvironment copy(CEnvironment copy)
    • getBaseTypeSize

      public int getBaseTypeSize(ICType type)
      Get base type size in bytes, i.e. the size of TYPE in 'TYPE *'
    • getTypeSize

      public int getTypeSize(ICType type)
      Get type size in bytes
    • setParameterValue

      public void setParameterValue(ICIdentifier param, long value)
    • setAutoGeneratedParameterValue

      public void setAutoGeneratedParameterValue(ICIdentifier param)
    • isParameterValueSet

      public boolean isParameterValueSet(ICIdentifier param)
    • getParameterValue

      public Long getParameterValue(ICIdentifier param)
    • getParameterValue

      public Long getParameterValue(ICIdentifier param, boolean autoGenerate)
    • setRoutineReturnValue

      public void setRoutineReturnValue(ICMethod calledRoutine, long retVal)
    • setAutoGeneratedRoutineReturnValue

      public void setAutoGeneratedRoutineReturnValue(ICMethod calledRoutine)
    • getRoutineReturnValue

      public Long getRoutineReturnValue(ICMethod calledRoutine, boolean autoGenerate)
    • getRoutineDefaultReturnValue

      public Long getRoutineDefaultReturnValue()
    • setGlobalVarValue

      public void setGlobalVarValue(ICIdentifier gvar, long value)
    • getGlobalVarValue

      public Long getGlobalVarValue(ICIdentifier gvar, boolean readInMemory)
    • writeMemory

      public void writeMemory(long address, long value)
    • readMemory

      public Long readMemory(long address, int bytesToRead)
    • setVarAddress

      public void setVarAddress(ICIdentifier var, long address)
    • getVarAddress

      public Long getVarAddress(ICIdentifier var)
    • getDefaultPointedSize

      public Integer getDefaultPointedSize()
      Gets the default size for memory reads through pointers, in bytes.
    • setDefaultPointedSize

      public void setDefaultPointedSize(Integer defaultPointedSize)
    • isAutoGenerateUndefinedIdentifierValue

      public boolean isAutoGenerateUndefinedIdentifierValue()
    • setAutoGenerateUndefinedIdentifierValue

      public void setAutoGenerateUndefinedIdentifierValue(boolean autoGenerateUndefinedIdentifierValue)
    • getPassedParameterValue

      public long getPassedParameterValue(ICIdentifier arg)
    • areEquivalent

      public static boolean areEquivalent(CEnvironment env1, CEnvironment env2)
    • clearState

      public void clearState()
      This method should be called before re-using the environment for another simulation.
    • toString

      public String toString()
      Overrides:
      toString in class Object