public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	"akamath996@gmail.com" <akamath996@gmail.com>,
	Aditya Kamath1 <Aditya.Kamath1@ibm.com>,
	"tom@tromey.com" <tom@tromey.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>,
	Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH v3] [RFC] Fix AIX thread exit events not being reported and UI to show kernel thread ID.
Date: Thu, 2 May 2024 16:56:25 -0700	[thread overview]
Message-ID: <2c4be617-571e-477e-a5c6-b6f361663d7f@FreeBSD.org> (raw)
In-Reply-To: <6f8de9ca2324d117a3bb9e88a97af94859e07d8f.camel@de.ibm.com>

On 5/2/24 11:28 AM, Ulrich Weigand wrote:
> Aditya Kamath1 <Aditya.Kamath1@ibm.com> wrote:
> 
>> There is no way pbuf is able tell us whether a thread exits or not.
>> Though a thread reached the PST_TERM state it still ends up being in
>> the for loop (cmd = FIRST to last) and therefore the pbuf list.
> 
> My point was that you could simply check whether the state is
> PST_TERM and if so, just not add this thread to the pbuf to begin
> with.  After that, just run through the pbuf vs. gbuf comparison
> as it is today.

I think the one edge case with that Aditya was trying to handle is that
today AIX doesn't force a stop when a new thread appears.  Thus, a
thread can be created and exit in between two stops.  If you ignore
PST_TERM threads always, then GDB will never "notice" this thread, so
the output doesn't match that of Linux.  The current patch Aditya has
will notice this case and report back-to-back "new thread" and "thread
exited" messages for these threads when it rescans the thread lists at
the stop after the thread was created and exited.

Even if you don't do that, the fact that pbuf will always report some
sort of status for all threads (including exited threads that have been
seen before), does mean that a single loop over the list of threads from
the thread library is sufficient to enumerate all possible threads.  When
comparing the before and after versions of the code side by side I find
the newer version easier to understand as a single loop over the list
reported by libthread_db even if the resulting diff is a bit larger.

-- 
John Baldwin


  reply	other threads:[~2024-05-02 23:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 14:29 Aditya Vidyadhar Kamath
2024-05-02 14:41 ` Aditya Kamath1
2024-05-02 16:30 ` Ulrich Weigand
2024-05-02 16:41   ` John Baldwin
2024-05-02 17:59     ` Aditya Kamath1
2024-05-02 18:28       ` Ulrich Weigand
2024-05-02 23:56         ` John Baldwin [this message]
2024-05-03 11:42           ` Ulrich Weigand
2024-05-03 14:09             ` Aditya Kamath1

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=2c4be617-571e-477e-a5c6-b6f361663d7f@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=Aditya.Kamath1@ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=akamath996@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sangamesh.swamy@in.ibm.com \
    --cc=tom@tromey.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).