Java 调试中的回溯
我一直在寻找Java调试时是否可以回溯的答案。例如,如果我有代码:
int x = 1
int y = 0
//Exception will happen here
int z = x/y
如果我遇到异常,我想返回。 不仅像删除帧一样,还恢复对堆所做的实际更改。 目前可能吗?
提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有一个名为 Chronon 时间旅行调试器 的工具,
它声称...
There is tool called Chronon Time Travelling Debugger
It claims...
除非您实现某种撤消堆栈,否则这是不可能的,这取决于您所做的事情,可能是极端的过度设计。如果您使堆对象不可变,并且只有在一切完成后才更改调用者可见的指针而不引发异常,那么您将获得所需行为的相对较好的近似值,但很难使 ti 线程-安全,无需使用过多的同步,并且可能生成大量的样板代码,这些代码不会给流程增加很多价值......
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...
您是否尝试过Omniscient 调试器?
Have you tried Omniscient debugger?