From: John Baldwin <jhb@FreeBSD.org>
To: Aditya Kamath1 <Aditya.Kamath1@ibm.com>,
Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
Aditya Kamath1 via Gdb-patches <gdb-patches@sourceware.org>
Cc: Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] Fix AIX thread exit events not being reported and UI to show kernel thread ID.
Date: Sat, 20 Apr 2024 13:59:50 -0700 [thread overview]
Message-ID: <56ec3aae-9681-443b-914f-242bc2fb155c@FreeBSD.org> (raw)
In-Reply-To: <CH2PR15MB3544001C62D1D9E198D8ADF9D60E2@CH2PR15MB3544.namprd15.prod.outlook.com>
On 4/18/24 6:26 AM, Aditya Kamath1 wrote:
> Respected community members,
>
> Hi,
>
> Thank you for the comments in the [RFC] thread<https://sourceware.org/pipermail/gdb-patches/2024-April/208104.html>.
>
> Please find attached the patch. (See: 0001-Fix-AIX-thread-exit-events-not-being-reported-and-UI.patch)
Next time can you please send the patch inline as a separate e-mail? You can use a cover
letter for the contents of this mail. It is just easier to review in that case.
One thing I think I'm not fully understanding: does a thread never get removed from the
pth list once it has exited? That is, is it on that list forever? If so, I think
you could simplify this quite a bit to remove the qsort and the gcount and associated
list, etc. Instead, I would keep track of exited threads whose exit has been reported
via a new std::unordered_set<> class member in the target to avoid reporting duplicate
events and then do something like:
for (cmd = PTHDB_LIST_FIRST;; cmd = PTHDB_LIST_NEXT)
{
status = pthdb_pthread (data->pd_session, &pdtid, cmd);
if (status != PTHDB_SUCCESS || pthid == PTHDB_INVALID_PTID)
continue;
status = pthdb_pthread_tid (data->pd_session, pdtid, &tid);
if (status != PTHDB_SUCCESS)
tid = PTHDB_INVALID_TID;
ptid_t ptid (pid, 0, pthid);
status = pthdb_pthread_state (data->pd_session, pdtid, &state);
if (state == PST_TERM)
{
/* If this thread's exit was previously reported, ignore. */
if (exited_threads.count (pdtid) != 0)
continue;
}
/* If this thread has never been reported to GDB, add it. */
if (!in_thread_list (proc_target, ptid))
{
aix_thread_info *priv = new aix_thread_info;
/* init priv */
add_thread_with_info (proc_target, ptid,
private_thread_info_up (priv));
}
if (state == PST_TERM)
{
thread_info *thr = proc_target->find_thread (ptid);
gdb_assert (thr != nullptr);
delete_thread (thr);
exited_threads.insert (pdtid);
}
}
--
John Baldwin
next prev parent reply other threads:[~2024-04-20 20:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-18 13:26 Aditya Kamath1
2024-04-18 15:03 ` Tom Tromey
2024-04-20 20:59 ` John Baldwin [this message]
2024-04-29 11:40 Aditya Vidyadhar Kamath
2024-04-29 11:48 ` Aditya Kamath1
2024-04-30 16:41 ` John Baldwin
2024-04-29 11:46 Aditya Vidyadhar Kamath
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=56ec3aae-9681-443b-914f-242bc2fb155c@FreeBSD.org \
--to=jhb@freebsd.org \
--cc=Aditya.Kamath1@ibm.com \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=sangamesh.swamy@in.ibm.com \
/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).