public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug record/31487] New: [RFE] reverse debugging should print the previous line
@ 2024-03-14 13:19 blarsen at redhat dot com
  2024-03-14 15:30 ` [Bug record/31487] " ssbssa at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: blarsen at redhat dot com @ 2024-03-14 13:19 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31487

            Bug ID: 31487
           Summary: [RFE] reverse debugging should print the previous line
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: record
          Assignee: unassigned at sourceware dot org
          Reporter: blarsen at redhat dot com
  Target Milestone: ---

When GDB has the execution direction to reverse and attempts to print the
current line, it considers the current PC, sees that it is at the start of a
line and prints that line. This is a nuissance because using "next" or "step"
in this case will undo a different line than the one printed. For example, see
the following session:

Temporary breakpoint 2, main () at t.c:23
23          int p = 0;
(gdb) record
(gdb) next
24          setup (n);
(gdb) next
25          for(int i = 0; i<10; i++) proc[i] = -1;
(gdb) set exec-direction reverse
(gdb) next
24          setup (n);
(gdb) step

No more reverse-execution history.
main () at t.c:23
23          int p = 0;
(gdb)

As a user, seeing the "setup" line, I would expect the "step" command to enter
the 'setup' function, instead of undoing the previous line. My suggestion would
be for GDB to instead provide this session:

Temporary breakpoint 2, main () at t.c:23
23          int p = 0;
(gdb) record
(gdb) next
24          setup (n);
(gdb) next
25          for(int i = 0; i<10; i++) proc[i] = -1;
(gdb) set exec-direction reverse
24          setup (n);
(gdb) next
23          int p = 0;
(gdb) step

No more reverse-execution history.
main () at t.c:23
23          int p = 0;
(gdb)

To do this, a remote target would need to provide a "previous PC" style method,
so that we are able to identify the previous-executed line correctly. We should
also be able to handle when a reverse-executing target is not able to provide
it, since it isn't feasible with all recording methods. This may not be a
trivial issue to solve.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug record/31487] [RFE] reverse debugging should print the previous line
  2024-03-14 13:19 [Bug record/31487] New: [RFE] reverse debugging should print the previous line blarsen at redhat dot com
@ 2024-03-14 15:30 ` ssbssa at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: ssbssa at sourceware dot org @ 2024-03-14 15:30 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31487

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ssbssa at sourceware dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-03-14 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14 13:19 [Bug record/31487] New: [RFE] reverse debugging should print the previous line blarsen at redhat dot com
2024-03-14 15:30 ` [Bug record/31487] " ssbssa at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).