How to step back in Eclipse debugger?

后端 未结 6 1403
暖寄归人
暖寄归人 2020-11-27 09:25

Is it possible to do reverse execution in Eclipse debugger? The current project I\'m working on requires a minimum of 5 seconds to read and initialize data from a file befor

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 10:12

    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: Java Interactive Visualization Environment
    • Chronon: A “flight data recorder” for Java programs
    • Diver (discontinued): Dynamic Interactive Views For Reverse Engineering
    • Halik: Only for IntelliJ for now, but porting to Eclipse is mentioned on the roadmap.

    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.

提交回复
热议问题