Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: gdb@sources.redhat.com
Subject: [reverse] A "toy" implementation of reverse execution
Date: Fri, 03 Jun 2005 19:55:00 -0000	[thread overview]
Message-ID: <42A0B5AD.1060401@redhat.com> (raw)

Hey folks,

Here's a "toy" implementation of a target that can,
to a very limited extent, act as if it's offering
reverse execution to gdb.  I hope it will be useful
for trying out ideas.  It should be useful for both
the "bookmark" approach and the "reverse-stepi" method.

What I've done is, starting from the "sample" program in RDA,
I added the ability to understand "tfind" requests, and then
added on a module that could read simplified tracepoint frames
from a file, and then serve them back to gdb.

Then I generated a trace frame file from the testsuite program
"break.c", starting at main and saving a tracepoint for every
instruction.  It only took about 157 frames.   ;-)

Now, if I feed that file to my rda-derived trace frame server,
"tfind next" becomes equivalent to "stepi", and "tfind prev"
becomes equivalent to "reverse-stepi".

With those as primatives, reverse-step turns out to be,
to first approximation at least, fairly easy:

	define reverse-si
	  tfind -
	end

	define si
	  tfind
	end

	define unstep
	  reverse-si
	  set $foo=$trace_line
	  while $foo==$trace_line
	    reverse-si
	  end
	  si
	end

As several of us speculated, the algorhythm for stepping backward
involves first taking a backstep, then establishing the line range
and stepping out of it, and finally taking one forward step.

I've created a branch and checked in my modified rda, along with
a hacked-up gdb that I'm using to help create trace frame files.
The branch is "msnyder-tracepoint-checkpoint-branch", and y'all
are welcome to play with it.  There's a README-CHECKPOINTS file.


             reply	other threads:[~2005-06-03 19:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-03 19:55 Michael Snyder [this message]
2005-06-03 20:42 ` Michael Snyder
2005-06-04  7:15 ` Soam Vasani
2005-06-06  6:00   ` Michael Snyder
2005-06-06  8:44     ` Soam Vasani
2005-06-04 23:11 ` Reversible GDB resources Dan Shearer
2005-06-09 19:32   ` Dan Shearer

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=42A0B5AD.1060401@redhat.com \
    --to=msnyder@redhat.com \
    --cc=gdb@sources.redhat.com \
    /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