public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31211] New: [gdb] info checkpoints show incorrect info
Date: Thu, 04 Jan 2024 14:40:49 +0000	[thread overview]
Message-ID: <bug-31211-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2024-01-04 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 14:40 vries at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31211-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).