Class: LLDB::SymbolContext

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NativeLifecycle

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

Constructor Details

#initialize(ptr, parent:, context: parent.context) ⇒ SymbolContext

Returns a new instance of SymbolContext.

RBS:

  • ptr: FFI::Pointer

  • parent: Frame

  • return: void



15
16
17
18
19
20
21
22
# File 'lib/lldb/symbol_context.rb', line 15

def initialize(ptr, parent:, context: parent.context)
  @parent = parent
  initialize_native_object(
    ptr,
    release: ->(released) { FFIBindings.lldb_symbol_context_destroy(released) },
    context: context
  )
end

Instance Attribute Details

#parentObject (readonly)

RBS:

  • return: Frame



10
11
12
# File 'lib/lldb/symbol_context.rb', line 10

def parent
  @parent
end

Class Method Details

.release(ptr) ⇒ Object

RBS:

  • ptr: FFI::Pointer

  • return: ^(Integer) -> void



26
27
28
# File 'lib/lldb/symbol_context.rb', line 26

def self.release(ptr)
  ->(_id) { FFIBindings.lldb_symbol_context_destroy(ptr) unless ptr.null? }
end

Instance Method Details

#function_nameObject

RBS:

  • return: String?



46
47
48
49
50
# File 'lib/lldb/symbol_context.rb', line 46

def function_name
  return nil unless valid?

  FFIBindings.lldb_symbol_context_get_function_name(@ptr)
end

#moduleObject

RBS:

  • return: Module?



36
37
38
39
40
41
42
43
# File 'lib/lldb/symbol_context.rb', line 36

def module
  return nil unless valid?

  mod_ptr = FFIBindings.lldb_symbol_context_get_module(@ptr)
  return nil if mod_ptr.nil? || mod_ptr.null?

  Module.new(mod_ptr, target: nil, context: context)
end

#to_ptrObject

RBS:

  • return: FFI::Pointer



53
54
55
# File 'lib/lldb/symbol_context.rb', line 53

def to_ptr
  @ptr
end

#valid?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


31
32
33
# File 'lib/lldb/symbol_context.rb', line 31

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