From: Andrew Burgess <aburgess@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: filter inferiors using linux_target in check_zombie_leaders
Date: Sat, 19 Feb 2022 10:17:14 +0000 [thread overview]
Message-ID: <20220219101714.GR2571@redhat.com> (raw)
In-Reply-To: <20220218225839.130715-1-simon.marchi@polymtl.ca>
* Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> [2022-02-18 17:58:39 -0500]:
> check_zombie_leaders, a help function of the linux-nat target, iterates
> on all inferiors when looking for zombie leaders. This potentially
> includes inferiors from other targets. This is not harmful, for
> inferiors from other targets it will simply not find a matching lwp.
> But it would make sense to only iterate on the target's inferiors.
>
> We can also remove the "inf->pid == 0" check: inferiors that have the
> linux-nat target pushed will have execution and a non-zero pid.
LGTM.
Thanks,
Andrew
>
> Change-Id: Ie31465dbae983fcc639478939877e1616848738b
> ---
> gdb/linux-nat.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
> index 5b747f7822b3..352716eda9ba 100644
> --- a/gdb/linux-nat.c
> +++ b/gdb/linux-nat.c
> @@ -3052,14 +3052,9 @@ linux_nat_filter_event (int lwpid, int status)
> static void
> check_zombie_leaders (void)
> {
> - for (inferior *inf : all_inferiors ())
> + for (inferior *inf : all_inferiors (linux_target))
> {
> - struct lwp_info *leader_lp;
> -
> - if (inf->pid == 0)
> - continue;
> -
> - leader_lp = find_lwp_pid (ptid_t (inf->pid));
> + lwp_info *leader_lp = find_lwp_pid (ptid_t (inf->pid));
> if (leader_lp != NULL
> /* Check if there are other threads in the group, as we may
> have raced with the inferior simply exiting. */
>
> base-commit: f6b3ad544063314a1e7fcaa703b5e29f5ff10780
> --
> 2.35.1
>
prev parent reply other threads:[~2022-02-19 10:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 22:58 Simon Marchi
2022-02-19 10:17 ` Andrew Burgess [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=20220219101714.GR2571@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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).