This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [discuss] Support for reverse-execution


On Fri, May 20, 2005 at 01:37:48PM +0200, Andreas Schwab wrote:
> The beginning or any part of the source line?  While the latter is easy to
> determine (just step until the source line changes), the former is not
> very well defined, since the code for a source line can be intermixed with
> code from other source lines.  On the other hand, just stepping until the
> source line changes is not very useful, since in extreme case you'll just
> step back a single insn if the previous command was a forward step and you
> won't really undo much of this step.

I suspect that the best we can do is back to the beginning of the
previous fragment of a source line; step backwards until your PC
matches the start of an entry in the line table.

We need a coherent story for presenting fragmented lines to the user,
but we don't have one - in either direction.  That'll be as good as
what we do going forwards.

Of course it's possible that you enter the previous line in the middle:

=
	line 1
label:	line 1 some more
	line 1 a bit more
=
PC:	line 2
	line 2

I think the way to do this is to take advantage of the fact that
reversible targets are generally (always? too early to tell perhaps)
going to be repeatable.  We can single-step backwards once, enter line
1, single step backwards again, still in line 1, single-step backwards
again, we've gone too far, single-step forwards.  Or, we could use a
temporary bookmark.  Single-step backwards once, enter line 1, place
bookmark, single-step backwards again, good, update bookmark.  Again,
oops we're somewhere else, jump to bookmark and report a stop at label.

Or implement both in case some target supports reverse execution
without bookmarks.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]