class FFI::UDis86::Operand

Public Instance Methods

base() click to toggle source

The base register used by the operand.

@return [Symbol]

The base register of the operand.
# File lib/ffi/udis86/operand.rb, line 122
def base
  REGS[self[:base]]
end
Also aliased as: reg
index() click to toggle source

The index register used by the operand.

@return [Symbol]

The index register of the operand.
# File lib/ffi/udis86/operand.rb, line 134
def index
  REGS[self[:index]]
end
is_const?() click to toggle source

Determines if the operand is a data constant.

@return [Boolean]

Specifies whether the operand is a data constant.
# File lib/ffi/udis86/operand.rb, line 74
def is_const?
  self[:type] == :ud_op_const
end
is_imm?() click to toggle source

Determines if the operand is immediate data.

@return [Boolean]

Specifies whether the operand is immediate data.
# File lib/ffi/udis86/operand.rb, line 54
def is_imm?
  self[:type] == :ud_op_imm
end
is_jmp_imm?() click to toggle source

Determines if the operand is a relative offset used in a jump.

@return [Boolean]

Specifies whether the operand is a relative offset.
# File lib/ffi/udis86/operand.rb, line 64
def is_jmp_imm?
  self[:type] == :ud_op_jimm
end
is_mem?() click to toggle source

Determines if the operand is a memory access.

@return [Boolean]

Specifies whether the operand is a memory access.
# File lib/ffi/udis86/operand.rb, line 34
def is_mem?
  self[:type] == :ud_op_mem
end
is_reg?() click to toggle source

Determines if the operand is a register.

@return [Boolean]

Specifies whether the operand is a register.
# File lib/ffi/udis86/operand.rb, line 84
def is_reg?
  self[:type] == :ud_op_reg
end
is_seg_ptr?() click to toggle source

Determines if the operand is Segment:Offset pointer.

@return [Boolean]

Specifies whether the operand is Segment:Offset pointer.
# File lib/ffi/udis86/operand.rb, line 44
def is_seg_ptr?
  self[:type] == :ud_op_ptr
end
offset() click to toggle source

The offset value used by the operand.

@return [OperandValue, 0]

The offset value of the operand.
# File lib/ffi/udis86/operand.rb, line 144
def offset
  if self[:offset] > 0
    return self[:value]
  else
    return 0
  end
end
offset_size() click to toggle source

The word-length of the offset used with the operand.

@return [Integer]

Word-length of the offset being used.
# File lib/ffi/udis86/operand.rb, line 158
def offset_size
  self[:offset]
end
reg()
Alias for: base
scale() click to toggle source

The scale value used by the operand.

@return [Integer]

The scale value of the operand.
# File lib/ffi/udis86/operand.rb, line 168
def scale
  self[:scale]
end
size() click to toggle source

The size of the operand.

@return [Integer]

The size of the operand in bytes.
# File lib/ffi/udis86/operand.rb, line 94
def size
  self[:size]
end
type() click to toggle source

The type of the operand.

@return [Symbol]

The type of the operand.
# File lib/ffi/udis86/operand.rb, line 24
def type
  self[:type]
end
value() click to toggle source

The value of the operand.

@return [OperandValue, OperandPointer]

The value of the operand. If the operand represents a pointer,
an OperandPointer object will be returned.
# File lib/ffi/udis86/operand.rb, line 105
def value
  case type
  when :ud_op_ptr
    return self[:value].ptr
  when :ud_op_reg
    return nil
  else
    return self[:value]
  end
end