ruby-debug / debase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Step over/next" command often performs "continue" in ruby 2.6

rockorequin opened this issue · comments

With ruby 2.6.3 and ruby-debug-ide (I use Netbeans 11), I find that the 'Step Over' command often just continues until the next breakpoint. 'Step Over' works fine in ruby 2.5.5.

These issues might be related:
deivid-rodriguez/byebug#550
googleapis/google-cloud-ruby#3022

Quoting from the latter:

Ruby 2.6 changed the behavior of TracePoint with regard to line tracing at the beginning of a method. The Debugger code sometimes responds to a call tracepoint by enabling a line tracepoint. In Ruby < 2.6, this works and allows the first line in the method to trigger the line tracepoint. However, in Ruby >= 2.6, the first line in the method does not trigger the new tracepoint. (This happens only if the line tracepoint was only activated inside the call tracepoint's callback. If the line tracepoint was active previously, then it properly triggers on the method's first line.)

I don't know if this might be related to the TracePoint changes listed here: https://rubyreferences.github.io/rubychanges/2.6.html#tracepoint-improvements

@rockorequin Could you provide a sample script to reproduce the problem?

This script shows the problem for me: with 2.6.3p62, if I put a breakpoint on the line "k = DateTime.parse..." line and then do a 'next' when it hits that line, instead of stopping on the "puts" line, the code stops at ruby-debug-ide.rb#101, ie the line saying: if bt && !bt.is_a?(SystemExit).

require 'rails'

class Test
  def a
    k = DateTime.parse('2019-1-1').to_date.end_of_day
    puts "Hello!"
    k + 1.day
  end
end

j = Test.new.a

@ViugiNick Did you have any luck reproducing this?

Fwiw, I tried ruby 2.7.0-preview1 and it seems that it doesn't have this problem, so maybe it's a bug in the underlying ruby-2.6 tracepoint API.

@rockorequin looks like you are right. Are you ok with using 2.7.* or should I try to fix this for 2.6.*?

@ViugiNick Personally I'm fine with using 2.7 for now or I can go back to 2.5 if 2.7 breaks something down the line. Perhaps it could be noted as a known issue with 2.6 in the readme?

I think the byebug maintainer figured out the issue with 2.6, and 2.6.4 might fix:

deivid-rodriguez/byebug#550 (comment)

I can confirm. I just upgraded from 2.6.3 to 2.6.5 and the problem with debase and "step over" is gone. I think this issue can be closed :)