Skip to content
Lenni0451 edited this page Mar 17, 2024 · 1 revision

The CSlice annotation allows you to specify a range of instructions to target.
It can help to target a specific instruction in a large method with many matching instructions.
The slice is optional and can not be used with all annotations. Check out the specific annotation page to see if it supports slices.

The annotation has two fields: from and to.
The from field specifies the first instruction of the slice and the to field specifies the last instruction of the slice.
Both instructions are included in the slice and can be targeted by the CTarget annotation.
Check out the CTarget page for more information about the different targets.

Example

This example targets the String.equals() method as the start of the slice and the Integer.MAX_VALUE field access as the end of the slice.

@CSlice(
    from = @CTarget(value = "INVOKE", target = "Ljava/lang/String;equals(Ljava/lang/Object;)Z"),
    to = @CTarget(value = "FIELD", target = "Ljava/lang/Integer;MAX_VALUE:I")
)
Clone this wiki locally