Class: LLDB::Watchpoint
- Inherits:
-
Object
- Object
- LLDB::Watchpoint
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/watchpoint.rb
Instance Attribute Summary collapse
- #target ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #condition ⇒ Object
- #condition=(expr) ⇒ Object
- #delete ⇒ Object
- #disable ⇒ Object
- #enable ⇒ Object
- #enabled=(value) ⇒ Object
- #enabled? ⇒ Boolean
- #hit_count ⇒ Object
- #id ⇒ Object
- #ignore_count ⇒ Object
- #ignore_count=(count) ⇒ Object
-
#initialize(ptr, target:, context: target.context) ⇒ Watchpoint
constructor
A new instance of Watchpoint.
- #to_ptr ⇒ Object
- #to_s ⇒ Object
- #valid? ⇒ Boolean
- #watch_address ⇒ Object
- #watch_size ⇒ Object
- #watching_reads? ⇒ Boolean
- #watching_writes? ⇒ Boolean
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(ptr, target:, context: target.context) ⇒ Watchpoint
Returns a new instance of Watchpoint.
15 16 17 18 19 20 21 22 |
# File 'lib/lldb/watchpoint.rb', line 15 def initialize(ptr, target:, context: target.context) @target = target initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_watchpoint_destroy(released) }, context: context ) end |
Instance Attribute Details
#target ⇒ Object (readonly)
10 11 12 |
# File 'lib/lldb/watchpoint.rb', line 10 def target @target end |
Class Method Details
.release(ptr) ⇒ Object
26 27 28 |
# File 'lib/lldb/watchpoint.rb', line 26 def self.release(ptr) ->(_id) { FFIBindings.lldb_watchpoint_destroy(ptr) unless ptr.null? } end |
Instance Method Details
#condition ⇒ Object
90 91 92 93 94 95 |
# File 'lib/lldb/watchpoint.rb', line 90 def condition return nil unless valid? cond = FFIBindings.lldb_watchpoint_get_condition(@ptr) cond.nil? || cond.empty? ? nil : cond end |
#condition=(expr) ⇒ Object
99 100 101 102 103 |
# File 'lib/lldb/watchpoint.rb', line 99 def condition=(expr) raise InvalidObjectError, 'Watchpoint is not valid' unless valid? FFIBindings.lldb_watchpoint_set_condition(@ptr, expr) end |
#delete ⇒ Object
146 147 148 149 150 |
# File 'lib/lldb/watchpoint.rb', line 146 def delete raise InvalidObjectError, 'Watchpoint is not valid' unless valid? target.delete_watchpoint(id) end |
#disable ⇒ Object
63 64 65 |
# File 'lib/lldb/watchpoint.rb', line 63 def disable self.enabled = false end |
#enable ⇒ Object
58 59 60 |
# File 'lib/lldb/watchpoint.rb', line 58 def enable self.enabled = true end |
#enabled=(value) ⇒ Object
51 52 53 54 55 |
# File 'lib/lldb/watchpoint.rb', line 51 def enabled=(value) raise InvalidObjectError, 'Watchpoint is not valid' unless valid? FFIBindings.lldb_watchpoint_set_enabled(@ptr, value ? 1 : 0) end |
#enabled? ⇒ Boolean
43 44 45 46 47 |
# File 'lib/lldb/watchpoint.rb', line 43 def enabled? return false unless valid? FFIBindings.lldb_watchpoint_is_enabled(@ptr) != 0 end |
#hit_count ⇒ Object
68 69 70 71 72 |
# File 'lib/lldb/watchpoint.rb', line 68 def hit_count return 0 unless valid? FFIBindings.lldb_watchpoint_get_hit_count(@ptr) end |
#id ⇒ Object
36 37 38 39 40 |
# File 'lib/lldb/watchpoint.rb', line 36 def id return INVALID_BREAK_ID unless valid? FFIBindings.lldb_watchpoint_get_id(@ptr) end |
#ignore_count ⇒ Object
75 76 77 78 79 |
# File 'lib/lldb/watchpoint.rb', line 75 def ignore_count return 0 unless valid? FFIBindings.lldb_watchpoint_get_ignore_count(@ptr) end |
#ignore_count=(count) ⇒ Object
83 84 85 86 87 |
# File 'lib/lldb/watchpoint.rb', line 83 def ignore_count=(count) raise InvalidObjectError, 'Watchpoint is not valid' unless valid? FFIBindings.lldb_watchpoint_set_ignore_count(@ptr, count) end |
#to_ptr ⇒ Object
158 159 160 |
# File 'lib/lldb/watchpoint.rb', line 158 def to_ptr @ptr end |
#to_s ⇒ Object
153 154 155 |
# File 'lib/lldb/watchpoint.rb', line 153 def to_s "Watchpoint #{id}: address=0x#{watch_address.to_s(16)}, size=#{watch_size}, enabled=#{enabled?}" end |
#valid? ⇒ Boolean
31 32 33 |
# File 'lib/lldb/watchpoint.rb', line 31 def valid? !@ptr.null? && FFIBindings.lldb_watchpoint_is_valid(@ptr) != 0 end |
#watch_address ⇒ Object
106 107 108 109 110 |
# File 'lib/lldb/watchpoint.rb', line 106 def watch_address return INVALID_ADDRESS unless valid? FFIBindings.lldb_watchpoint_get_watch_address(@ptr) end |
#watch_size ⇒ Object
113 114 115 116 117 |
# File 'lib/lldb/watchpoint.rb', line 113 def watch_size return 0 unless valid? FFIBindings.lldb_watchpoint_get_watch_size(@ptr) end |
#watching_reads? ⇒ Boolean
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/lldb/watchpoint.rb', line 120 def watching_reads? raise InvalidObjectError, 'Watchpoint is not valid' unless valid? APISupport.require_feature!(:watchpoint_access_kind) result = FFI::MemoryPointer.new(:int) status = FFIBindings.lldb_watchpoint_is_watching_reads(@ptr, result) raise UnsupportedAPIError, 'Watchpoint read access is unsupported' if status == NativeStatus::UNSUPPORTED raise LLDBError, "Failed to query watchpoint read access (status=#{status})" unless status == NativeStatus::OK result.read_int != 0 end |
#watching_writes? ⇒ Boolean
133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/lldb/watchpoint.rb', line 133 def watching_writes? raise InvalidObjectError, 'Watchpoint is not valid' unless valid? APISupport.require_feature!(:watchpoint_access_kind) result = FFI::MemoryPointer.new(:int) status = FFIBindings.lldb_watchpoint_is_watching_writes(@ptr, result) raise UnsupportedAPIError, 'Watchpoint write access is unsupported' if status == NativeStatus::UNSUPPORTED raise LLDBError, "Failed to query watchpoint write access (status=#{status})" unless status == NativeStatus::OK result.read_int != 0 end |