Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>
Subject: [PATCH 0/7] Start supporting multi-threaded inferiors with record-full
Date: Thu, 29 Oct 2026 17:57:36 -0300	[thread overview]
Message-ID: <20261029205743.1917668-1-guinevere@redhat.com> (raw)

Record full has never been capable of managing multi-threaded
inferiors, but it never really told the user about that, instead
silently making things fail or infinitely loop. This series finally
changes that, making us truly support multi-threading.

For now, we are only able to record when manually scheduling, because
of issues with how to have multiple instructions at once, how to
manage waits for locks, and especially how to manage deadlocks, if
they should be managed at all. Also, we're unable to record the
creation of a thread, because we need to have a status for "not
created yet", needs to be removed from the inferior list and so
on. The latter is not too hard of an edge case, but I had limited time
to work on this, I decided to keep it for a later series, since the
current one already is an improvement on the situation.

The fourth patch is the most surprising one in my opinion. This is
needed because of the fifth patch, when we start dealing with threads
that have been exited, having the ptid isn't enough to find the thread
pointer in the inferior. In theory it would be possible to remove that
patch, but there are many edge cases to finding the instruction, which
would cause crashes. But I also personally think that using the thread
pointer is cleaner than the PTID, so I didn't try too hard without the
regcache change.

I am about to leave for a vacation, so it will be a while before I am
able to respond to feedback, but I felt it was important to send the
patch now to have a chance of merging this year or early next year.

Guinevere Larsen (7):
  gdb/record-full: Add thread pointer to recorded instructions
  gdb/record: add thread ID to the precsave format
  gdb/record: Make GDB automatically switch threads when replaying
  gdb: make regcache save a thread pointer, not ptid
  gdb/record: Record through a thread exiting
  gdb/record: Loudly warn or fail on dubious situations
  gdb/record: document recording multi-threaded inferiors

 gdb/NEWS                                      |   5 +
 gdb/doc/gdb.texinfo                           |   9 +-
 gdb/gdbthread.h                               |   2 +
 gdb/infcmd.c                                  |   6 +
 gdb/infrun.c                                  |   3 +
 gdb/linux-record.c                            |  18 +-
 gdb/ravenscar-thread.c                        |  41 +-
 gdb/record-full.c                             | 409 ++++++++++++++++--
 gdb/record-full.h                             |  16 +
 gdb/record.c                                  |   6 +
 gdb/regcache.c                                | 105 +----
 gdb/regcache.h                                |  17 +-
 gdb/scoped-mock-context.h                     |  18 +
 .../gdb.reverse/basic-record-full.exp         |   5 +-
 .../gdb.reverse/finish-reverse-next.exp       |  10 +-
 .../gdb.reverse/i386-avx-reverse.exp          |  39 +-
 gdb/testsuite/gdb.reverse/insn-reverse.exp    |   3 +-
 .../gdb.reverse/pthreads-precsave.exp         | 107 +++++
 gdb/testsuite/gdb.reverse/pthreads-reverse.c  |  40 ++
 .../gdb.reverse/pthreads-reverse.exp          | 128 ++++++
 gdb/testsuite/gdb.reverse/waitpid-reverse.c   |   3 +-
 gdb/testsuite/gdb.reverse/waitpid-reverse.exp |  10 +-
 gdb/thread.c                                  |  19 +-
 23 files changed, 827 insertions(+), 192 deletions(-)
 create mode 100644 gdb/testsuite/gdb.reverse/pthreads-precsave.exp
 create mode 100644 gdb/testsuite/gdb.reverse/pthreads-reverse.c
 create mode 100644 gdb/testsuite/gdb.reverse/pthreads-reverse.exp


base-commit: f747b0cd54bf4d2d7e0fcbabcf5b8c3377847b4d
-- 
2.56.0


             reply	other threads:[~2026-10-29 20:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 20:57 Guinevere Larsen [this message]
2026-10-29 20:57 ` [PATCH 1/7] gdb/record-full: Add thread pointer to recorded instructions Guinevere Larsen
2026-10-29 20:57 ` [PATCH 2/7] gdb/record: add thread ID to the precsave format Guinevere Larsen
2026-10-29 20:57 ` [PATCH 3/7] gdb/record: Make GDB automatically switch threads when replaying Guinevere Larsen
2026-10-29 20:57 ` [PATCH 4/7] gdb: make regcache save a thread pointer, not ptid Guinevere Larsen
2026-10-29 20:57 ` [PATCH 5/7] gdb/record: Record through a thread exiting Guinevere Larsen
2026-10-29 20:57 ` [PATCH 6/7] gdb/record: Loudly warn or fail on dubious situations Guinevere Larsen
2026-10-29 20:57 ` [PATCH 7/7] gdb/record: document recording multi-threaded inferiors Guinevere Larsen
2026-10-30  6:43   ` Eli Zaretskii
2026-10-30 11:32     ` Guinevere Larsen
2026-10-30 12:44       ` Eli Zaretskii
2026-10-30 13:20         ` Guinevere Larsen
2026-10-30 13:38           ` Eli Zaretskii
2026-10-30 13:40             ` Guinevere Larsen

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=20261029205743.1917668-1-guinevere@redhat.com \
    --to=guinevere@redhat.com \
    --cc=gdb-patches@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