java.lang.Object | |
↳ | com.pnfsoftware.jeb.core.units.code.asm.decompiler.ir.emulator.EEmulator |
IR emulator, a controller for an IR state
.
How to use:
- pass an existing EState
to a constructor or use
createStandard(IEGlobalContext)
to create a state and an emulator
- use the settters
to customize the emulator.
- setup()
it
- run()
it
Three modes of execution:
1- IR routine emulation
2- IR routine-supported stub emulation
3- Global routine emulation (disregarding routines), a generalized variant of 2, suitable for
full program emulation
4- Global stub emulation
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | EEmulator.Metadata |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean | defaultAllowOpt | ||||||||||
long | defaultHeapBase | ||||||||||
int | defaultMaxIterCount | ||||||||||
boolean | defaultRecordMemoryWrites | ||||||||||
boolean | defaultResetUnknownRegisters | ||||||||||
long | defaultReturnAddr | ||||||||||
long | defaultStackBase |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
EEmulator(EState state) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | addArgument(byte[] val, INativeType t) | ||||||||||
void | addArgument(long val, INativeType t) | ||||||||||
void | addArgument(IEImm val) | ||||||||||
void | addHooks(IEEmulatorHooks hooks) | ||||||||||
void | clearArgument() | ||||||||||
boolean | commitMemoryChanges(boolean commitModifiedPagesOnly) | ||||||||||
static EEmulator |
createStandard(IEGlobalContext gctx, int maxIterationCount)
Create an emulator as well as a standard
emulation state that will be
controlled by the emulator. | ||||||||||
static EEmulator |
createStandard(IEGlobalContext gctx)
Create an emulator as well as a standard
emulation state that will be
controlled by the emulator. | ||||||||||
int | getAddressSize() | ||||||||||
IEGlobalContext | getGlobalContext() | ||||||||||
IEImm | getLastEvaluationResult() | ||||||||||
MemoryChanges |
getMemoryChanges()
A convenience method to retrieve memory changes performed during emulation.
| ||||||||||
MemoryWrites | getMemoryWrites() | ||||||||||
EEmulator.Metadata | getMetadata() | ||||||||||
long | getPCAddress() | ||||||||||
int | getRegisterSize() | ||||||||||
IEImm | getReturnValue() | ||||||||||
long | getSPAddress() | ||||||||||
int | getStackSlotSize() | ||||||||||
EState | getState() | ||||||||||
IVirtualMemory | getVirtualMemory() | ||||||||||
long | heapAlloc(int size) | ||||||||||
void | heapFree(long addr) | ||||||||||
long | heapRealloc(long addr, int newsize) | ||||||||||
boolean | isPrimaryEmulator() | ||||||||||
boolean |
processStoredReturnAddress(RoutineIOSlot slot)
ret-addr on stack: pop and return
ret-addr in register: TBI | ||||||||||
Long |
readPointer(long addr)
Convenience method.
| ||||||||||
IEImm | readStorage(RoutineIOSlot slot) | ||||||||||
void | removeHooks(IEEmulatorHooks hooks) | ||||||||||
static IPrototypeItem |
retrievePrototype(IDecompilerManager decomp, INativeMethodItem routine)
Convenience method used to verify whether or not an emulator object would be able to retrieve
a target method prototype.
| ||||||||||
void | run() | ||||||||||
void | setArguments(Collection<IEImm> vals) | ||||||||||
void | setGlobalRoutineEmulation(long routineAddress, IPrototypeItem routinePrototype) | ||||||||||
void | setGlobalRoutineEmulation(INativeMethodItem routine) | ||||||||||
void | setGlobalStubEmulation(long pcStart, Long pcStop) | ||||||||||
void | setLastEvaluationResult(IEImm val) | ||||||||||
void | setPCAddress(long nativeAddress) | ||||||||||
void | setPerformFreshDecompilations(boolean performFreshDecompilations) | ||||||||||
void |
setPreferredStackBase(long address)
Must be called before
setup() . | ||||||||||
void | setPreferredTargetPrototype(IPrototypeItem proto) | ||||||||||
void | setRecordMemoryWrites(boolean recordMemoryWrites) | ||||||||||
void |
setResetUnknownRegisters(boolean enabled)
Must be called before
setup() . | ||||||||||
void | setReturnAddress(long retAddr) | ||||||||||
boolean | setStack(long stackStart, int stackSize, Long sp0) | ||||||||||
void | setStubExecution(INativeMethodItem routine, long pcStart, long pcStop) | ||||||||||
void | setStubExecution(IERoutineContext ctx, int irStart, int irStop) | ||||||||||
void | setTargetRoutine(INativeMethodItem routine) | ||||||||||
void | setup() | ||||||||||
void |
teardown()
Clean-up temporary constructs built during
setup() . | ||||||||||
boolean | writePointer(long addr, long ptr) | ||||||||||
boolean | writeStorage(RoutineIOSlot slot, IEImm val) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Create an emulator as well as a standard emulation state
that will be
controlled by the emulator.
Create an emulator as well as a standard emulation state
that will be
controlled by the emulator. Set the standard maximum iteration count to
{@value #defaultMaxIterCount}.
A convenience method to retrieve memory changes performed during emulation.
UnsupportedOperationException | if the emulator's memory is not a shim |
---|
ret-addr on stack: pop and return
ret-addr in register: TBI
Convenience method.
Convenience method used to verify whether or not an emulator object would be able to retrieve a target method prototype.
decomp | decompiler unit |
---|---|
routine | candidate target routine |