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

Message ID 20260728143317.245389-1-matthieu.longo@arm.com
Headers
Series gdb: fix for bug 31207 |

Message

Matthieu Longo July 28, 2026, 2:33 p.m. UTC
  This patch series contains:
- a refactoring suggested by Simon Marchi <simark@simark.ca> 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/20260707154900.94542-1-matthieu.longo@arm.com/


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
  

Comments

Matthieu Longo Aug. 20, 2026, 11:09 a.m. UTC | #1
On 28/07/2026 15:33, Matthieu Longo wrote:
> This patch series contains:
> - a refactoring suggested by Simon Marchi <simark@simark.ca> 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/20260707154900.94542-1-matthieu.longo@arm.com/
> 
> 
> 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
> 

Ping.

The patches were reviewed by Thiago.
However, they are still pending on the approval of a maintainer.

Matthieu
  
Tom Tromey Aug. 21, 2026, 3:39 p.m. UTC | #2
>>>>> "Matthieu" == Matthieu Longo <matthieu.longo@arm.com> writes:

Matthieu> Ping.

Matthieu> The patches were reviewed by Thiago.
Matthieu> However, they are still pending on the approval of a maintainer.

FAOD I think Simon sent some comments around the same time that you sent
this ping.

Tom