From 23b51dbe1ac6ff5dd84ea7112ed5f817c4349a62 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Wed, 4 Jun 2025 20:14:47 +0900 Subject: [PATCH] Explicitly skip TracePoint events in internal code In Ruby 3.5, `Kernel#caller_location` will not include `` frames. https://github.com/ruby/ruby/pull/13238 To skip the internal frames, explicitly check if `TracePoint#path` is a internal path or not. --- lib/debug/thread_client.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/debug/thread_client.rb b/lib/debug/thread_client.rb index 259d69fcc..0e1fa42a1 100644 --- a/lib/debug/thread_client.rb +++ b/lib/debug/thread_client.rb @@ -350,6 +350,7 @@ def step_tp iter, events = [:line, :b_return, :return] next if tp.path.start_with?(__dir__) next if tp.path.start_with?('') next unless File.exist?(tp.path) if CONFIG[:skip_nosrc] + next if skip_internal_path?(tp.path) loc = caller_locations(1, 1).first next if skip_location?(loc) next if iter && (iter -= 1) > 0 @@ -369,6 +370,7 @@ def step_tp iter, events = [:line, :b_return, :return] next if tp.path.start_with?(__dir__) next if tp.path.start_with?('') next unless File.exist?(tp.path) if CONFIG[:skip_nosrc] + next if skip_internal_path?(tp.path) loc = caller_locations(1, 1).first next if skip_location?(loc) next if iter && (iter -= 1) > 0