Package ghidra.pcode.emulate
Class Emulate
java.lang.Object
ghidra.pcode.emulate.Emulate
- Direct Known Subclasses:
ModifiedPcodeThread.GlueEmulate
Deprecated, for removal: This API element is subject to removal in a future version.
A SLEIGH based implementation of the Emulate interface
This implementation uses a Translate object to translate machine instructions into pcode and caches pcode ops for later use by the emulator. The pcode is cached as soon as the execution address is set, either explicitly, or via branches and fallthrus. There are additional methods for inspecting the pcode ops in the current instruction as a sequence.
-
Constructor Summary
ConstructorsConstructorDescriptionEmulate(SleighLanguage lang, MemoryState s, BreakTable b) Deprecated, for removal: This API element is subject to removal in a future version.Creates a newEmulateobject -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Deprecated, for removal: This API element is subject to removal in a future version.voidDeprecated, for removal: This API element is subject to removal in a future version.Since the full instruction is cached, we can do relative branches properlyvoidDeprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode branch indirect operation on the memory statevoidDeprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode call operation on the memory statevoidDeprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode call indirect operation on the memory statevoidDeprecated, for removal: This API element is subject to removal in a future version.Give instuctionStateModifier first shot at executing custom pcodeop, if not supported look for a breakpoint for the given user-defined op and invoke it.voidDeprecated, for removal: This API element is subject to removal in a future version.voidDeprecated, for removal: This API element is subject to removal in a future version.This kind of pcode op should not come up in ordinary emulation, so this routine throws an exception.voidexecuteInstruction(boolean stopAtBreakpoint, TaskMonitor monitor) Deprecated, for removal: This API element is subject to removal in a future version.This routine executes an entire machine instruction at once, as a conventional debugger step function would do.voidDeprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode load operation on the memory statevoidDeprecated, for removal: This API element is subject to removal in a future version.This kind of pcode op should not come up in ordinary emulation, so this routine throws an exception.voidDeprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode store operation on the memory statevoidDeprecated, for removal: This API element is subject to removal in a future version.Update the iterator into the current pcode cache, and if necessary, generate the pcode for the fallthru instruction and reset the iterator.Deprecated, for removal: This API element is subject to removal in a future version.Returns the current context register value.Deprecated, for removal: This API element is subject to removal in a future version.Returns the currently executing machine address.Deprecated, for removal: This API element is subject to removal in a future version.Returns the current emulator execution state.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Returns the last address.Deprecated, for removal: This API element is subject to removal in a future version.Returns the memory state object which this emulator uses.Deprecated, for removal: This API element is subject to removal in a future version.booleanDeprecated, for removal: This API element is subject to removal in a future version.Since the emulator can single step through individual pcode operations, the machine state may be halted in the middle of a single machine instruction, unlike conventional debuggers.voidsetContextRegisterValue(RegisterValue regValue) Deprecated, for removal: This API element is subject to removal in a future version.Sets the context register value at the current execute address.voidsetExecuteAddress(Address addr) Deprecated, for removal: This API element is subject to removal in a future version.Set the current execution address and cache the pcode translation of the machine instruction at that address
-
Constructor Details
-
Emulate
Deprecated, for removal: This API element is subject to removal in a future version.Creates a newEmulateobject- Parameters:
lang- is the SLEIGH languages- is the MemoryState the emulator should manipulateb- is the table of breakpoints the emulator should invoke
-
-
Method Details
-
dispose
public void dispose()Deprecated, for removal: This API element is subject to removal in a future version. -
getLanguage
Deprecated, for removal: This API element is subject to removal in a future version. -
isInstructionStart
public boolean isInstructionStart()Deprecated, for removal: This API element is subject to removal in a future version.Since the emulator can single step through individual pcode operations, the machine state may be halted in the middle of a single machine instruction, unlike conventional debuggers. This routine can be used to determine if execution is actually at the beginning of a machine instruction.- Returns:
- true if the next pcode operation is at the start of the instruction translation
-
getExecutionState
Deprecated, for removal: This API element is subject to removal in a future version.Returns the current emulator execution state.- Returns:
- the current emulator execution state
-
getExecuteAddress
Deprecated, for removal: This API element is subject to removal in a future version.Returns the currently executing machine address.- Returns:
- the currently executing machine address
-
getLastExecuteAddress
Deprecated, for removal: This API element is subject to removal in a future version.Returns the last address.- Returns:
- the last address
-
getNewDisassemblerContext
Deprecated, for removal: This API element is subject to removal in a future version. -
getContextRegisterValue
Deprecated, for removal: This API element is subject to removal in a future version.Returns the current context register value. The context value returned reflects its state when the previously executed instruction was parsed/executed. The context value returned will feed into the next instruction to be parsed with its non-flowing bits cleared and any future context state merged in. If no instruction has been executed, the explicitly set context will be returned. A null value is returned if no context register is defined by the language or initial context has not been set. -
setContextRegisterValue
Deprecated, for removal: This API element is subject to removal in a future version.Sets the context register value at the current execute address. The Emulator should not be running when this method is invoked. Only flowing context bits should be set, as non-flowing bits will be cleared prior to parsing on instruction. In addition, any future context state set by the pcode emitter will take precedence over context set using this method. This method is primarily intended to be used to establish the initial context state.- Parameters:
regValue-
-
fallthruOp
public void fallthruOp()Deprecated, for removal: This API element is subject to removal in a future version.Update the iterator into the current pcode cache, and if necessary, generate the pcode for the fallthru instruction and reset the iterator. -
executeConditionalBranch
Deprecated, for removal: This API element is subject to removal in a future version. -
executeBranch
Deprecated, for removal: This API element is subject to removal in a future version.Since the full instruction is cached, we can do relative branches properly- Parameters:
op- is the particular branch op being executed
-
executeCallother
Deprecated, for removal: This API element is subject to removal in a future version.Give instuctionStateModifier first shot at executing custom pcodeop, if not supported look for a breakpoint for the given user-defined op and invoke it. If it doesn't exist, or doesn't replace the action, throw an exception- Parameters:
op- is the particular user-defined op being executed- Throws:
UnimplementedCallOtherException
-
setExecuteAddress
Deprecated, for removal: This API element is subject to removal in a future version.Set the current execution address and cache the pcode translation of the machine instruction at that address- Parameters:
addr- is the address where execution should continue
-
executeInstruction
public void executeInstruction(boolean stopAtBreakpoint, TaskMonitor monitor) throws CancelledException, LowlevelError, InstructionDecodeException Deprecated, for removal: This API element is subject to removal in a future version.This routine executes an entire machine instruction at once, as a conventional debugger step function would do. If execution is at the start of an instruction, the breakpoints are checked and invoked as needed for the current address. If this routine is invoked while execution is in the middle of a machine instruction, execution is continued until the current instruction completes.- Parameters:
stopAtBreakpoint-monitor-- Throws:
CancelledExceptionLowlevelErrorInstructionDecodeException
-
getMemoryState
Deprecated, for removal: This API element is subject to removal in a future version.Returns the memory state object which this emulator uses.- Returns:
- the memory state object which this emulator uses
-
executeLoad
Deprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode load operation on the memory state- Parameters:
op- is the particular load op being executed
-
executeStore
Deprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode store operation on the memory state- Parameters:
op- is the particular store op being executed
-
executeBranchind
Deprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode branch indirect operation on the memory state- Parameters:
op- is the particular branchind op being executed
-
executeCall
Deprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode call operation on the memory state- Parameters:
op- is the particular call op being executed
-
executeCallind
Deprecated, for removal: This API element is subject to removal in a future version.This routine performs a standard pcode call indirect operation on the memory state- Parameters:
op- is the particular callind op being executed
-
executeMultiequal
Deprecated, for removal: This API element is subject to removal in a future version.This kind of pcode op should not come up in ordinary emulation, so this routine throws an exception.- Parameters:
op- is the particular multiequal op being executed
-
executeIndirect
Deprecated, for removal: This API element is subject to removal in a future version.This kind of pcode op should not come up in ordinary emulation, so this routine throws an exception.- Parameters:
op- is the particular indirect op being executed
-