Skip to content

Fix stack frame filtering to use exact path comparison#1152

Closed
Copilot wants to merge 3 commits into
DAP-server-debuggerfrom
copilot/sub-pr-1145-83ac93fa-61b3-4ced-b59b-9a4f18250ab2
Closed

Fix stack frame filtering to use exact path comparison#1152
Copilot wants to merge 3 commits into
DAP-server-debuggerfrom
copilot/sub-pr-1145-83ac93fa-61b3-4ced-b59b-9a4f18250ab2

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 14, 2026

The update_stack_frames method filtered debugger frames using path.include?(__FILE__), which incorrectly filters application code when file paths contain the debugger path as a substring.

Changes:

  • Replace substring match with exact path comparison: path == @debugger_file
  • Cache File.expand_path(__FILE__) as instance variable to avoid repeated filesystem calls

Before:

locations.each do |loc|
  path = File.expand_path(loc.path)
  next if path.include?(__FILE__)  # Matches "/app/debugger.rb_utils.rb"
  filtered << loc
end

After:

# In initialize
@debugger_file = File.expand_path(__FILE__)

# In update_stack_frames
locations.each do |loc|
  path = File.expand_path(loc.path)
  next if path == @debugger_file  # Only matches exact debugger file
  filtered << loc
end

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 14, 2026 20:59
- Changed from path.include?(__FILE__) to path == debugger_file
- This prevents incorrectly filtering out application code that might have similar paths
- More precise and robust filtering of debugger internal frames

Co-authored-by: vmusulainen <143790+vmusulainen@users.noreply.github.com>
- Move debugger file path to instance variable initialized once in constructor
- Improve comment to explain specific scenario (substring matching issue)
- Avoids repeated expensive File.expand_path calls on every stack frame update

Co-authored-by: vmusulainen <143790+vmusulainen@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor DAP server based on review feedback Fix stack frame filtering to use exact path comparison Jan 14, 2026
Copilot AI requested a review from vmusulainen January 14, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants