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] [gdb] info checkpoints show incorrect info
Date: Thu, 04 Jan 2024 14:48:07 +0000	[thread overview]
Message-ID: <bug-31211-4717-xn7Bx5bmYi@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-31211-4717@http.sourceware.org/bugzilla/>

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
With this patch:
...
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 1430ff89fa7..4f34c72ef8e 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -594,12 +594,13 @@ info_checkpoints_command (const char *arg, int from_tty)
        continue;

       printed = &fi;
-      if (fi.ptid == inferior_ptid)
+      bool is_current = fi.ptid == inferior_ptid;
+      if (is_current)
        gdb_printf ("* ");
       else
        gdb_printf ("  ");

-      ULONGEST pc = fi.pc;
+      ULONGEST pc = is_current ? get_frame_pc (get_current_frame ()) : fi.pc ;
       gdb_printf ("%d %s", fi.num, target_pid_to_str (fi.ptid).c_str ());
       if (fi.num == 0)
        gdb_printf (_(" (main process)"));
...
we get:
...
$ 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) checkpoint
checkpoint 1: fork returned pid 9696.
(gdb) info checkpoint
* 0 process 9693 (main process) at 0x40051b, file test.c, line 6
  1 process 9696 at 0x40051b, file test.c, line 6
(gdb) n
1
7         printf ("2\n");
(gdb) info checkpoint
* 0 process 9693 (main process) at 0x400525, file test.c, line 7
  1 process 9696 at 0x40051b, file test.c, line 6
(gdb) 
...

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

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 14:40 [Bug gdb/31211] New: " vries at gcc dot gnu.org
2024-01-04 14:48 ` vries at gcc dot gnu.org [this message]
2024-01-08 15:26 ` [Bug gdb/31211] " 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-xn7Bx5bmYi@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).