public class

EmulatorState

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.units.code.asm.decompiler.ast.emulator.EmulatorState

Class Overview

State of the emulator (memory + registers)

Summary

Public Constructors
EmulatorState(INativeCodeUnit<?> nativeUnit)
Public Methods
void copyMemory(long src, long dst, int n)
Copy n bytes from source to destination
int getBaseTypeSize(ICType type)
Get base type size in bytes, i.e.
Integer getDefaultPointerSize()
Long getRegisterValue(int id)
Get register value
int getTypeSize(ICType type)
Get type size in bytes.
Long getVarAddress(ICIdentifier var)
Long getVarValue(ICElement element)
Long readMemory(long address, int bytesToRead)
Read memory with default endianness.
Long readMemorySafe(long address, int bytesToRead)
Read memory with default endianness.
void setDefaultPointerSize(Integer defaultPointedSize)
void setRegisterValue(int id, long value)
void setVarValue(ICElement element, long value)
void writeMemory(long address, long value, int bytesToWrite)
Write memory with default endianness.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public EmulatorState (INativeCodeUnit<?> nativeUnit)

Public Methods

public void copyMemory (long src, long dst, int n)

Copy n bytes from source to destination

Parameters
src source address
dst destination address
n number of bytes to copy

public int getBaseTypeSize (ICType type)

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

public Integer getDefaultPointerSize ()

public Long getRegisterValue (int id)

Get register value

Returns
  • register value, null if not set

public int getTypeSize (ICType type)

Get type size in bytes.

Returns
  • type size in bytes

public Long getVarAddress (ICIdentifier var)

public Long getVarValue (ICElement element)

public Long readMemory (long address, int bytesToRead)

Read memory with default endianness.

Parameters
bytesToRead number of bytes to read
Returns
  • read value, upper-casted as long

public Long readMemorySafe (long address, int bytesToRead)

Read memory with default endianness. Default value is returned when memory read failed.

Parameters
bytesToRead number of bytes to read
Returns
  • read value, upper-casted as long, if memory couldn't be read return 0

public void setDefaultPointerSize (Integer defaultPointedSize)

public void setRegisterValue (int id, long value)

public void setVarValue (ICElement element, long value)

public void writeMemory (long address, long value, int bytesToWrite)

Write memory with default endianness.