Class: LLDB::Symbol

Inherits:
Object
  • Object
show all
Includes:
NativeLifecycle
Defined in:
lib/lldb/symbol.rb

Instance Method Summary collapse

Methods included from NativeLifecycle

#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object

Constructor Details

#initialize(ptr, target: nil, context: nil) ⇒ Symbol

Returns a new instance of Symbol.

RBS:

  • target: Target?

  • context: Context?

  • return: void



12
13
14
15
16
17
18
19
# File 'lib/lldb/symbol.rb', line 12

def initialize(ptr, target: nil, context: nil)
  @target = target
  initialize_native_object(
    ptr,
    release: ->(released) { FFIBindings.lldb_symbol_destroy(released) },
    context: context || target&.context
  )
end

Instance Method Details

#base_nameObject

RBS:

  • return: String?



48
49
50
51
52
# File 'lib/lldb/symbol.rb', line 48

def base_name
  return nil unless valid?

  FFIBindings.lldb_symbol_get_base_name(@ptr)
end

#display_nameObject

RBS:

  • return: String?



34
35
36
37
38
# File 'lib/lldb/symbol.rb', line 34

def display_name
  return nil unless valid?

  FFIBindings.lldb_symbol_get_display_name(@ptr)
end

#end_addressObject

RBS:

  • return: Address?



60
61
62
# File 'lib/lldb/symbol.rb', line 60

def end_address
  address_at(:lldb_symbol_get_end_address)
end

#idObject

RBS:

  • return: Integer



93
94
95
96
97
# File 'lib/lldb/symbol.rb', line 93

def id
  return 0 unless valid?

  FFIBindings.lldb_symbol_get_id(@ptr)
end

#mangled_nameObject

RBS:

  • return: String?



41
42
43
44
45
# File 'lib/lldb/symbol.rb', line 41

def mangled_name
  return nil unless valid?

  FFIBindings.lldb_symbol_get_mangled_name(@ptr)
end

#nameObject

RBS:

  • return: String?



27
28
29
30
31
# File 'lib/lldb/symbol.rb', line 27

def name
  return nil unless valid?

  FFIBindings.lldb_symbol_get_name(@ptr)
end

#prologue_byte_sizeObject

RBS:

  • return: Integer



79
80
81
82
83
# File 'lib/lldb/symbol.rb', line 79

def prologue_byte_size
  return 0 unless valid?

  FFIBindings.lldb_symbol_get_prologue_byte_size(@ptr)
end

#sizeObject

RBS:

  • return: Integer



72
73
74
75
76
# File 'lib/lldb/symbol.rb', line 72

def size
  return 0 unless valid?

  FFIBindings.lldb_symbol_get_size(@ptr)
end

#start_addressObject

RBS:

  • return: Address?



55
56
57
# File 'lib/lldb/symbol.rb', line 55

def start_address
  address_at(:lldb_symbol_get_start_address)
end

#to_ptrObject

RBS:

  • return: FFI::Pointer



100
101
102
# File 'lib/lldb/symbol.rb', line 100

def to_ptr
  @ptr
end

#typeObject

RBS:

  • return: Integer



86
87
88
89
90
# File 'lib/lldb/symbol.rb', line 86

def type
  return 0 unless valid?

  FFIBindings.lldb_symbol_get_type(@ptr)
end

#valid?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


22
23
24
# File 'lib/lldb/symbol.rb', line 22

def valid?
  !@ptr.null? && FFIBindings.lldb_symbol_is_valid(@ptr) != 0
end

#valueObject

RBS:

  • return: Integer



65
66
67
68
69
# File 'lib/lldb/symbol.rb', line 65

def value
  return INVALID_ADDRESS unless valid?

  FFIBindings.lldb_symbol_get_value(@ptr)
end