[PATCH v1 0/2] gdb: fix for bug 31207

Matthieu Longo <[email protected]> Tue, 28 Jul 2026 15:33:15 +0100
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
This patch series contains:
- a refactoring suggested by Simon Marchi <[email protected]> in [1] patch 02/10.
- a fix for https://sourceware.org/bugzilla/show_bug.cgi?id=31207.

Those 2 patches were extracted from a previous patch series [1], in order to give more visibility and focus on that fix.

Following up the suggestions of Simon,
1. 'info proc mappings' will print before the thread-group leader exits:
    process 814
  and after the thread-group leader exited:
    process 814 [Note: information where gathered from LWP 816 as the thread-group leader (LWP=814) already exited.]

2. the code selecting the PTID inside was moved to get_process_reference_ptid().
3. a new test in gdb.threads checks that the header is emitted correctly before and after the exit of the thread-group leader.

Regards,
Matthieu

[1]: https://inbox.sourceware.org/gdb-patches/[email protected]/


Matthieu Longo (2):
  gdb: rename any_thread_of_inferior to any_non_exited_thread_of_inferior
  gdb: rely on the first non-exited thread TPID when reading Linux procfs files

 gdb/gdbthread.h                               |  4 +-
 gdb/inferior.c                                | 18 +++-
 gdb/inferior.h                                | 11 +++
 gdb/linux-fork.c                              | 10 +--
 gdb/linux-tdep.c                              | 90 +++++++++++++------
 gdb/mi/mi-main.c                              |  4 +-
 gdb/remote.c                                  |  4 +-
 ...access-procfs-while-thread-leader-exited.c | 48 ++++++++++
 ...cess-procfs-while-thread-leader-exited.exp | 78 ++++++++++++++++
 gdb/thread.c                                  |  2 +-
 gdb/top.c                                     |  2 +-
 11 files changed, 227 insertions(+), 44 deletions(-)
 create mode 100644 gdb/testsuite/gdb.threads/access-procfs-while-thread-leader-exited.c
 create mode 100644 gdb/testsuite/gdb.threads/access-procfs-while-thread-leader-exited.exp

-- 
2.55.0