Java 调试中的回溯

发布于 2024-12-24 16:03:56 字数 194 浏览 1 评论 0原文

我一直在寻找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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

べ繥欢鉨o。 2024-12-31 16:03:56

有一个名为 Chronon 时间旅行调试器 的工具,

它声称...

概述

Chronon 时间旅行调试器允许您播放 Chronon
记录并轻松找到缺陷的根本原因。它具体是
从头开始构建,以允许调试长时间运行的程序
运行数天/数月并且高度多线程。

调试器无缝插入 Eclipse,自然地适应自身
到您的工作流程。您还可以使用 Eclipse 集成
Chronon 调试器可轻松记录开发过程中的程序
来自 Eclipse 内的机器。

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.

2024-12-31 16:03:56

除非您实现某种撤消堆栈,否则这是不可能的,这取决于您所做的事情,可能是极端的过度设计。如果您使堆对象不可变,并且只有在一切完成后才更改调用者可见的指针而不引发异常,那么您将获得所需行为的相对较好的近似值,但很难使 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...

空宴 2024-12-31 16:03:56

您是否尝试过Omniscient 调试器

Have you tried Omniscient debugger?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文