Package ghidra.pcode.emu.auxiliary

# Class AuxPcodeEmulator<U>

java.lang.Object
ghidra.pcode.emu.AbstractPcodeMachine<org.apache.commons.lang3.tuple.Pair<byte[],U>>
ghidra.pcode.emu.auxiliary.AuxPcodeEmulator<U>

Type Parameters:
  `U` - the type of auxiliary values

All Implemented Interfaces:
  `PcodeMachine<org.apache.commons.lang3.tuple.Pair<byte[],U>>`

Direct Known Subclasses:
  `TaintPcodeEmulator`

public abstract class AuxPcodeEmulator<U> extends AbstractPcodeMachine<org.apache.commons.lang3.tuple.Pair<byte[],U>>
An emulator whose parts are manufactured by a `AuxEmulatorPartsFactory`

See the parts factory interface: `AuxEmulatorPartsFactory`. Also see the Taint Analyzer for a complete example based on this class.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface ghidra.pcode.emu.PcodeMachine

  `PcodeMachine.AccessKind, PcodeMachine.SwiMode`

- ## Field Summary

  ### Fields inherited from class ghidra.pcode.emu.AbstractPcodeMachine

  `accessBreakpoints, arithmetic, cb, injects, language, library, stubLibrary, suspended, swiMode, threads, threadsView`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AuxPcodeEmulator(Language language, PcodeEmulationCallbacks<org.apache.commons.lang3.tuple.Pair<byte[],U>> cb)`
  Create a new emulator

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected PcodeArithmetic<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
  `createArithmetic()`
  A factory method to create the arithmetic used by this machine
  `protected PcodeExecutorState<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
  `createLocalState(PcodeThread<org.apache.commons.lang3.tuple.Pair<byte[],U>> thread)`
  A factory method to create the (register) state local to the given thread
  `protected PcodeExecutorState<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
  `createSharedState()`
  A factory method to create the (memory) state shared by all threads in this machine
  `protected PcodeThread<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
  `createThread(String name)`
  A factory method to create a new thread in this machine
  `protected PcodeUseropLibrary<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
  `createThreadStubLibrary()`
  A factory method to create a stub library for compiling thread-local Sleigh source
  `protected PcodeUseropLibrary<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
  `createUseropLibrary()`
  A factory method to create the userop library shared by all threads in this machine
  `protected abstract AuxEmulatorPartsFactory<U>`
  `getPartsFactory()`
  Get the factory that manufactures parts for this emulator

  ### Methods inherited from class ghidra.pcode.emu.AbstractPcodeMachine

  `addAccessBreakpoint, addBreakpoint, assertSleigh, checkLoad, checkStore, clearAccessBreakpoints, clearAllInjects, clearInject, compileSleigh, doPluggableInitialization, getAllThreads, getArithmetic, getInject, getLanguage, getPluggableInitializer, getSharedState, getSoftwareInterruptMode, getStubUseropLibrary, getThread, getUseropLibrary, inject, isSuspended, newThread, newThread, setSoftwareInterruptMode, setSuspended, stepped, swi`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AuxPcodeEmulator

    public AuxPcodeEmulator(Language language, PcodeEmulationCallbacks<org.apache.commons.lang3.tuple.Pair<byte[],U>> cb)
    Create a new emulator
    Parameters:
      `language` - the language (processor model)
      `cb` - callbacks to receive emulation events

- ## Method Details

  - ### getPartsFactory

    protected abstract AuxEmulatorPartsFactory<U> getPartsFactory()
    Get the factory that manufactures parts for this emulator
    Returns:
      the factory
    Implementation Notes:
      This should just return a singleton, since it is called repeatedly (without caching) during emulator and thread construction. If, for some reason, a singleton is not suitable, then this should instantiate it just once and cache the factory itself. If cached, it should be done in a thread-safe manner.

  - ### createArithmetic

    protected PcodeArithmetic<org.apache.commons.lang3.tuple.Pair<byte[],U>> createArithmetic()
    Description copied from class: `AbstractPcodeMachine`
    A factory method to create the arithmetic used by this machine
    Specified by:
      `createArithmetic` in class `AbstractPcodeMachine<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
    Returns:
      the arithmetic

  - ### createUseropLibrary

    protected PcodeUseropLibrary<org.apache.commons.lang3.tuple.Pair<byte[],U>> createUseropLibrary()
    Description copied from class: `AbstractPcodeMachine`
    A factory method to create the userop library shared by all threads in this machine
    Specified by:
      `createUseropLibrary` in class `AbstractPcodeMachine<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
    Returns:
      the library

  - ### createThreadStubLibrary

    protected PcodeUseropLibrary<org.apache.commons.lang3.tuple.Pair<byte[],U>> createThreadStubLibrary()
    Description copied from class: `AbstractPcodeMachine`
    A factory method to create a stub library for compiling thread-local Sleigh source

    Because threads may introduce p-code userops using libraries unique to that thread, it becomes necessary to at least export stub symbols, so that p-code programs can be compiled from Sleigh source before the thread has necessarily been created. A side effect of this strategy is that all threads, though they may have independent libraries, must export identically-named symbols.

    Overrides:
      `createThreadStubLibrary` in class `AbstractPcodeMachine<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
    Returns:
      the stub library for all threads

  - ### createSharedState

    protected PcodeExecutorState<org.apache.commons.lang3.tuple.Pair<byte[],U>> createSharedState()
    Description copied from class: `AbstractPcodeMachine`
    A factory method to create the (memory) state shared by all threads in this machine
    Specified by:
      `createSharedState` in class `AbstractPcodeMachine<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
    Returns:
      the shared state

  - ### createLocalState

    protected PcodeExecutorState<org.apache.commons.lang3.tuple.Pair<byte[],U>> createLocalState(PcodeThread<org.apache.commons.lang3.tuple.Pair<byte[],U>> thread)
    Description copied from class: `AbstractPcodeMachine`
    A factory method to create the (register) state local to the given thread
    Specified by:
      `createLocalState` in class `AbstractPcodeMachine<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
    Parameters:
      `thread` - the thread
    Returns:
      the thread-local state

  - ### createThread

    protected PcodeThread<org.apache.commons.lang3.tuple.Pair<byte[],U>> createThread(String name)
    Description copied from class: `AbstractPcodeMachine`
    A factory method to create a new thread in this machine
    Overrides:
      `createThread` in class `AbstractPcodeMachine<org.apache.commons.lang3.tuple.Pair<byte[],U>>`
    Parameters:
      `name` - the name of the new thread
    Returns:
      the new thread
    See Also:
      - `AbstractPcodeMachine.newThread(String)`