53

Is there an option to take the stack pointer - or arrow in the debugger, backward and change the current execution line, as in visual studio.
Today I am using a "workaround" of modifying the source file. this will take me to the beginning of a method, but sometimes it is just not good enough.

oshai
  • 14,865
  • 26
  • 84
  • 140
  • possible duplicate of [Step back in Eclipse debugger](http://stackoverflow.com/questions/4331336/step-back-in-eclipse-debugger) – DocMax Nov 07 '12 at 06:44

3 Answers3

56

The feature is called 'Drop to frame' right click on any line in stack, choose 'Drop to frame' and you go back to selected method beginning. Check Eclipse help topic.

drop to frame picture

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
gertas
  • 16,869
  • 1
  • 76
  • 58
8

Sadly it is not possible to go back to a single line, the JVM does not support this. You can only jump to the start of the current function, as you propably know (Drop to frame).

Daniel
  • 27,718
  • 20
  • 89
  • 133
  • I wonder why wouldn't JVM doesn't support this? I understand that it's not that simple that just to set the instruction pointer. But it I doubt it cannot be done using some strategies to analyze the stack frame. – Csaba Toth Aug 02 '13 at 00:49
5

It's not out of beta yet, but Chronon is a promising debugger that has a "step back" feature.

ZoFreX
  • 8,812
  • 5
  • 31
  • 51
  • actually, just want to go back in lines, not changing the state of the program. – oshai Feb 01 '11 at 16:32
  • Chronon does not change the state of the program when stepping back. The debugger makes it 'seem' like the state has been changed but since the data is read from a recording and your program is not actually running, nothing really changes. You can go back to 'normal' state by stepping forward again. – pdeva Feb 03 '11 at 21:19
  • Chronon is out of beta now btw :) – pdeva Jun 09 '11 at 12:57
  • @pdeva You missed the point of what oshai said. Chronon "rewinds" the program state to a previous point in time. The goal here is to literally change the instruction pointer but leave everything else unaffected. Continuing the program from there would have the net result of executing some lines of code multiple times. – Sam Harwell Mar 22 '13 at 14:24