Class Emulator

java.lang.Object
ghidra.app.emulator.Emulator

public class Emulator extends Object
  • Constructor Details

  • Method Details

    • cloneMemory

      public MemoryState cloneMemory()
    • getMemoryBank

      public FilteredMemoryPageOverlay getMemoryBank(AddressSpace space, int ps)
    • dispose

      public void dispose()
    • genAddress

      public Address genAddress(String addr)
    • getPC

      public long getPC()
    • getPCRegisterName

      public 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 Set<String> getDefaultContext()
    • setHalt

      public void setHalt(boolean halt)
    • getHalt

      public boolean getHalt()
    • executeInstruction

      public void executeInstruction(boolean stopAtBreakpoint, TaskMonitor monitor) throws CancelledException, LowlevelError, InstructionDecodeException
      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 List<String> disassemble(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 provider
      view - memory region which corresponds to provider