public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Aditya Kamath1 <Aditya.Kamath1@ibm.com>
Cc: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	 Aditya Kamath1 via Gdb-patches <gdb-patches@sourceware.org>,
	 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: Thu, 18 Apr 2024 09:03:17 -0600	[thread overview]
Message-ID: <87frvizpai.fsf@tromey.com> (raw)
In-Reply-To: <CH2PR15MB3544001C62D1D9E198D8ADF9D60E2@CH2PR15MB3544.namprd15.prod.outlook.com> (Aditya Kamath1's message of "Thu, 18 Apr 2024 13:26:31 +0000")

>>>>> Aditya Kamath1 <Aditya.Kamath1@ibm.com> writes:

> Please find attached the patch. (See:
> 0001-Fix-AIX-thread-exit-events-not-being-reported-and-UI.patch)

Thanks for the patch.

> So, consider program 1 pasted below this email.

Is there some existing gdb test case that is fixed by this patch?  If
not then I think it would be better if the patch came with a new test.

I can't really comment on the AIX parts of the patch, but I noticed a
few little oddities.

>  static int
> -pcmp (const void *p1v, const void *p2v)
> +pcmp (struct pd_thread p1v, struct pd_thread p2v)
>  {
> -  struct pd_thread *p1 = (struct pd_thread *) p1v;
> -  struct pd_thread *p2 = (struct pd_thread *) p2v;
> -  return p1->pthid < p2->pthid ? -1 : p1->pthid > p2->pthid;
> +  return p1v.pthid < p2v.pthid;
>  }

Comparison functions passed to std::sort should return bool and
(ordinarily) use const reference parameter types.

Personally I'd probably just make this a lambda or maybe an operator<
but it's up to you.

>    pcount = 0;

Declaring this earlier and initializing it here is a bit strange now
that the logic has changed.

>    psize = 1;

This isn't needed any more, I think; and I'm surprised the compiler
didn't complain about it.

>    if (status == PTHDB_SUCCESS && detachstate == PDS_DETACHED)
>      /* i18n: Like "Thread-Id %d, [state] running, detached" */
> -    buf.printf (_(", detached"));
> +    buf.printf (_("[detached]"));
 
>    pthdb_pthread_cancelpend (data->pd_session, pdtid, &cancelpend);
>    if (status == PTHDB_SUCCESS && cancelpend)
>      /* i18n: Like "Thread-Id %d, [state] running, cancel pending" */
> -    buf.printf (_(", cancel pending"));
> +    buf.printf (_("[cancel pending]"));
 
The comments before these printfs are wrong now.

Tom

  reply	other threads:[~2024-04-18 15:03 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 [this message]
2024-04-20 20:59 ` John Baldwin
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=87frvizpai.fsf@tromey.com \
    --to=tom@tromey.com \
    --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).