reverse-next doing repeated reverse-stepi's ?

Greg Law glaw@undo-software.com
Thu Dec 24 14:08:00 GMT 2009


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/



More information about the Gdb mailing list