Class: LLDB::BreakpointLocation

Inherits:
Object
  • Object
show all
Includes:
NativeLifecycle
Defined in:
lib/lldb/breakpoint_location.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, breakpoint:, context: breakpoint.context) ⇒ BreakpointLocation

Returns a new instance of BreakpointLocation.

RBS:

  • ptr: FFI::Pointer

  • breakpoint: Breakpoint

  • return: void



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

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

Instance Attribute Details

#breakpointObject (readonly)

RBS:

  • return: Breakpoint



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

def breakpoint
  @breakpoint
end

Class Method Details

.release(ptr) ⇒ Object

RBS:

  • ptr: FFI::Pointer

  • return: ^(Integer) -> void



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

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

Instance Method Details

#addressObject

RBS:

  • return: Address?



50
51
52
53
54
55
56
57
# File 'lib/lldb/breakpoint_location.rb', line 50

def address
  return nil unless valid?

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

  Address.from_ptr(address_ptr, target: @breakpoint.target, context: context)
end

#conditionObject

RBS:

  • return: String?



107
108
109
110
111
112
# File 'lib/lldb/breakpoint_location.rb', line 107

def condition
  return nil unless valid?

  cond = FFIBindings.lldb_breakpoint_location_get_condition(@ptr)
  cond.nil? || cond.empty? ? nil : cond
end

#condition=(expr) ⇒ Object

RBS:

  • expr: String?

  • return: void

Raises:



116
117
118
119
120
# File 'lib/lldb/breakpoint_location.rb', line 116

def condition=(expr)
  raise InvalidObjectError, 'BreakpointLocation is not valid' unless valid?

  FFIBindings.lldb_breakpoint_location_set_condition(@ptr, expr)
end

#disableObject

RBS:

  • return: void



80
81
82
# File 'lib/lldb/breakpoint_location.rb', line 80

def disable
  self.enabled = false
end

#enableObject

RBS:

  • return: void



75
76
77
# File 'lib/lldb/breakpoint_location.rb', line 75

def enable
  self.enabled = true
end

#enabled=(value) ⇒ Object

RBS:

  • value: bool

  • return: void

Raises:



68
69
70
71
72
# File 'lib/lldb/breakpoint_location.rb', line 68

def enabled=(value)
  raise InvalidObjectError, 'BreakpointLocation is not valid' unless valid?

  FFIBindings.lldb_breakpoint_location_set_enabled(@ptr, value ? 1 : 0)
end

#enabled?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


60
61
62
63
64
# File 'lib/lldb/breakpoint_location.rb', line 60

def enabled?
  return false unless valid?

  FFIBindings.lldb_breakpoint_location_is_enabled(@ptr) != 0
end

#hit_countObject

RBS:

  • return: Integer



85
86
87
88
89
# File 'lib/lldb/breakpoint_location.rb', line 85

def hit_count
  return 0 unless valid?

  FFIBindings.lldb_breakpoint_location_get_hit_count(@ptr)
end

#idObject

RBS:

  • return: Integer



36
37
38
39
40
# File 'lib/lldb/breakpoint_location.rb', line 36

def id
  return INVALID_BREAK_ID unless valid?

  FFIBindings.lldb_breakpoint_location_get_id(@ptr)
end

#ignore_countObject

RBS:

  • return: Integer



92
93
94
95
96
# File 'lib/lldb/breakpoint_location.rb', line 92

def ignore_count
  return 0 unless valid?

  FFIBindings.lldb_breakpoint_location_get_ignore_count(@ptr)
end

#ignore_count=(count) ⇒ Object

RBS:

  • count: Integer

  • return: void

Raises:



100
101
102
103
104
# File 'lib/lldb/breakpoint_location.rb', line 100

def ignore_count=(count)
  raise InvalidObjectError, 'BreakpointLocation is not valid' unless valid?

  FFIBindings.lldb_breakpoint_location_set_ignore_count(@ptr, count)
end

#load_addressObject

RBS:

  • return: Integer



43
44
45
46
47
# File 'lib/lldb/breakpoint_location.rb', line 43

def load_address
  return INVALID_ADDRESS unless valid?

  FFIBindings.lldb_breakpoint_location_get_load_address(@ptr)
end

#to_ptrObject

RBS:

  • return: FFI::Pointer



128
129
130
# File 'lib/lldb/breakpoint_location.rb', line 128

def to_ptr
  @ptr
end

#to_sObject

RBS:

  • return: String



123
124
125
# File 'lib/lldb/breakpoint_location.rb', line 123

def to_s
  "BreakpointLocation #{id}: address=0x#{load_address.to_s(16)}, enabled=#{enabled?}"
end

#valid?Boolean

RBS:

  • return: bool

Returns:

  • (Boolean)


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

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