Frida Docs Unified
    Preparing search index...

    Relocates machine code for x86.

    Index

    Constructors

    • Creates a new code relocator for copying x86 instructions from one memory location to another, taking care to adjust position-dependent instructions accordingly.

      Parameters

      • inputCode: NativePointerValue

        Source address to copy instructions from.

      • output: X86Writer

        X86Writer pointed at the desired target memory address.

      Returns X86Relocator

    Properties

    eob: boolean

    Indicates whether end-of-block has been reached, i.e. we've reached a branch of any kind, like CALL, JMP, BL, RET.

    eoi: boolean

    Indicates whether end-of-input has been reached, e.g. we've reached JMP/B/RET, an instruction after which there may or may not be valid code.

    Latest Instruction read so far. Starts out null and changes on every call to readOne().

    Methods

    • Eagerly cleans up memory.

      Returns void

    • Reads the next instruction into the relocator's internal buffer and returns the number of bytes read so far, including previous calls.

      You may keep calling this method to keep buffering, or immediately call either writeOne() or skipOne(). Or, you can buffer up until the desired point and then call writeAll().

      Returns zero when end-of-input is reached, which means the eoi property is now true.

      Returns number

    • Skips the instruction that would have been written next.

      Returns void

    • Skips the instruction that would have been written next, but without a label for internal use. This breaks relocation of branches to locations inside the relocated range, and is an optimization for use-cases where all branches are rewritten (e.g. Frida's Stalker).

      Returns void

    • Writes all buffered instructions.

      Returns void

    • Writes the next buffered instruction.

      Returns boolean

    • Writes the next buffered instruction, but without a label for internal use. This breaks relocation of branches to locations inside the relocated range, and is an optimization for use-cases where all branches are rewritten (e.g. Frida's Stalker).

      Returns boolean