[RFC] Change displayed line when execution direction is reversed

Pedro Alves pedro@palves.net
Fri Jun 17 12:07:43 GMT 2022


On 2022-06-15 13:25, Bruno Larsen via Gdb wrote:
> Hello all,
> 
> I was doing some reverse debugging and noticed that setting the execution direction to reverse does not change how GDB displays lines. The problem with this is that the user doesn't see what will be executed if a step is taken, which makes the user experience quite annoying. How would the community feel if GDB printed the previous line, instead of current line, when the execution direction is reversed?
> 
> Sorry if this is the wrong list. It didn't feel like a bug, and I don't have a patch yet, so this felt like the best place to send.

How do you know which line that would be?  E.g.:

 if (foo)
   func ();
 else
   bar ();
 qux = 0; // stopped here.

Say you're stopped at the "stopped here" line, and flip execution direction to reverse.  Which line would gdb show as next line?


Also, showing a different line would result in the current PC (p $pc, info registers) etc. printing an
address for a line totally unrelated to the line that GDB is displaying, no?  Same for "break" with no
arguments, etc.  Worse, what happens when you print variables?  The block scope used is the one for the
current PC, while gdb would display a different source line as current line?

I don't see off hand how this can work.  Can you detail it?


More information about the Gdb mailing list