How ReplayEngine Works
ReplayEngine lets you move backward in your program. To do this, it saves state information as your program executes. This information includes the order in which your program executes as well as changes to its data. When ReplayEngine is saving state information, it is in its record mode.
The saved state information is the program’s execution history. You can save the execution history at any time and then reload the recording when debugging the executable in a subsequent session. See Saving and Loading the Execution History below.
Using a ReplayEngine command shifts ReplayEngine into its replay mode. In this mode, you can move to any previously executed statement. When you move to one of these statements, ReplayEngine displays its saved state information. The information you see in replay mode is identical to the information that you saw in record mode.
Most debugging commands work the same in replay mode as they do in record mode. Commands such as diving on a variable or setting a breakpoint work as you would expect them to. The debugging commands that do not work are those that change or alter a recorded state. Typically, these are commands that:
*Change a variable’s value.
*Call functions that alter memory.
*Run threads asynchronously.
If your program calls a routine that displays information, the routine will not display this information. For example, suppose your program calls printf(). When the printf() is executed in record mode, it writes text. However, when the printf() is replayed, this text is not rewritten. Similarly, if your program unlinks a file in record mode; the file will not be linked before the unlink statement when you are in replay mode.
When executing in record mode, your program runs more slowly than if you were not using ReplayEngine. Usually, you will not notice the extra execution time. However, when you are in replay mode, the computational overhead required to recreate the program’s state may be noticeable. When it needs extra time, ReplayEngine displays a dialog box that allows you to cancel the operation.
You can save a ReplayEngine recording to a Replay recording file and later reload it into TotalView for further analysis. These Replay recording files are then loaded into TotalView so the execution of your program can easily be examined and understood.