Class DefaultPcodeThread.PcodeEmulationLibrary<T>

java.lang.Object
ghidra.pcode.exec.AnnotatedPcodeUseropLibrary<T>
ghidra.pcode.emu.DefaultPcodeThread.PcodeEmulationLibrary<T>
Type Parameters:
T - no particular type, except to match the thread's
All Implemented Interfaces:
PcodeUseropLibrary<T>
Enclosing class:
DefaultPcodeThread<T>

public static class DefaultPcodeThread.PcodeEmulationLibrary<T> extends AnnotatedPcodeUseropLibrary<T>
A userop library exporting some methods for emulated thread control

TODO: Since p-code userops can now receive the executor, it may be better to receive it, cast it, and obtain the thread, rather than binding a library to each thread.

  • Constructor Details

    • PcodeEmulationLibrary

      public PcodeEmulationLibrary(DefaultPcodeThread<T> thread)
      Construct a library to control the given thread
      Parameters:
      thread - the thread
  • Method Details

    • emu_exec_decoded

      public void emu_exec_decoded()
      Execute the actual machine instruction at the current program counter

      Because "injects" override the machine instruction, injects which need to defer to the machine instruction must invoke this userop.

      See Also:
    • emu_skip_decoded

      public void emu_skip_decoded()
      Advance the program counter beyond the current machine instruction

      Because "injects" override the machine instruction, they must specify the effect on the program counter, lest the thread become caught in an infinite loop on the inject. To emulate fall-through without executing the machine instruction, the inject must invoke this userop.

      See Also:
    • emu_swi

      public void emu_swi()
      Interrupt execution

      This immediately throws an InterruptPcodeExecutionException. To implement out-of-band breakpoints, inject an invocation of this userop at the desired address.

      See Also:
    • emu_injection_err

      public void emu_injection_err()
      Notify the client of a failed Sleigh inject compilation.

      To avoid pestering the client during emulator set-up, a service may effectively defer notifying the user of Sleigh compilation errors by replacing the erroneous injects with calls to this p-code op. Then, only if and when an erroneous inject is encountered will the client be notified.