Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* reverse-next doing repeated reverse-stepi's ?
@ 2009-12-23 17:02 Julian Smith
  2009-12-23 18:15 ` Michael Snyder
  0 siblings, 1 reply; 4+ messages in thread
From: Julian Smith @ 2009-12-23 17:02 UTC (permalink / raw)
  To: gdb

I've been trying out reverse-next with UndoDB as a remote debug server,
and it looks like reverse-next works by doing repeated
`bs' (reverse-stepi) commands.

I was expecting it to set breakpoints and do `bc' (reverse-continue)
commands, by analogy with normal forwards step etc.

Am i doing something wrong here ? Or is this the expected behaviour ?

Thanks,

- Julian

-- 
http://undo-software.com/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: reverse-next doing repeated reverse-stepi's ?
  2009-12-23 17:02 reverse-next doing repeated reverse-stepi's ? Julian Smith
@ 2009-12-23 18:15 ` Michael Snyder
  2009-12-24 14:08   ` Greg Law
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2009-12-23 18:15 UTC (permalink / raw)
  To: Julian Smith; +Cc: gdb

Julian Smith wrote:
> I've been trying out reverse-next with UndoDB as a remote debug server,
> and it looks like reverse-next works by doing repeated
> `bs' (reverse-stepi) commands.
> 
> I was expecting it to set breakpoints and do `bc' (reverse-continue)
> commands, by analogy with normal forwards step etc.
> 
> Am i doing something wrong here ? Or is this the expected behaviour ?

Short answer: this is expected behavior.

Forward-next works the same way, in general.
Both forward-next and reverse-next will set breakpoints
under some circumstances, but will often work by
singlestepping.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: reverse-next doing repeated reverse-stepi's ?
  2009-12-23 18:15 ` Michael Snyder
@ 2009-12-24 14:08   ` Greg Law
  2009-12-24 18:35     ` Michael Snyder
  0 siblings, 1 reply; 4+ messages in thread
From: Greg Law @ 2009-12-24 14:08 UTC (permalink / raw)
  To: Michael Snyder; +Cc: Julian Smith, gdb

Michael Snyder wrote:
> Julian Smith wrote:
>> I've been trying out reverse-next with UndoDB as a remote debug server,
>> and it looks like reverse-next works by doing repeated
>> `bs' (reverse-stepi) commands.
>>
>> I was expecting it to set breakpoints and do `bc' (reverse-continue)
>> commands, by analogy with normal forwards step etc.
>>
>> Am i doing something wrong here ? Or is this the expected behaviour ?
> 
> Short answer: this is expected behavior.
> 
> Forward-next works the same way, in general.
> Both forward-next and reverse-next will set breakpoints
> under some circumstances, but will often work by
> singlestepping.

If I understand correctly, when doing a 'next' gdb does something like:

while (PC in current line) {
  ptrace (PTRACE_SINGLESTEP)
  if (PC outside current function) {
    plant breakpoint at return address
    ptrace (PTRACE_CONT)
    remove breakpoint
  }
}

however, when doing a reverse-next, we don't see this.  We just see 
repeated reverse single-steps.  If trying to do a reverse-next over a 
non-trivial function, this can take a very long time.  Is this expected?


Greg

-- 
Greg Law, Undo Software                       http://undo-software.com/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: reverse-next doing repeated reverse-stepi's ?
  2009-12-24 14:08   ` Greg Law
@ 2009-12-24 18:35     ` Michael Snyder
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2009-12-24 18:35 UTC (permalink / raw)
  To: Greg Law; +Cc: Julian Smith, gdb

Greg Law wrote:
> Michael Snyder wrote:
>> Julian Smith wrote:
>>> I've been trying out reverse-next with UndoDB as a remote debug server,
>>> and it looks like reverse-next works by doing repeated
>>> `bs' (reverse-stepi) commands.
>>>
>>> I was expecting it to set breakpoints and do `bc' (reverse-continue)
>>> commands, by analogy with normal forwards step etc.
>>>
>>> Am i doing something wrong here ? Or is this the expected behaviour ?
>> Short answer: this is expected behavior.
>>
>> Forward-next works the same way, in general.
>> Both forward-next and reverse-next will set breakpoints
>> under some circumstances, but will often work by
>> singlestepping.
> 
> If I understand correctly, when doing a 'next' gdb does something like:
> 
> while (PC in current line) {
>   ptrace (PTRACE_SINGLESTEP)
>   if (PC outside current function) {
>     plant breakpoint at return address
>     ptrace (PTRACE_CONT)
>     remove breakpoint
>   }
> }
> 
> however, when doing a reverse-next, we don't see this.  We just see 
> repeated reverse single-steps.  If trying to do a reverse-next over a 
> non-trivial function, this can take a very long time.  Is this expected?

No, it should work similarly to forward next.
When you have stepped backward into a function, it should
place a breakpoint at the entry point, run backward to that,
and then step back into the caller.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-24 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-23 17:02 reverse-next doing repeated reverse-stepi's ? Julian Smith
2009-12-23 18:15 ` Michael Snyder
2009-12-24 14:08   ` Greg Law
2009-12-24 18:35     ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox