13

In ruby-debug, the next command takes you to the next line of code to be executed, regardless of whether that line is in your own code, or in the rails framework, or in a gem.

Is there some way to force ruby-debug (1.9) to jump to the next line that it encounters in your code without stopping at all the other lines it must execute along the way?

steven_noble
  • 4,133
  • 10
  • 44
  • 77
  • Can you just manually set a breakpoint for the next line and continue on to the next breakpoint? – d11wtq Jul 05 '11 at 13:27

1 Answers1

4

Yes, there is.

You can use break linenum to manually set a breakpoint on an arbitrary line number (for instance the next one), and then type c to continue to the next breakpoint.

The documentation for ruby-debug breakpoints would probably help you a bit as well.

Frost
  • 11,121
  • 3
  • 37
  • 44
  • ...but I don't think there is a way to do the equivalent of Eclipse's java debuggers "step over" functionality. – Frost Jul 05 '11 at 15:34
  • Thanks. I'll see if I can somehow use break linenum programmatically to set a breakpoint for every line. – steven_noble Jul 05 '11 at 21:43
  • Hmmm... I was hoping that (1..100).each { |l| break l } would do the trick. Might just create a TextMate script to add a break before each line in the file and another to remove it. – steven_noble Jul 05 '11 at 21:50
  • 2
    Yeah, that's crazy! Perl debugger is so much awesomer. You can just press 'n' and it will step over the next line, even if it is a subroutine. Nearly every debugger let's you skip over the line without descending into the method. – Chloe Apr 26 '14 at 03:18