Package ghidra.app.emulator
Class Emulator
- java.lang.Object
-
- ghidra.app.emulator.Emulator
-
public class Emulator extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Emulator(EmulatorConfiguration cfg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMemoryAccessFilter(MemoryAccessFilter filter)
void
addProvider(MemoryLoadImage provider, AddressSetView view)
Add memory load image providerMemoryState
cloneMemory()
java.util.List<java.lang.String>
disassemble(java.lang.Integer count)
Disassemble from the current execute addressvoid
dispose()
void
executeInstruction(boolean stopAtBreakpoint, TaskMonitor monitor)
Address
genAddress(java.lang.String addr)
BreakTableCallBack
getBreakTable()
RegisterValue
getContextRegisterValue()
Returns the current context register value.java.util.Set<java.lang.String>
getDefaultContext()
EmulateExecutionState
getEmulateExecutionState()
Address
getExecuteAddress()
ghidra.app.emulator.FilteredMemoryState
getFilteredMemState()
boolean
getHalt()
SleighLanguage
getLanguage()
Address
getLastExecuteAddress()
FilteredMemoryPageOverlay
getMemoryBank(AddressSpace space, int ps)
MemoryState
getMemState()
long
getPC()
java.lang.String
getPCRegisterName()
int
getTickCount()
boolean
isAtBreakpoint()
boolean
isExecuting()
void
setContextRegisterValue(RegisterValue regValue)
Sets the context register value at the current execute address.void
setExecuteAddress(long addressableWordOffset)
void
setHalt(boolean halt)
-
-
-
Constructor Detail
-
Emulator
public Emulator(EmulatorConfiguration cfg)
-
-
Method Detail
-
cloneMemory
public MemoryState cloneMemory()
-
getMemoryBank
public FilteredMemoryPageOverlay getMemoryBank(AddressSpace space, int ps)
-
dispose
public void dispose()
-
genAddress
public Address genAddress(java.lang.String addr)
-
getPC
public long getPC()
-
getPCRegisterName
public java.lang.String getPCRegisterName()
-
getMemState
public MemoryState getMemState()
-
getFilteredMemState
public ghidra.app.emulator.FilteredMemoryState getFilteredMemState()
-
addMemoryAccessFilter
public void addMemoryAccessFilter(MemoryAccessFilter filter)
-
getBreakTable
public BreakTableCallBack getBreakTable()
-
setExecuteAddress
public void setExecuteAddress(long addressableWordOffset)
-
getExecuteAddress
public Address getExecuteAddress()
-
getLastExecuteAddress
public Address getLastExecuteAddress()
-
getDefaultContext
public java.util.Set<java.lang.String> getDefaultContext()
-
setHalt
public void setHalt(boolean halt)
-
getHalt
public boolean getHalt()
-
executeInstruction
public void executeInstruction(boolean stopAtBreakpoint, TaskMonitor monitor) throws CancelledException, LowlevelError, InstructionDecodeException
-
isAtBreakpoint
public boolean isAtBreakpoint()
- Returns:
- true if halted at a breakpoint
-
getEmulateExecutionState
public EmulateExecutionState getEmulateExecutionState()
- Returns:
- emulator execution state. This can be useful within a memory fault handler to determine if a memory read was associated with instruction parsing (i.e., PCODE_EMIT) or normal an actual emulated read (i.e., EXECUTE).
-
isExecuting
public boolean isExecuting()
- Returns:
- true if emulator is busy executing an instruction
-
getLanguage
public SleighLanguage getLanguage()
-
disassemble
public java.util.List<java.lang.String> disassemble(java.lang.Integer count)
Disassemble from the current execute address- Parameters:
count
- number of contiguous instructions to disassemble- Returns:
- list of instructions
-
getTickCount
public int getTickCount()
-
getContextRegisterValue
public RegisterValue getContextRegisterValue()
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.- Returns:
- context as a RegisterValue object
-
setContextRegisterValue
public void setContextRegisterValue(RegisterValue regValue)
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
- is the value to set context to
-
addProvider
public void addProvider(MemoryLoadImage provider, AddressSetView view)
Add memory load image provider- Parameters:
provider
- memory load image providerview
- memory region which corresponds to provider
-
-