From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 07/11] Re-add zombie leader on exit, gdb/linux
Date: Mon, 7 Mar 2022 20:27:03 +0000 [thread overview]
Message-ID: <d510d11b-8eeb-c573-ba35-49c89d10ee11@palves.net> (raw)
In-Reply-To: <baf2aed6-923e-61af-a9bc-fe184a203908@simark.ca>
On 2022-03-07 20:08, Simon Marchi wrote:
> On 2022-03-03 09:40, Pedro Alves wrote:
>> @@ -2814,7 +2822,23 @@ linux_nat_filter_event (int lwpid, int status)
>> /* Don't report an event for the exit of an LWP not in our
>> list, i.e. not part of any inferior we're debugging.
>> This can happen if we detach from a program we originally
>> - forked and then it exits. */
>> + forked and then it exits. However, note that we may have
>> + earlier deleted a leader of an inferior we're debugging,
>> + in check_zombie_leaders. Re-add it back here if so. */
>> + for (inferior *inf : all_inferiors (linux_target))
>> + {
>> + if (inf->pid == lwpid)
>> + {
>> + linux_nat_debug_printf
>> + ("Re-adding thread group leader LWP %d after exit.",
>> + lwpid);
>> +
>> + lp = add_lwp (ptid_t (lwpid, lwpid));
>> + lp->resumed = 1;
>> + add_thread (linux_target, lp->ptid);
>> + break;
>> + }
>> + }
>
> Should we do this only if WIFEXITED? We don't expect to get any other
> event from a deleted leader, so it's more to be safe in case there is a
> kernel bug or something that would make us see something else.
>
Hmm, can you clarify? We're doing this for both WIFEXITED and WIFSIGNALED. The
WIFSTOPPED case doesn't get here, it's handled in the if/then branch. I do think
we need to do this for exits due to WIFSIGNALED just the same. Do you think
otherwise?
> Otherwise, LGTM.
>
> Simon
>
next prev parent reply other threads:[~2022-03-07 20:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 14:40 [PATCH 00/11] Linux: Fix issues around thread group leader exits Pedro Alves
2022-03-03 14:40 ` [PATCH 01/11] Fix gdbserver/linux target_waitstatus logging assert Pedro Alves
2022-03-03 14:40 ` [PATCH 02/11] Fix gdb.threads/clone-new-thread-event.exp race Pedro Alves
2022-03-03 14:40 ` [PATCH 03/11] Fix gdb.threads/current-lwp-dead.exp race Pedro Alves
2022-03-03 14:40 ` [PATCH 04/11] gdb: Reorganize linux_nat_filter_event Pedro Alves
2022-03-03 14:40 ` [PATCH 05/11] gdbserver: Reorganize linux_process_target::filter_event Pedro Alves
2022-03-03 14:40 ` [PATCH 06/11] gdbserver: Reindent check_zombie_leaders Pedro Alves
2022-03-03 14:40 ` [PATCH 07/11] Re-add zombie leader on exit, gdb/linux Pedro Alves
2022-03-07 20:08 ` Simon Marchi
2022-03-07 20:27 ` Pedro Alves [this message]
2022-03-07 20:31 ` Simon Marchi
2022-03-09 14:37 ` Pedro Alves
2022-03-03 14:40 ` [PATCH 08/11] Re-add zombie leader on exit, gdbserver/linux Pedro Alves
2022-03-03 14:40 ` [PATCH 09/11] Ensure EXIT is last event, gdb/linux Pedro Alves
2022-03-07 20:24 ` Simon Marchi
2022-03-09 0:21 ` Lancelot SIX
2022-03-09 14:45 ` Pedro Alves
2022-03-09 22:29 ` Lancelot SIX
2022-03-10 11:46 ` Pedro Alves
2022-03-03 14:40 ` [PATCH 10/11] Ensure EXIT is last event, gdbserver/linux Pedro Alves
2022-03-03 14:40 ` [PATCH 11/11] Process exit status is leader exit status testcase Pedro Alves
2023-06-22 11:28 ` Ilya Leoshkevich
2023-06-22 13:07 ` Tom de Vries
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=d510d11b-8eeb-c573-ba35-49c89d10ee11@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.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).