|Non-Confidential||PDF version||ARM DUI0446Z|
|Home > Introduction to DS-5 Debugger > Overview: Linux application rewind|
Application rewind is a DS-5 Debugger feature that allows you to debug backwards as well as forwards, through the execution of Linux applications.
Using this feature, you can both run and step, including hitting breakpoints and watchpoints. You can also view the contents of recorded memory, registers, and variables at any point in your application's execution. Debugging backwards, can cut down the time it takes to find a bug from hours to minutes since you do not have to recreate the same steps that caused a crash, which can be difficult in the case of non-deterministic bugs.
For errors as simple as an uninitialized or out-of-range array index, or application crashes caused by null pointers, the application rewind feature can prove extremely useful, especially since a crash might not even occur in the same source file as the one with the bug.
Trace is an extremely effective tool for debugging system issues as it can record a complete picture of execution and is non-intrusive. Bare-metal or kernel debugging uses trace for this purpose by recording instructions that are executed on a processor over a period of time.
However, from the debugger's view, it is not practical to use trace on Linux applications, because:
printf debugging techniques present a different set of challenges. It
is difficult to know how often you need to stage
and the statement might have a "probe-effect" on your code. Also, rebuilding an
application every time an annotation is added can be time-consuming.
For these reasons, when debugging user-space applications over TCP/IP or USB, a different approach is required.
Application rewind debug sessions are launched from the debug configurations panel and can be either controlled from the graphical debugger or the command line debugger.
Application rewind works in a similar way to standard debugging of Linux
applications using a TCP/IP or USB connection, though instead of using
gdbserver, it uses a custom debug agent. This custom
debug agent records a copy-on-write snapshot of the application being debugged,
along with non-deterministic inputs. This allows the debugger to reconstruct a
complete picture of program execution.
Once a bug is recorded, replay is deterministic, with exactly the same behavior observed with each rewind and play.