From: David McQuillan <dmcq@fano.co.uk>
To: gdb@sourceware.org
Subject: reverse debugging implementation
Date: Sun, 22 Aug 2010 13:39:00 -0000 [thread overview]
Message-ID: <4C712882.9040700@fano.co.uk> (raw)
Hi,
I see gdb now supports reverse debugging. This is something I
implemented for myself a number of years ago with my own simulators when
I was working on testing some compilers and other stuff. That all died a
long time ago but some of the ideas from it might be useful if you
haven't done them already.
Firstly as far as I can see gdb saves all the state change for every
instruction. This is unnecessary, all you have to do is save the state
of the cpu every few thousand instructions and for each instruction only
save the state of memory locations before they are changed. Going back
one instruction then involves rolling back the memory changes, the
registers are set up then go forward n-1 instruction to go back one.
I also had debug instructions to mark the current spot, then one could
go between a few different different states easily to check on the
difference.
I think practically everything else I had about what to do about library
calls is there - I intercepted system calls so they weren't redone just
the old results returned so I had to save both before and after looks.
Special work had to be done about allocating and freeing space and I
only had serial files and no special device access so you can see I had
a fairly straightforward environment.
If you used virtual memory tricks it might be possible to save the state
of the memory that way instead of even taking before looks. It would
slow going backwards a bit but I never noticed any particular delay
going back an instruction and machines have sped up and there's lots
more memory nowadays.
Cheers,
David McQuillan
next reply other threads:[~2010-08-22 13:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-22 13:39 David McQuillan [this message]
2010-08-25 6:30 ` paawan oza
2010-08-25 18:55 ` David McQuillan
2010-09-02 6:48 ` Engblom, Jakob
2010-09-02 9:44 ` paawan oza
2010-09-02 12:52 ` Engblom, Jakob
2010-08-25 20:43 ` reverse debugging implementation + commands David McQuillan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C712882.9040700@fano.co.uk \
--to=dmcq@fano.co.uk \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox