Class AdaptedEmulator

java.lang.Object
ghidra.app.emulator.AdaptedEmulator
All Implemented Interfaces:
Emulator

@Deprecated(since="12.1", forRemoval=true) public class AdaptedEmulator extends Object implements Emulator
Deprecated, for removal: This API element is subject to removal in a future version.
An implementation of Emulator that wraps the newer PcodeEmulator

This is a transitional utility only. It is currently used only by the pcode tests until that is ported to use the new PcodeEmulator directly. New use cases based on p-code emulation should use the PcodeEmulator directly. Older use cases still being actively maintained should begin work porting to PcodeEmulator. Old use cases without active maintenance may try this wrapper, but they will no longer compile once this adaptor is removed. At a minimum, to update such old use cases, new Emulator(...) must be replaced by new DefaultEmulator(...).

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Add a filter on memory access
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Clean up resources used by the emulator
    void
    executeInstruction(boolean stopAtBreakpoint, TaskMonitor monitor)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Execute instruction at current address
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get the breakpoint table
    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.
    Get the low-level execution state
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get current execution address (or the address of the next instruction to be executed)
    ghidra.app.emulator.FilteredMemoryState
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get the memory state, modified by all installed access filters
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Check if the emulator has been halted
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get the address of the last instruction executed (or the instructed currently being executed)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get the memory state
    long
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get the value of the program counter
    Deprecated, for removal: This API element is subject to removal in a future version.
    Get the name of the program counter register
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    protected ghidra.app.emulator.AdaptedEmulator.AdaptedPcodeEmulator
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Sets the context register value at the current execute address.
    void
    setExecuteAddress(long addressableWordOffset)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Set the value of the program counter
    void
    setHalt(boolean halt)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Halt or un-halt the emulator

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AdaptedEmulator

      public AdaptedEmulator(EmulatorConfiguration config)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • newPcodeEmulator

      protected ghidra.app.emulator.AdaptedEmulator.AdaptedPcodeEmulator newPcodeEmulator(EmulatorConfiguration config)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • initializeRegisters

      protected void initializeRegisters(EmulatorConfiguration config)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getPCRegisterName

      public String getPCRegisterName()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Get the name of the program counter register
      Specified by:
      getPCRegisterName in interface Emulator
      Returns:
      the name
    • setExecuteAddress

      public void setExecuteAddress(long addressableWordOffset)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Set the value of the program counter
      Specified by:
      setExecuteAddress in interface Emulator
      Parameters:
      addressableWordOffset - the word offset of the instruction to execute next.
    • getExecuteAddress

      public Address getExecuteAddress()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Get current execution address (or the address of the next instruction to be executed)
      Specified by:
      getExecuteAddress in interface Emulator
      Returns:
      current execution address
    • getLastExecuteAddress

      public Address getLastExecuteAddress()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Get the address of the last instruction executed (or the instructed currently being executed)
      Specified by:
      getLastExecuteAddress in interface Emulator
      Returns:
      the address
    • getPC

      public long getPC()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Get the value of the program counter
      Specified by:
      getPC in interface Emulator
      Returns:
      the value, i.e., offset in code space
    • 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.
      Description copied from interface: Emulator
      Execute instruction at current address
      Specified by:
      executeInstruction in interface Emulator
      Parameters:
      stopAtBreakpoint - if true and breakpoint hits at current execution address execution will halt without executing instruction.
      Throws:
      CancelledException - if execution was cancelled
      LowlevelError
      InstructionDecodeException
    • isExecuting

      public boolean isExecuting()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      isExecuting in interface Emulator
      Returns:
      true if emulator is busy executing an instruction
    • getEmulateExecutionState

      public EmulateExecutionState getEmulateExecutionState()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Get the low-level execution state

      This can be useful within a memory fault handler to determine if a memory read was associated with instruction parsing (i.e., EmulateExecutionState.INSTRUCTION_DECODE) or an actual emulated read (i.e., EmulateExecutionState.EXECUTE).

      Specified by:
      getEmulateExecutionState in interface Emulator
      Returns:
      emulator execution state.
    • getMemState

      public MemoryState getMemState()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Get the memory state
      Specified by:
      getMemState in interface Emulator
      Returns:
      the state
    • addMemoryAccessFilter

      public void addMemoryAccessFilter(MemoryAccessFilter filter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Add a filter on memory access
      Specified by:
      addMemoryAccessFilter in interface Emulator
      Parameters:
      filter - the filter
    • getFilteredMemState

      public ghidra.app.emulator.FilteredMemoryState getFilteredMemState()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Get the memory state, modified by all installed access filters
      Specified by:
      getFilteredMemState in interface Emulator
      Returns:
      the state
    • setContextRegisterValue

      public void setContextRegisterValue(RegisterValue regValue)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      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.

      Specified by:
      setContextRegisterValue in interface Emulator
      Parameters:
      regValue - is the value to set context to
    • getContextRegisterValue

      public RegisterValue getContextRegisterValue()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      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.

      Specified by:
      getContextRegisterValue in interface Emulator
      Returns:
      context as a RegisterValue object
    • getBreakTable

      public BreakTableCallBack getBreakTable()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Get the breakpoint table
      Specified by:
      getBreakTable in interface Emulator
      Returns:
      the breakpoint table
    • isAtBreakpoint

      public boolean isAtBreakpoint()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      isAtBreakpoint in interface Emulator
      Returns:
      true if halted at a breakpoint
    • setHalt

      public void setHalt(boolean halt)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Halt or un-halt the emulator
      Specified by:
      setHalt in interface Emulator
      Parameters:
      halt - true to halt
    • getHalt

      public boolean getHalt()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Check if the emulator has been halted
      Specified by:
      getHalt in interface Emulator
      Returns:
      true if halted
    • dispose

      public void dispose()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: Emulator
      Clean up resources used by the emulator
      Specified by:
      dispose in interface Emulator