用于保存正在运行的程序的状态并稍后恢复的程序/IDE

发布于 2024-09-19 06:28:47 字数 266 浏览 4 评论 0原文

我有一个用 C++ 编写的模拟器,它读取文件并逐行处理它。这是一个耗时的过程。我主要遇到朗姆酒时间错误,即程序在 15-20 分钟后崩溃。我开始调试,程序花费相同的时间到达我设置的断点。我检查了一些变量并逐步执行代码以查看发生了什么,进行一些更改并再次重新启动我的程序。大多数时候,在进行实际代码更改之前,我必须多次调试程序。每次执行到断点都要等待 15 分钟,这是浪费。有没有一种方法可以将程序状态保存到特定断点,然后从那里开始运行/调试。

我确信我不是唯一一个遇到这个问题的人。必须有一个解决方案。

I have a simulator written in C++ which reads a file and processes it line by line. This is a time consuming process. I mostly run into rum time errors where the program crashes after 15-20 mins. I start debugging and the program takes the same amount of time to hit the break point I set . I examine a few variables and step through the code to see whats happening , make some changes and restart my program again. Most of the times, I have to debug the program multiple times before I make the actual code changes. Waiting for 15 mins every time for the execution to hit the breakpoint is wasteful. Is there a way I can save the program state a particular breakpoint and then later just start running/debugging from there.

I am sure I am not the only one who must have faced this problem. There must be a solution to this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

夜未央樱花落 2024-09-26 06:28:47

我认为最好的方法是针对具体情况。根据您的情况,创建某种格式来保存进度并在进度时将其保存/更新到文件。然后,在重新启动时,一些逻辑用于确定是恢复还是重新启动。

另外,将程序分成几个可以伪造或跳过的阶段?

否则,将需要在“安全恢复点”进行低效且甚至可能的内存/注册表转储并重新加载。我认为最接近的实现方式是使用“快照”的整个环境虚拟化(VMWare Workstation、Windows Virtual PC?),这可能是一个选项,但速度几乎一样慢。

The best way, I think, is situation specific. In your case, create some format in which to hold your progress and save it/update it to a file as you progress. Then, upon restart, some logic for determining whether to resume or restart.

Also, break up the program into stages that you can fake or skip?

To do otherwise would require an inefficient and doubtfully even possible memory/registry dump at "safe recovery points" and reload. I think the closest thing implemented for that is whole-environment Virtualization with "snapshots" (VMWare Workstation, Windows Virtual PC?) That could be an option, but it would be almost as slow.

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