class Metasm::Relocation

an EncodedData relocation, specifies a value to patch in

Attributes

endianness[RW]

the endianness of the relocation

target[RW]

the relocation value (an Expression)

type[RW]

the relocation expression type

Public Class Methods

new(target, type, endianness, backtrace = nil) click to toggle source
# File metasm/main.rb, line 970
def initialize(target, type, endianness, backtrace = nil)
        raise ArgumentError, "bad args #{[target, type, endianness].inspect}" if not target.kind_of? Expression or not type.kind_of?(::Symbol) or not endianness.kind_of?(::Symbol)
        @target, @type, @endianness, @backtrace = target, type, endianness, backtrace
end

Public Instance Methods

fixup(edata, off, value) click to toggle source

fixup the encodeddata with value (reloc starts at off)

# File metasm/main.rb, line 976
def fixup(edata, off, value)
        str = Expression.encode_imm(value, @type, @endianness, @backtrace)
        edata.fill off
        edata.data[off, str.length] = str
end
length() click to toggle source

size of the relocation field, in bytes

# File metasm/main.rb, line 983
def length
        Expression::INT_SIZE[@type]/8
end