Reputation: 827
I have been searching for an answer to if it's possible to backtrack when doing Java debugging. For instance if I have the code:
int x = 1
int y = 0
//Exception will happen here
int z = x/y
And if I'm hitting the exception, I would like to go back. And not just like dropping the frame, but also revert actual changes made to the Heap. Is that currently possible?
Thanks in advance.
Upvotes: 1
Views: 1266
Reputation: 18458
There is tool called Chronon Time Travelling Debugger
It claims...
Overview
The Chronon Time Travelling Debugger allows you to playback Chronon recordings and easily find root cause of defects. It is specifically built from the ground up to allow debugging of long running programs that run for days/months and are highly multithreaded.
The debugger plugs seamlessly into Eclipse adapting itself naturally to your workflow. You can also use the Eclipse integration of the Chronon Debugger to easily record programs on your development machines from within Eclipse.
Upvotes: 2
Reputation: 12819
It's not possible unless you implement some kind of undo stack, which, depending on what you do, could be extreme over-engineering. If you make your heap objects unmutable, and only change pointers visible to the caller once everything has completed without throwing an exception, then you'd get a relatively good approximation of the behavior you want, but it'll be hard to make ti thread-safe without using excessive synchronization, and could generate tons of boilerplate code that doesn't add a lot of value to the processes...
Upvotes: 1