public class


extends Object
   ↳ com.pnfsoftware.jeb.core.units.code.asm.decompiler.ast.simulator.CEnvironment

Class Overview

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()).


Public Constructors
CEnvironment(INativeCodeUnit<?> nativeUnit)
Public Methods
static boolean areEquivalent(CEnvironment env1, CEnvironment env2)
void clearState()
This method should be called before re-using the environment for another simulation.
static CEnvironment copy(CEnvironment copy)
int getBaseTypeSize(ICType type)
Get base type size in bytes, i.e.
Integer getDefaultPointedSize()
Gets the default size for memory reads through pointers, in bytes.
Long getGlobalVarValue(ICIdentifier gvar, boolean readInMemory)
Long getParameterValue(ICIdentifier param, boolean autoGenerate)
Long getParameterValue(ICIdentifier param)
long getPassedParameterValue(ICIdentifier arg)
Long getRoutineDefaultReturnValue()
Long getRoutineReturnValue(ICMethod calledRoutine, boolean autoGenerate)
int getTypeSize(ICType type)
Get type size in bytes
Long getVarAddress(ICIdentifier var)
boolean isAutoGenerateUndefinedIdentifierValue()
boolean isParameterValueSet(ICIdentifier param)
Long readMemory(long address, int bytesToRead)
void setAutoGenerateUndefinedIdentifierValue(boolean autoGenerateUndefinedIdentifierValue)
void setAutoGeneratedParameterValue(ICIdentifier param)
void setAutoGeneratedRoutineReturnValue(ICMethod calledRoutine)
void setDefaultPointedSize(Integer defaultPointedSize)
void setGlobalVarValue(ICIdentifier gvar, long value)
void setParameterValue(ICIdentifier param, long value)
void setRoutineReturnValue(ICMethod calledRoutine, long retVal)
void setVarAddress(ICIdentifier var, long address)
String toString()
void writeMemory(long address, long value)
Inherited Methods
From class java.lang.Object

Public Constructors

public CEnvironment (INativeCodeUnit<?> nativeUnit)

Public Methods

public static boolean areEquivalent (CEnvironment env1, CEnvironment env2)

public void clearState ()

This method should be called before re-using the environment for another simulation.

public static CEnvironment copy (CEnvironment copy)

public int getBaseTypeSize (ICType type)

Get base type size in bytes, i.e. the size of TYPE in 'TYPE *'

public Integer getDefaultPointedSize ()

Gets the default size for memory reads through pointers, in bytes.

public Long getGlobalVarValue (ICIdentifier gvar, boolean readInMemory)

public Long getParameterValue (ICIdentifier param, boolean autoGenerate)

public Long getParameterValue (ICIdentifier param)

public long getPassedParameterValue (ICIdentifier arg)

public Long getRoutineDefaultReturnValue ()

public Long getRoutineReturnValue (ICMethod calledRoutine, boolean autoGenerate)

public int getTypeSize (ICType type)

Get type size in bytes

public Long getVarAddress (ICIdentifier var)

public boolean isAutoGenerateUndefinedIdentifierValue ()

public boolean isParameterValueSet (ICIdentifier param)

public Long readMemory (long address, int bytesToRead)

public void setAutoGenerateUndefinedIdentifierValue (boolean autoGenerateUndefinedIdentifierValue)

public void setAutoGeneratedParameterValue (ICIdentifier param)

public void setAutoGeneratedRoutineReturnValue (ICMethod calledRoutine)

public void setDefaultPointedSize (Integer defaultPointedSize)

public void setGlobalVarValue (ICIdentifier gvar, long value)

public void setParameterValue (ICIdentifier param, long value)

public void setRoutineReturnValue (ICMethod calledRoutine, long retVal)

public void setVarAddress (ICIdentifier var, long address)

public String toString ()

public void writeMemory (long address, long value)