Skip to content

Commit 0319744

Browse files
committed
export ThreadClient@check_bp_fulfillment_map
1 parent 98b2d31 commit 0319744

File tree

2 files changed

+16
-30
lines changed

2 files changed

+16
-30
lines changed

lib/debug/breakpoint.rb

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -326,36 +326,30 @@ def setup
326326
next if ThreadClient.current.management?
327327
next if skip_path?(tp.path)
328328

329-
if safe_eval(tp.binding, @cond)
330-
unless fulfilled_on_current_thread?
331-
set_fulfilled_on_current_thread
332-
suspend
333-
end
334-
else
335-
set_unfulfilled_on_current_thread
329+
if need_suspend? safe_eval(tp.binding, @cond)
330+
suspend
336331
end
337332
}
338333
end
339334

335+
private def need_suspend? cond_result
336+
map = ThreadClient.current.check_bp_fulfillment_map
337+
if cond_result
338+
if map[self]
339+
false
340+
else
341+
map[self] = true
342+
end
343+
else
344+
map[self] = false
345+
end
346+
end
347+
340348
def to_s
341349
s = "#{generate_label("Check")}"
342350
s += super
343351
s
344352
end
345-
346-
private
347-
348-
def fulfilled_on_current_thread?
349-
ThreadClient.current.check_bp_fulfilled?(self)
350-
end
351-
352-
def set_fulfilled_on_current_thread
353-
ThreadClient.current.set_check_bp_state(self, true)
354-
end
355-
356-
def set_unfulfilled_on_current_thread
357-
ThreadClient.current.set_check_bp_state(self, false)
358-
end
359353
end
360354

361355
class WatchIVarBreakpoint < Breakpoint

lib/debug/thread_client.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def self.current
3434
include Color
3535
include SkipPathHelper
3636

37-
attr_reader :thread, :id, :recorder
37+
attr_reader :thread, :id, :recorder, :check_bp_fulfillment_map
3838

3939
def location
4040
current_frame&.location
@@ -339,14 +339,6 @@ def step_tp iter, events = [:line, :b_return, :return]
339339
end
340340
end
341341

342-
def set_check_bp_state(bp, state)
343-
@check_bp_fulfillment_map[bp] = state
344-
end
345-
346-
def check_bp_fulfilled?(bp)
347-
@check_bp_fulfillment_map[bp]
348-
end
349-
350342
## cmd helpers
351343

352344
if TracePoint.respond_to? :allow_reentry

0 commit comments

Comments
 (0)