From: Kevin Buettner <kevinb@redhat.com>
To: Disconnect3d <dominik.b.czarnota@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb/linux-tdep: use thread lwp instead of pid for info proc
Date: Thu, 17 Apr 2025 14:25:02 -0700 [thread overview]
Message-ID: <20250417142502.429d54e3@f41-zbm-amd> (raw)
In-Reply-To: <20250412201140.31510-1-dominik.b.czarnota@gmail.com>
A couple of nits - 1) add a Bug tag/line to the commit message, and 2)
I got some whitespace nits when applying this patch. See below.
On Sat, 12 Apr 2025 22:11:41 +0200
Disconnect3d <dominik.b.czarnota@gmail.com> wrote:
> This commit fixes bug #31207 where GDB shows an empty result
> of `info proc mappings` when we debug a non-main thread of a Linux
> process while the main thread has exitted. In such a case, the
> `/proc/<pid>/maps` file renders an empty file and `/proc/<lwp>/maps`
> should be used instead.
>
> It is worth noting that the `/proc/<lwp>/` directories are not
> rendered by the Linux kernel when listing the procfs directory
> but they can be opened and they contain the usual procfs entries,
> just for the pid of the thread.
Please add:
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31207
> Signed-off-by: Disconnect3d <dominik.b.czarnota@gmail.com>
> ---
> gdb/linux-tdep.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
> index 141c1199c8a..c141c9c6701 100644
> --- a/gdb/linux-tdep.c
> +++ b/gdb/linux-tdep.c
> @@ -842,7 +842,11 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
> if (current_inferior ()->fake_pid_p)
> error (_("Can't determine the current process's PID: you must name one."));
>
> - pid = current_inferior ()->pid;
> + /* Use the thread's LWP ID instead of process ID when accessing procfs,
> + since the LWP-specific entries provide more useful information.
> + For example, /proc/<pid>/maps may be empty if the current thread has exited.
When applying this patch, "git am" complained that spaces were being used
instead of a tab for the above two lines.
> + */
> + pid = inferior_thread ()->ptid.lwp ();
> }
>
> args = skip_spaces (args);
With those nits fixed, it's okay to push:
Approved-by: Kevin Buettner <kevinb@redhat.com>
prev parent reply other threads:[~2025-04-17 21:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-12 20:11 Disconnect3d
2025-04-17 21:25 ` Kevin Buettner [this message]
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=20250417142502.429d54e3@f41-zbm-amd \
--to=kevinb@redhat.com \
--cc=dominik.b.czarnota@gmail.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