Frida Docs Unified
    Preparing search index...

    Interface InstrumentationTarget

    Target to instrument, carrying the address alongside optional knobs that control how the inline hook is set up.

    interface InstrumentationTarget {
        redirectSpaceHint?: number;
        relocation?: RelocationPolicy;
        scenario?: InstrumentationScenario;
        scratchRegister?:
            | "x0"
            | "x1"
            | "x2"
            | "x3"
            | "x4"
            | "x5"
            | "x6"
            | "x7"
            | "x8"
            | "x9"
            | "x10"
            | "x11"
            | "x12"
            | "x13"
            | "x14"
            | "x15"
            | "x16"
            | "x17"
            | "x18"
            | "x19"
            | "x20"
            | "x21"
            | "x22"
            | "x23"
            | "x24"
            | "x25"
            | "x26"
            | "x27"
            | "x28"
            | "x29"
            | "x30"
            | "w0"
            | "w1"
            | "w2"
            | "w3"
            | "w4"
            | "w5"
            | "w6"
            | "w7"
            | "w8"
            | "w9"
            | "w10"
            | "w11"
            | "w12"
            | "w13"
            | "w14"
            | "w15"
            | "w16"
            | "w17"
            | "w18"
            | "w19"
            | "w20"
            | "w21"
            | "w22"
            | "w23"
            | "w24"
            | "w25"
            | "w26"
            | "w27"
            | "w28"
            | "w29"
            | "w30"
            | "sp"
            | "lr"
            | "fp"
            | "wsp"
            | "wzr"
            | "xzr"
            | "nzcv"
            | "ip0"
            | "ip1"
            | "s0"
            | "s1"
            | "s2"
            | "s3"
            | "s4"
            | "s5"
            | "s6"
            | "s7"
            | "s8"
            | "s9"
            | "s10"
            | "s11"
            | "s12"
            | "s13"
            | "s14"
            | "s15"
            | "s16"
            | "s17"
            | "s18"
            | "s19"
            | "s20"
            | "s21"
            | "s22"
            | "s23"
            | "s24"
            | "s25"
            | "s26"
            | "s27"
            | "s28"
            | "s29"
            | "s30"
            | "s31"
            | "d0"
            | "d1"
            | "d2"
            | "d3"
            | "d4"
            | "d5"
            | "d6"
            | "d7"
            | "d8"
            | "d9"
            | "d10"
            | "d11"
            | "d12"
            | "d13"
            | "d14"
            | "d15"
            | "d16"
            | "d17"
            | "d18"
            | "d19"
            | "d20"
            | "d21"
            | "d22"
            | "d23"
            | "d24"
            | "d25"
            | "d26"
            | "d27"
            | "d28"
            | "d29"
            | "d30"
            | "d31"
            | "q0"
            | "q1"
            | "q2"
            | "q3"
            | "q4"
            | "q5"
            | "q6"
            | "q7"
            | "q8"
            | "q9"
            | "q10"
            | "q11"
            | "q12"
            | "q13"
            | "q14"
            | "q15"
            | "q16"
            | "q17"
            | "q18"
            | "q19"
            | "q20"
            | "q21"
            | "q22"
            | "q23"
            | "q24"
            | "q25"
            | "q26"
            | "q27"
            | "q28"
            | "q29"
            | "q30"
            | "q31"
            | "v0"
            | "v1"
            | "a0"
            | "a1"
            | "a2"
            | "a3"
            | "t0"
            | "t1"
            | "t2"
            | "t3"
            | "t4"
            | "t5"
            | "t6"
            | "t7"
            | "t8"
            | "t9"
            | "k0"
            | "k1"
            | "gp"
            | "ra"
            | "hi"
            | "lo"
            | "zero"
            | "at"
            | "0"
            | "1"
            | "2"
            | "3"
            | "4"
            | "5"
            | "6"
            | "7"
            | "8"
            | "9"
            | "10"
            | "11"
            | "12"
            | "13"
            | "14"
            | "15"
            | "16"
            | "17"
            | "18"
            | "19"
            | "20"
            | "21"
            | "22"
            | "23"
            | "24"
            | "25"
            | "26"
            | "27"
            | "28"
            | "29"
            | "30"
            | "31";
        target: NativePointerValue;
        writeRedirect?: WriteRedirectCallback;
    }

    Hierarchy (View Summary)

    Index

    Properties

    redirectSpaceHint?: number

    Upper bound on the number of bytes that writeRedirect will need.

    Your callback may end up using less. Specifying a larger value means Interceptor has to explore further to determine that it is safe to use that much space — looking for back-branches, call return sites, etc. — which is more expensive.

    Defaults to the size needed for a full redirect, e.g. 16 bytes on arm64.

    relocation?: RelocationPolicy

    How to deal with relocation of the instructions overwritten by the hook.

    Defaults to checked.

    Whether another thread might be executing the target while it is being instrumented.

    Use online when calls may be in flight, i.e. a thread could have executed an instruction with call semantics (CALL/BL/etc.) but not yet returned. Use offline when that cannot happen — e.g. after spawn() but before resume(), or when no calls will occur until some external input you control. The offline scenario allows writing past the end of such an instruction, which would be unsafe online.

    Defaults to online.

    scratchRegister?:
        | "x0"
        | "x1"
        | "x2"
        | "x3"
        | "x4"
        | "x5"
        | "x6"
        | "x7"
        | "x8"
        | "x9"
        | "x10"
        | "x11"
        | "x12"
        | "x13"
        | "x14"
        | "x15"
        | "x16"
        | "x17"
        | "x18"
        | "x19"
        | "x20"
        | "x21"
        | "x22"
        | "x23"
        | "x24"
        | "x25"
        | "x26"
        | "x27"
        | "x28"
        | "x29"
        | "x30"
        | "w0"
        | "w1"
        | "w2"
        | "w3"
        | "w4"
        | "w5"
        | "w6"
        | "w7"
        | "w8"
        | "w9"
        | "w10"
        | "w11"
        | "w12"
        | "w13"
        | "w14"
        | "w15"
        | "w16"
        | "w17"
        | "w18"
        | "w19"
        | "w20"
        | "w21"
        | "w22"
        | "w23"
        | "w24"
        | "w25"
        | "w26"
        | "w27"
        | "w28"
        | "w29"
        | "w30"
        | "sp"
        | "lr"
        | "fp"
        | "wsp"
        | "wzr"
        | "xzr"
        | "nzcv"
        | "ip0"
        | "ip1"
        | "s0"
        | "s1"
        | "s2"
        | "s3"
        | "s4"
        | "s5"
        | "s6"
        | "s7"
        | "s8"
        | "s9"
        | "s10"
        | "s11"
        | "s12"
        | "s13"
        | "s14"
        | "s15"
        | "s16"
        | "s17"
        | "s18"
        | "s19"
        | "s20"
        | "s21"
        | "s22"
        | "s23"
        | "s24"
        | "s25"
        | "s26"
        | "s27"
        | "s28"
        | "s29"
        | "s30"
        | "s31"
        | "d0"
        | "d1"
        | "d2"
        | "d3"
        | "d4"
        | "d5"
        | "d6"
        | "d7"
        | "d8"
        | "d9"
        | "d10"
        | "d11"
        | "d12"
        | "d13"
        | "d14"
        | "d15"
        | "d16"
        | "d17"
        | "d18"
        | "d19"
        | "d20"
        | "d21"
        | "d22"
        | "d23"
        | "d24"
        | "d25"
        | "d26"
        | "d27"
        | "d28"
        | "d29"
        | "d30"
        | "d31"
        | "q0"
        | "q1"
        | "q2"
        | "q3"
        | "q4"
        | "q5"
        | "q6"
        | "q7"
        | "q8"
        | "q9"
        | "q10"
        | "q11"
        | "q12"
        | "q13"
        | "q14"
        | "q15"
        | "q16"
        | "q17"
        | "q18"
        | "q19"
        | "q20"
        | "q21"
        | "q22"
        | "q23"
        | "q24"
        | "q25"
        | "q26"
        | "q27"
        | "q28"
        | "q29"
        | "q30"
        | "q31"
        | "v0"
        | "v1"
        | "a0"
        | "a1"
        | "a2"
        | "a3"
        | "t0"
        | "t1"
        | "t2"
        | "t3"
        | "t4"
        | "t5"
        | "t6"
        | "t7"
        | "t8"
        | "t9"
        | "k0"
        | "k1"
        | "gp"
        | "ra"
        | "hi"
        | "lo"
        | "zero"
        | "at"
        | "0"
        | "1"
        | "2"
        | "3"
        | "4"
        | "5"
        | "6"
        | "7"
        | "8"
        | "9"
        | "10"
        | "11"
        | "12"
        | "13"
        | "14"
        | "15"
        | "16"
        | "17"
        | "18"
        | "19"
        | "20"
        | "21"
        | "22"
        | "23"
        | "24"
        | "25"
        | "26"
        | "27"
        | "28"
        | "29"
        | "30"
        | "31"

    Register that Interceptor may clobber when building the trampoline.

    Only supported on architectures that expose scratch registers, i.e. arm64 and mips.

    Address of function/instruction to instrument.

    writeRedirect?: WriteRedirectCallback

    Callback that emits a custom redirect from the instrumented function or instruction to Interceptor's trampoline.

    The primary use-case is defeating fingerprinting: emitting a redirect that a RASP implementation won't recognize as an inline hook. It is also useful when space is tight and you want to locate a nearby code cave reachable through a short immediate branch, and then branch from there to the trampoline farther away.

    Throwing from the callback declines the redirect. There is no fallback to the default strategy in that case: the attach() / replace() / replaceFast() call fails as if the target had a signature that could not be instrumented.