public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31211] New: [gdb] info checkpoints show incorrect info
@ 2024-01-04 14:40 vries at gcc dot gnu.org
  2024-01-04 14:48 ` [Bug gdb/31211] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2024-01-04 14:40 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 31211
           Summary: [gdb] info checkpoints show incorrect info
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider test-case test.c:
...
$ cat test.c
#include <stdio.h>

int
main (void)
{
  printf ("1\n");
  printf ("2\n");
  printf ("3\n");
  printf ("4\n");
  printf ("5\n");
  printf ("6\n");
  printf ("7\n");
  printf ("8\n");
  printf ("9\n");
  printf ("10\n");

  return 0;
}
...

Compiled with:
...
$ gcc -g test.c
...

Let's look at the output of "info checkpoints":
...
$ gdb -q a.out
Reading symbols from a.out...
(gdb) start
Temporary breakpoint 1 at 0x40051b: file test.c, line 6.
Starting program: /data/vries/gdb/a.out 

Temporary breakpoint 1, main () at test.c:6
6         printf ("1\n");
(gdb) info checkpoints
No checkpoints.
...

OK, sofar so good.  Now let's add a checkpoint:
...
(gdb) checkpoint
checkpoint 1: fork returned pid 7886.
(gdb) info checkpoints 
* 0 process 7881 (main process) at 0x0
  1 process 7886 at 0x40051b, file test.c, line 6
...

The documentation says checkpoints, but what we really have is fork
child/parent, which are initially equal, so it's odd that they're not both
shown with "at 0x40051b, file test.c, line 6".

After switching to checkpoint 1, we have:
...
(gdb) restart 1
Switching to process 7886
#0  main () at test.c:6
6         printf ("1\n");
(gdb) info checkpoints 
  0 process 7881 (main process) at 0x40051b, file test.c, line 6
* 1 process 7886 at 0x40051b, file test.c, line 6
(gdb) 
...
OK, so now they're indeed equal.

Let's see what happens when we step to the next line:
...
(gdb) next
1
7         printf ("2\n");
(gdb) info checkpoints 
  0 process 7881 (main process) at 0x40051b, file test.c, line 6
* 1 process 7886 at 0x40051b, file test.c, line 6
(gdb) 
...
Hmm, the line number didn't change.

So, are we stuck at line 6?  Let's try switching forth and back:
...
(gdb) restart 0
Switching to process 7881
#0  main () at test.c:6
6         printf ("1\n");
(gdb) info checkpoints
* 0 process 7881 (main process) at 0x40051b, file test.c, line 6
  1 process 7886 at 0x400525, file test.c, line 7
(gdb) restart 1
Switching to process 7886
#0  main () at test.c:7
7         printf ("2\n");
(gdb) info checkpoints
  0 process 7881 (main process) at 0x40051b, file test.c, line 6
* 1 process 7886 at 0x400525, file test.c, line 7
(gdb) 
...
Now the line is updated to 7.

So, it seems info checkpoints show outdated info for the current fork.

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

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

end of thread, other threads:[~2024-01-10 10:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-04 14:40 [Bug gdb/31211] New: [gdb] info checkpoints show incorrect info vries at gcc dot gnu.org
2024-01-04 14:48 ` [Bug gdb/31211] " vries at gcc dot gnu.org
2024-01-08 15:26 ` vries at gcc dot gnu.org
2024-01-10 10:27 ` cvs-commit at gcc dot gnu.org
2024-01-10 10:27 ` vries at gcc dot gnu.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).