views:

34

answers:

1

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.

A: 

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.

uosɐſ
There are a lot of data structures that are used. Even if I could do something like that, it would take a hell lot of time to build something like this and verify it. I havent built the simulator myself. It somebody else's code which has over 50 source files. Plus, i cannot skip stages, because its basically doing line by line file reading of a very big file. the steps are small but the files are huge
cyrux
Hmm, sounds like a tough assignment
uosɐſ