Skip to content

Commit b0ca87e

Browse files
mameko1
authored andcommitted
Explicitly skip TracePoint events in internal code
In Ruby 3.5, `Kernel#caller_location` will not include `<internal:xxx>` frames. ruby/ruby#13238 To skip the internal frames, explicitly check if `TracePoint#path` is a internal path or not.
1 parent dbcddaa commit b0ca87e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/debug/thread_client.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ def step_tp iter, events = [:line, :b_return, :return]
350350
next if tp.path.start_with?(__dir__)
351351
next if tp.path.start_with?('<internal:trace_point>')
352352
next unless File.exist?(tp.path) if CONFIG[:skip_nosrc]
353+
next if skip_internal_path?(tp.path)
353354
loc = caller_locations(1, 1).first
354355
next if skip_location?(loc)
355356
next if iter && (iter -= 1) > 0
@@ -369,6 +370,7 @@ def step_tp iter, events = [:line, :b_return, :return]
369370
next if tp.path.start_with?(__dir__)
370371
next if tp.path.start_with?('<internal:trace_point>')
371372
next unless File.exist?(tp.path) if CONFIG[:skip_nosrc]
373+
next if skip_internal_path?(tp.path)
372374
loc = caller_locations(1, 1).first
373375
next if skip_location?(loc)
374376
next if iter && (iter -= 1) > 0

0 commit comments

Comments
 (0)