Package ghidra.program.model.lang

# Interface InjectPayload

All Known Implementing Classes:
  `InjectPayloadCallfixup`, `InjectPayloadCallfixupError`, `InjectPayloadCallother`, `InjectPayloadCallotherError`, `InjectPayloadJumpAssist`, `InjectPayloadSegment`, `InjectPayloadSleigh`

public interface InjectPayload
`InjectPayload` encapsulates a semantic (p-code) override which can be injected into analyses that work with p-code (Decompiler, SymbolicPropagator) The payload typically replaces either a subroutine call or a userop

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static class`
  `InjectPayload.InjectParameter`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `CALLFIXUP_TYPE`
  `static final int`
  `CALLMECHANISM_TYPE`
  `static final int`
  `CALLOTHERFIXUP_TYPE`
  `static final int`
  `EXECUTABLEPCODE_TYPE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `encode(Encoder encoder)`
  Encode configuration parameters as a `<pcode>` element to stream
  `InjectPayload.InjectParameter[]`
  `getInput()`
  `String`
  `getName()`
  `InjectPayload.InjectParameter[]`
  `getOutput()`
  `int`
  `getParamShift()`
  `PcodeOp[]`
  `getPcode(Program program, InjectContext con)`
  A convenience function wrapping the inject method, to produce the final set of PcodeOp objects in an array
  `String`
  `getSource()`
  `int`
  `getType()`
  `void`
  `inject(InjectContext context, PcodeEmit emit)`
  Given a context, send the p-code payload to the emitter
  `boolean`
  `isEquivalent(InjectPayload obj)`
  Determine if this InjectPayload and another instance are equivalent (have the same name and generate the same p-code)
  `boolean`
  `isErrorPlaceholder()`
  If parsing a payload (from XML) fails, a placeholder payload may be substituted and this method returns true for the substitute.
  `boolean`
  `isFallThru()`
  `boolean`
  `isIncidentalCopy()`
  `void`
  `restoreXml(XmlPullParser parser, SleighLanguage language)`
  Restore the payload from an XML stream.

- ## Field Details

  - ### CALLFIXUP_TYPE

    static final int CALLFIXUP_TYPE
    See Also:
      - Constant Field Values

  - ### CALLOTHERFIXUP_TYPE

    static final int CALLOTHERFIXUP_TYPE
    See Also:
      - Constant Field Values

  - ### CALLMECHANISM_TYPE

    static final int CALLMECHANISM_TYPE
    See Also:
      - Constant Field Values

  - ### EXECUTABLEPCODE_TYPE

    static final int EXECUTABLEPCODE_TYPE
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getName

    String getName()
    Returns:
      formal name for this injection

  - ### getType

    int getType()
    Returns:
      the type of this injection: CALLFIXUP_TYPE, CALLMECHANISM_TYPE, etc.

  - ### getSource

    String getSource()
    Returns:
      a String describing the source of this payload

  - ### getParamShift

    int getParamShift()
    Returns:
      number of parameters from the original call which should be truncated

  - ### getInput

    InjectPayload.InjectParameter[] getInput()
    Returns:
      array of any input parameters for this inject

  - ### getOutput

    InjectPayload.InjectParameter[] getOutput()
    Returns:
      array of any output parameters for this inject

  - ### isErrorPlaceholder

    boolean isErrorPlaceholder()
    If parsing a payload (from XML) fails, a placeholder payload may be substituted and this method returns true for the substitute. In all other cases, this returns false.
    Returns:
      true if this is a placeholder for a payload with parse errors.

  - ### inject

    void inject(InjectContext context, PcodeEmit emit) throws MemoryAccessException, IOException, UnknownInstructionException, NotFoundException
    Given a context, send the p-code payload to the emitter
    Parameters:
      `context` - is the context for injection
      `emit` - is the object accumulating the final p-code
    Throws:
      `MemoryAccessException` - for problems establishing the injection context
      `IOException` - for problems while emitting the injection p-code
      `UnknownInstructionException` - if there is no underlying instruction being injected
      `NotFoundException` - if an expected aspect of the injection is not present in context

  - ### getPcode

    PcodeOp[] getPcode(Program program, InjectContext con) throws MemoryAccessException, IOException, UnknownInstructionException, NotFoundException
    A convenience function wrapping the inject method, to produce the final set of PcodeOp objects in an array
    Parameters:
      `program` - is the Program for which injection is happening
      `con` - is the context for injection
    Returns:
      the array of PcodeOps
    Throws:
      `MemoryAccessException` - for problems establishing the injection context
      `IOException` - for problems while emitting the injection p-code
      `UnknownInstructionException` - if there is no underlying instruction being injected
      `NotFoundException` - if an expected aspect of the injection is not present in context

  - ### isFallThru

    boolean isFallThru()
    Returns:
      true if the injected p-code falls thru

  - ### isIncidentalCopy

    boolean isIncidentalCopy()
    Returns:
      true if this inject's COPY operations should be treated as incidental

  - ### encode

    void encode(Encoder encoder) throws IOException
    Encode configuration parameters as a `<pcode>` element to stream
    Parameters:
      `encoder` - is the stream encoder
    Throws:
      `IOException` - for errors writing to the underlying stream

  - ### restoreXml

    void restoreXml(XmlPullParser parser, SleighLanguage language) throws XmlParseException
    Restore the payload from an XML stream. The root expected document is the `<pcode>` tag, which may be wrapped with another tag by the derived class.
    Parameters:
      `parser` - is the XML stream
      `language` - is used to resolve registers and address spaces
    Throws:
      `XmlParseException` - for badly formed XML

  - ### isEquivalent

    boolean isEquivalent(InjectPayload obj)
    Determine if this InjectPayload and another instance are equivalent (have the same name and generate the same p-code)
    Parameters:
      `obj` - is the other payload
    Returns:
      true if they are equivalent