Package ghidra.pcode.exec

# Annotation Interface AnnotatedPcodeUseropLibrary.PcodeUserop

Enclosing class:
  AnnotatedPcodeUseropLibrary<T>

@Retention(RUNTIME) @Target(METHOD) public static @interface AnnotatedPcodeUseropLibrary.PcodeUserop
An annotation to export a Java method as a userop in the library.

Ordinarily, each parameter receives an input to the userop. Each parameter may be annotated with at most one of `AnnotatedPcodeUseropLibrary.OpExecutor`, `AnnotatedPcodeUseropLibrary.OpState`, `AnnotatedPcodeUseropLibrary.OpLibrary`, or `AnnotatedPcodeUseropLibrary.OpOutput` to change what it receives. If `variadic()` is false, non-annotated parameters receive the inputs to the userop in matching order. Conventionally, annotated parameters should be placed first or last. Parameters accepting inputs must have type either `Varnode` or assignable from `T`. A parameter of type `Varnode` will receive the input `Varnode`. A parameter that is assignable from `T` will receive the input value. If it so happens that `T` is assignable from `Varnode`, the parameter will receive the `Varnode`, not the value. NOTE: Receiving a value instead of a variable may lose its size. Depending on the type of the value, that size may or may not be recoverable.

If `variadic()` is true, then a single non-annotated parameter receives all inputs in order. This parameter must have a type `Varnode``[]` to receive variables or have type assignable from `T[]` to receive values.

Note that there is no annotation to receive the "thread," because threads are not a concept known to the p-code executor or userop libraries, in general. In most cases, receiving the executor and/or state (which are usually bound to a specific thread) is sufficient. The preferred means of exposing thread-specific userops is to construct a library bound to that specific thread. That strategy should preserve compile-time type safety. Alternatively, you can receive the executor or state, cast it to your specific type, and use an accessor to get its thread.

- ## Optional Element Summary

  Optional Elements
  Modifier and Type
  Optional Element
  Description
  `boolean`
  `variadic`
  Set to true to receive all inputs in an array

- ## Element Details

  - ### variadic

    boolean variadic
    Set to true to receive all inputs in an array
    Default:
      false