Class: LLDB::Function

Inherits:
Object
  • Object
show all
Includes:
NativeLifecycle
Defined in:
lib/lldb/function.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) ⇒ Function

Returns a new instance of Function.

RBS:

  • target: Target?

  • context: Context?

  • return: void



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

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

Instance Method Details

#base_nameObject

RBS:

  • return: String?



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

def base_name
  return nil unless valid?

  FFIBindings.lldb_function_get_base_name(@ptr)
end

#blockObject

RBS:

  • return: Block?



82
83
84
85
86
87
88
89
# File 'lib/lldb/function.rb', line 82

def block
  return nil unless valid?

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

  Block.new(ptr, target: @target, context: context)
end

#display_nameObject

RBS:

  • return: String?



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

def display_name
  return nil unless valid?

  FFIBindings.lldb_function_get_display_name(@ptr)
end

#end_addressObject

RBS:

  • return: Address?



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

def end_address
  address_at(:lldb_function_get_end_address)
end

#languageObject

RBS:

  • return: Integer



97
98
99
100
101
# File 'lib/lldb/function.rb', line 97

def language
  return 0 unless valid?

  FFIBindings.lldb_function_get_language(@ptr)
end

#mangled_nameObject

RBS:

  • return: String?



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

def mangled_name
  return nil unless valid?

  FFIBindings.lldb_function_get_mangled_name(@ptr)
end

#nameObject

RBS:

  • return: String?



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

def name
  return nil unless valid?

  FFIBindings.lldb_function_get_name(@ptr)
end

#optimized?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


92
93
94
# File 'lib/lldb/function.rb', line 92

def optimized?
  valid? && FFIBindings.lldb_function_is_optimized(@ptr) != 0
end

#prologue_byte_sizeObject

RBS:

  • return: Integer



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

def prologue_byte_size
  return 0 unless valid?

  FFIBindings.lldb_function_get_prologue_byte_size(@ptr)
end

#start_addressObject

RBS:

  • return: Address?



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

def start_address
  address_at(:lldb_function_get_start_address)
end

#to_ptrObject

RBS:

  • return: FFI::Pointer



104
105
106
# File 'lib/lldb/function.rb', line 104

def to_ptr
  @ptr
end

#typeObject

RBS:

  • return: Type?



72
73
74
75
76
77
78
79
# File 'lib/lldb/function.rb', line 72

def type
  return nil unless valid?

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

  Type.new(ptr, context: context)
end

#valid?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


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

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