Accepted answer

you can use eclipse's drop to frame command to re-enter the current method from the top. but it won't unroll any state changes that have happened, so it may not work depending on the sort of method you're in.

another really cool tool that actually does let you step back and forward in time is the omniscient debugger. it works by instrumenting classes as they're loaded in the classloader, so it can record everything that your code does. it can do very cool things, like answer "when, where, and why was this field assigned its current value?". the ui is rather clunky, and it can have a hard time handling large code bases, but for some cases it can really save a lot of time.

update: chronon provides a commercial product that it describes as a "dvr for java", which appears to do a lot of the same things as the odb.


the question doesn't specify an eclipse language, and many of the answers assume java.

if using c++ and gcc with the gdb debugger, eclipse has run->move to line which does the job and functions like the visual studio set next statement. in this case, eclipse is using the capability that is in gdb.

if using java, i'm not aware of a way to it with eclipse or netbeans, although other answers have suggested plugins. eclipse does have the "drop to frame" command which works for java in my version (juno sr1). if i modify and save code within a function in debug mode, the execution line automatically moves to the top of the current function and i can continue from there. not the same as specifying the line, but it is something.


i was looking for this feature in eclipse too. i know the visual studio can do that. actually you can drag the current line marker and drop anywhere back in code. i'm not pretty sure if the changes to variables can be undone. but it is still very useful even so and saves lots of time. i've been waiting for this in eclipse for a very long.


i am biased, but chronon does exactly what you are looking for.

drop to frame isnt exactly stepping back, since if the method has changed anything on the heap it wont be reverted.


yes, eclipse cdt has support of historical debugger feature.

open debug configuration -> debugger -> enable reverse debugging at startup .

than you can press shift+f5 or shift+f6 for step back like f5 or f6 for step forward.


beyond what's been mentioned in earlier answers - i.e. eclipse's drop to frame feature in the debug view, which restarts debugging earlier in the stack frame (but does not revert global/static data) and omniscient debugger, which is a bit raw and not so much evolving - there are a few eclipse-based tools that could be used to "go back" in (run)time:

jive extends eclipse java debugger with the ability to record the program states. the jive perspective provides some useful uml diagrams that are updated while the program is running. these diagrams provide an overview of the state of the application (object diagram) and of the stack trace (sequence diagram). you can query the memorized trace and step back and forward in time and see the corresponding diagrams.

diver only records method calls and does not really record program states like jive. every method call event is stored for later retrieval and analysis. it extends the java run and debug configurations mainly to specify filters. trace can be paused/resumed/filtered at runtime. once recorded, the diver perspective can display it in an interactive sequence diagram.

jive and diver are open source projects issued from academic research. as of november 2012 both projects are active.

chronon is a commercial product, but they have free licenses for students and open source projects. from what's being claimed on their website it's probably the most comprehensive recorder since it's able to replay the recorded history, step back and forth, allowing as they say time traveling debugging. also eclipse isn't needed for recording.

all of these plugin are quite greedy in resources so it's best to have a good spec machine and use their filter feature. a definite requirement to run them successfully is to extend the heap space in eclipse.ini.

in my case i've tried to use jive and diver to debug an xml parsing program but always ended up freezing eclipse due to lack of resources. diver could be tricky to run on linux 64bit, it works on ubuntu 32bit and possibly other 32bit distros using these tips. diver works on windows, better yet on a windows 64bit + 64bit jvm otherwise you will be limited to a maximum heap space of 1.3-1.6gb on 32bit windows. jive works great on my linux 64bit, and seems to work fine on other platforms.

Related Query

More Query from same tag