How to do bidirectional or reverse debugging of programs?
Asked Answered
C

11

16

Has anyone actually used a reversable debugger? The only product that Google turns up is UndoDB. It is for apparently for Linux only.

Ceilidh answered 6/2, 2009 at 23:11 Comment(1)
Does this answer your question? How to go to the previous line in GDB?Misunderstanding
T
8

The latest gdb version 7.0 (released this week) supports reverse debugging on a number of platforms (eg. native i386 and x86_64 linux, VMware workstation, UndoDB, and Simics simulators from Virtutech). ftp://ftp.gnu.org/pub/gdb

It works with the latest preview / pre-release of VMware workstation 7.0, which also supports reverse debugging of MSWindows guests using Visual Studio debugger. Get a free trial download of workstation 7.0 at http://communities.vmware.com/community/beta/workstation, and find some helpful usage tips here at http://communities.vmware.com/docs/DOC-10714

Truly answered 8/10, 2009 at 3:43 Comment(0)
T
6

The newly released gdb-7.0 includes reverse debugging capability for native linux x86 and x86_64. You can debug any linux program as usual, turn on the "recording" feature, and from that point on, if you step forward too far, you can step backward or reverse-continue to a breakpoint.

Truly answered 9/10, 2009 at 18:48 Comment(0)
O
6

As a amusing historical note, EXDAMS implemented a post-mortem reverse debugging back in the late 60s for MULTICS.

Overissue answered 6/11, 2011 at 22:16 Comment(0)
S
4

The word your looking for may be "Omniscient Debugging".

Here is one: http://www.lambdacs.com/debugger/

The UndoDB page has some links to (expensive) commercial debuggers.

Sothena answered 6/2, 2009 at 23:23 Comment(0)
T
4

Yes, I have used Virtutech Simics with reverse since 2005. It is incredibly useful, and does make most bugs very simple to fix. Especially those related to timing and race conditions, and multicore/thread "heisenbugs".

See http://jakob.engbloms.se/archives/1547, http://jakob.engbloms.se/archives/1554, and http://jakob.engbloms.se/archives/1564 take inventory of most known reverse debugger attempts to date.

Tourcoing answered 20/10, 2009 at 19:25 Comment(0)
S
4

Although this question is old, remains an interesting topic, so I thought I'd post an updated answer. My thesis, Combining reverse debugging and live programming towards visual thinking in computer programming, covers some of the historical approaches, and explains the difference between omniscient debugging and true reverse debugging:

The computer, having forward-executed the program up to some point, should really be able to provide us with information about it. Such an improvement is possible, and is found in what are called omniscient debuggers. They are usually classified as reverse debuggers, although they might more accurately be described as "history logging" debuggers, as they merely record information during execution to view or query later, rather than allow the programmer to actually step backwards in time in an executing program. "Omniscient" comes from the fact that the entire state history of the program, having been recorded, is available to the debugger after execution. There is then no need to rerun the program, and no need for manual code instrumentation.

Software-based omniscient debugging started with the 1969 EXDAMS system where it was called "debug-time history-playback". The GNU debugger, GDB, has supported omniscient debugging since 2009, with its 'process record and replay' feature. TotalView, UndoDB and Chronon appear to be the best omniscient debuggers currently available, but are commercial systems. TOD, for Java, appears to be the best open-source alternative, which makes use of partial deterministic replay, as well as partial trace capturing and a distributed database to enable the recording of the large volumes of information involved.

Debuggers that do not merely allow navigation of a recording, but are actually able to step backwards in execution time, also exist. They can more accurately be described as back-in-time, time-travel, bidirectional or reverse debuggers.

The first such system was the 1981 COPE prototype ...

Summand answered 8/6, 2015 at 11:43 Comment(3)
My problem with gdb is that it does not allow reverse debugging for multithreaded applications. A non-starter here.Ceilidh
@casualcoder, I don't know gdb well, but it looks like it does allow it, see the answer hereSummand
Well, only posted 4 years ago. Multithreaded apps are supported!Ceilidh
L
3

VS 2010 is supposed to have something like this, I think.

Lamkin answered 6/2, 2009 at 23:39 Comment(0)
V
2

You can consider using VMware's Replay Debugging, available in the latest release of VMware Workstation, e.g. see http://www.replaydebugging.com/2008/08/vmware-workstation-65-reverse-and.html. You can download a trial at http://www.vmware.com/products/ws/ and it works with Visual Studio.

(Disclaimer: I work for VMware though not on this product.)

Vlissingen answered 10/2, 2009 at 13:53 Comment(0)
G
2

Yes, I've used it back in the 90th.. The Watcom C Debugger (understood FORTRAN and most other languages as well) had the option to let you step back and forward in time.

It's great, but not a big new thing...

Greta answered 9/10, 2009 at 18:50 Comment(0)
M
2

Mozilla rr open source trace based reverse debugging

https://github.com/mozilla/rr

It is similar to UndoDB, but free and open source.

Only works on Linux x86 unfortunately, because such tools require advanced OS features to work efficiently.

Here is a minimal example of rr in action: How to go to the previous line in GDB?

Misunderstanding answered 28/4, 2018 at 7:38 Comment(0)
P
1

I am using UndoDB on Linux instead of plain gdb for every debugging session. Reverse debugging is very useful and speeds up debugging significantly. You can start debugging from the symptom of the problem (e.g. assertion failure or some wrong message is printed) and debug backwards in time, looking for the root cause of the problem.

Protolanguage answered 9/6, 2017 at 10:12 Comment(4)
Gdb has process record for reverse debugging for several years. There is only problem in recent Debian/Ubuntu/glibc with recent AVX2-capable CPUs that glibc always wants to use AVX2 for string operations and gdb process record has no support of emulating vex-prefixed commands. There is my kludge 1 bit binary patch to disable AVX2 usage in ld.so: https://mcmap.net/q/16413/-gdb-reverse-debugging-avx2/… #42451992Susie
Thank you and your company for cores and tools, and welcome to the site! And for wikipedia contributions too.Susie
Have we come full circle? The question opened by mentioning UndoDB. One complaint about reverse debugging in gdb is that the history log is quite short. One is pestered by prompts to restart logging. Will have to try the latest gdb though, things might have changed. Hopefully.Ceilidh
I have tried gdb in the past, but it was too slow and too buggy. I am not sure anything changed since then. The recent promising development is 'rr' tool, developed to debug Firefox (see rr-project.org). I didn't try it myself so.Protolanguage

© 2022 - 2024 — McMap. All rights reserved.