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 binding's location on irb command #804

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/debug/thread_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -391,15 +391,19 @@ def tp_allow_reentry
end
end

def frame_eval_core src, b
def frame_eval_core src, b, binding_location: false
saved_target_frames = @target_frames
saved_current_frame_index = @current_frame_index

if b
f, _l = b.source_location
file, lineno = b.source_location

tp_allow_reentry do
b.eval(src, "(rdbg)/#{f}")
if binding_location
b.eval(src, file, lineno)
else
b.eval(src, "(rdbg)/#{file}")
end
end
else
frame_self = current_frame.self
Expand All @@ -418,7 +422,7 @@ def frame_eval_core src, b
[:return_value, "_return"],
]

def frame_eval src, re_raise: false
def frame_eval src, re_raise: false, binding_location: false
@success_last_eval = false

b = current_frame.eval_binding
Expand All @@ -427,7 +431,7 @@ def frame_eval src, re_raise: false
b.local_variable_set(name, var) if /\%/ !~ name
end

result = frame_eval_core(src, b)
result = frame_eval_core(src, b, binding_location: binding_location)

@success_last_eval = true
result
Expand Down Expand Up @@ -949,7 +953,7 @@ def wait_next_action_
result = frame_eval(eval_src)
when :irb
begin
result = frame_eval('binding.irb')
result = frame_eval('binding.irb', binding_location: true)
ensure
# workaround: https://github.com/ruby/debug/issues/308
Reline.prompt_proc = nil if defined? Reline
Expand Down