@@ -391,15 +391,19 @@ def tp_allow_reentry
391391 end
392392 end
393393
394- def frame_eval_core src , b
394+ def frame_eval_core src , b , binding_location : false
395395 saved_target_frames = @target_frames
396396 saved_current_frame_index = @current_frame_index
397397
398398 if b
399- f , _l = b . source_location
399+ file , lineno = b . source_location
400400
401401 tp_allow_reentry do
402- b . eval ( src , "(rdbg)/#{ f } " )
402+ if binding_location
403+ b . eval ( src , file , lineno )
404+ else
405+ b . eval ( src , "(rdbg)/#{ file } " )
406+ end
403407 end
404408 else
405409 frame_self = current_frame . self
@@ -418,7 +422,7 @@ def frame_eval_core src, b
418422 [ :return_value , "_return" ] ,
419423 ]
420424
421- def frame_eval src , re_raise : false
425+ def frame_eval src , re_raise : false , binding_location : false
422426 @success_last_eval = false
423427
424428 b = current_frame . eval_binding
@@ -427,7 +431,7 @@ def frame_eval src, re_raise: false
427431 b . local_variable_set ( name , var ) if /\% / !~ name
428432 end
429433
430- result = frame_eval_core ( src , b )
434+ result = frame_eval_core ( src , b , binding_location : binding_location )
431435
432436 @success_last_eval = true
433437 result
@@ -949,7 +953,7 @@ def wait_next_action_
949953 result = frame_eval ( eval_src )
950954 when :irb
951955 begin
952- result = frame_eval ( 'binding.irb' )
956+ result = frame_eval ( 'binding.irb' , binding_location : true )
953957 ensure
954958 # workaround: https://github.com/ruby/debug/issues/308
955959 Reline . prompt_proc = nil if defined? Reline
0 commit comments