Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct binding in debug mode #1007

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tompng
Copy link
Member

@tompng tompng commented Sep 21, 2024

Debug evaluates code in frame.eval_binding, not frame.binding

irb(main):001> debug
irb:rdbg(main):002> tc = DEBUGGER__::SESSION.instance_variable_get(:@tc)
#<DBG:TC 1:running@a.rb:1:in `<main>'>
irb:rdbg(main):003> foobar = 1
1
irb:rdbg(main):004> tc.current_frame.binding.local_variables
[:_]
irb:rdbg(main):005> tc.current_frame.eval_binding.local_variables
[:foobar, :tc, :_]

Fixes this command and colorization bug. (left: master branch, right: this pull request)
debug_binding_before_after

eval_binding is added in debug-1.0.0.rc1 ruby/debug@4c87393,

In debug command, IRB's context was using wrong binding.
Some code colorization, command detection failed because binding.local_variable returned wrong value.
@tompng tompng added the bug Something isn't working label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

1 participant