Differences between revisions 32 and 33
Revision 32 as of 2014-04-04 18:24:24
Size: 2758
Editor: StanShebs
Comment:
Revision 33 as of 2014-04-09 03:57:47
Size: 315
Editor: host36
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Reverse Debugging with GDB =

Beginning with the 7.0 release in September 2009, gdb now includes support for a whole new way of debugging
called "reverse debugging" -- meaning that gdb can allow you to "step" or "continue" your program backward
in "time", reverting it to an earlier execution state.

Reverse debugging is only supported for a limited (but growing) number of gdb targets, including:
 * Certain remote targets including the Simics and SID simulators, and "Undo-db"
 * The [[ProcessRecord | Process Record and Replay]] target for native linux.


Anyone who has used a debugger has probably had the experience of
suddenly realizing that you have accidentally gone too far -- the
event you were looking for has passed, and you missed seeing it. With
reverse debugging, instead of starting the program over from the
beginning and repeating your entire (possibly lengthy) debugging
session, you can simply set a breakpoint at an earlier point in the
program, and "reverse-continue", causing the program to back up and
"undo itself" to that earlier point, from which you can proceed
forward again. Or, you can "reverse-step" and "reverse-next" to
back up one program statement at a time (just like normal "step" and
"next" take you forward by one program statement).

== Reverse Debugging Commands ==

Assuming you are using one of the gdb targets that supports reverse debugging
(such as [[ProcessRecord | Process Record]] for Linux), you can use the following commands:

 * reverse-continue

Run the program backward until it hits a stop event (such as a breakpoint, watchpoint, or exception).

 * reverse-step

Run the program backward until the beginning of the previously-executed source line.

 * reverse-stepi

Run the program backward for exactly one machine instruction.

 * reverse-next

Like "next" in reverse -- function calls are stepped over instead of into (in reverse).

 * reverse-nexti

Like "nexti" in reverse -- executes one machine instruction (backward), unles that
instruction is a return from a function call, in which case the entire function will
be executed in reverse.

 * reverse-finish

By analogy to the "finish" command, "reverse-finish" executes the current function
in reverse, until the execution reaches the calling function, then stops.

 * set exec-direction [forward | reverse]

A modal command: when exec-direction is set to "reverse", all ordinary execution commands
such as "step" and "continue" will cause the program being debugged to run in reverse.

== Testing ==

At the time of this writing, the gdb tests for reverse debugging are only supported
for the Process Record target (see [[ProcessRecord#Testing]]).

----
OngoingWork
I'm Shantell and I live with my husband and our 3 children in Nesbru, in the south part. My hobbies are Airsoft, Antiquities and Model Aircraft Hobbies.<<BR>>
<<BR>>
Also visit my homepage :: furniture repair vrbo nyc upper east side ([[http://www.ltf3.org/users.php?mode=profile&uid=63951|find out here now]])

I'm Shantell and I live with my husband and our 3 children in Nesbru, in the south part. My hobbies are Airsoft, Antiquities and Model Aircraft Hobbies.

Also visit my homepage :: furniture repair vrbo nyc upper east side (find out here now)

None: ReverseDebug (last edited 2014-04-09 12:49:23 by brobecke)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.