public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Aditya Kamath1 via Gdb-patches <gdb-patches@sourceware.org>
Cc: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	 "simark@simark.ca" <simark@simark.ca>,
	 Aditya Kamath1 <Aditya.Kamath1@ibm.com>,
	 Sangamesh Mallayya <sangamesh.swamy@in.ibm.com>
Subject: Re: [PATCH] 0001-Fix-multi-thread-debug-bug-in-AIX.patch
Date: Mon, 30 Jan 2023 12:54:12 -0700	[thread overview]
Message-ID: <87v8knn6hn.fsf@tromey.com> (raw)
In-Reply-To: <CH2PR15MB3544A44737D2C7BF3CDC9BAAD6CC9@CH2PR15MB3544.namprd15.prod.outlook.com> (Aditya Kamath's message of "Fri, 27 Jan 2023 14:40:30 +0000")

>>>>> Aditya Kamath1 via Gdb-patches <gdb-patches@sourceware.org> writes:

> We now have all variables {pd_able, pd_active and pd_session} now in a
> map of process ID and structure. This will help us make AIX GDB code
> easy to manage them per process in the aix-thread.c file.

I don't really know what this is about, but it's probably better to
attach the data directly to the inferior using the registry system.
(You can't use private_inferior as apparently that's reserved for the
process stratum.)

Search for registry<inferior> for some examples.


> Secondly, in the function pid_to_str () there is a beneath () call,
> which is why I had to put this function in rs6000-aix-nat.c file.

I wonder why it's necessary, as it seems to me that
aix_thread_target::pid_to_str should have already handled the 'thread'
case, so the inherited method ought to be good enough.

> ---------------------------------------------------
> Output with patch applied:-

Is there an existing gdb test case that exercises this code?
If not then it seems like a new test is warranted.

>  static void
>  pd_disable (void)
>  {
> -  if (!pd_able)
> +  if (!tmap[inferior_ptid.pid ()].pd_able)
>      return;
> -  if (pd_active)
> +  if (tmap[inferior_ptid.pid ()].pd_active)
>      pd_deactivate ();
> -  pd_able = 0;
> +  tmap[inferior_ptid.pid ()].pd_able = 0;
>    current_inferior ()->unpush_target (&aix_thread_ops);
> +  tmap.erase (inferior_ptid.pid ());
>  }

It's better to pass in a ptid or even the aix_thread_variables object
itself than to rely on globals in low-level functions like this.

 
> diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
> index f483f54de13..74676cbfa50 100644
> --- a/gdb/solib-aix.c
> +++ b/gdb/solib-aix.c
> @@ -550,6 +550,10 @@ solib_aix_in_dynsym_resolve_code (CORE_ADDR pc)
>    return 0;
>  }
 
> +/* For multi inferiors, post object file name change
> +   we store the new names in this vector.  */
> +std::vector<std::string> aix_slib_name;

> +      std::string s = bfd_get_filename (object_bfd.get ());
> +      auto it = aix_slib_name.begin ();
> +      while (it != aix_slib_name.end ())
> +      {
> +	std::string s1 = *it;
> +	if (s1.compare(s) == 0)
> +	  return object_bfd;
> +	it++;

This doesn't look right to me at all.  Using a global means that BFDs
from one inferior might "leak" to another, based solely on whether a
certain name was ever seen.  Also nothing ever cleans out the global
vector.

It's better to attach this data to the relevant BFD using the registry
system, and not use a global at all.

Tom

  reply	other threads:[~2023-01-30 19:54 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-25  6:47 Aditya Kamath1
2022-10-28  9:49 ` Ulrich Weigand
2022-11-08 12:00   ` Aditya Kamath1
2022-11-08 12:17     ` Ulrich Weigand
2022-11-13 18:15       ` Aditya Kamath1
2022-11-15 18:16         ` Ulrich Weigand
2022-11-21  8:27           ` Aditya Kamath1
2022-11-23 14:15             ` Ulrich Weigand
2022-11-23 16:03               ` Aditya Kamath1
2022-11-23 17:09                 ` Ulrich Weigand
2022-11-23 18:45                   ` Aditya Kamath1
2022-11-29  8:18                     ` Aditya Kamath1
2022-11-30 14:57                       ` Ulrich Weigand
2022-12-02  7:50                         ` Aditya Kamath1
2022-12-05 18:33                           ` Ulrich Weigand
2022-12-08 10:28                             ` Aditya Kamath1
2022-12-08 10:46                               ` Aditya Kamath1
2022-12-08 16:29                               ` Ulrich Weigand
2022-12-15 12:58                                 ` Aditya Kamath1
2022-12-15 15:53                                   ` Ulrich Weigand
2022-12-19  6:30                                     ` Aditya Kamath1
2022-12-22 12:50                                       ` Ulrich Weigand
2022-12-26 13:18                                         ` Aditya Kamath1
2023-01-09 14:04                                           ` Ulrich Weigand
2023-01-10 12:23                                             ` Aditya Kamath1
2023-01-11 13:31                                               ` Ulrich Weigand
2023-01-13 14:06                                                 ` Aditya Kamath1
2023-01-20 14:44                                                   ` Ulrich Weigand
2023-01-27 14:40                                                     ` Aditya Kamath1
2023-01-30 19:54                                                       ` Tom Tromey [this message]
2023-02-02  6:24                                                       ` Aditya Kamath1
2023-02-02  6:35                                                         ` Aditya Kamath1
2023-02-02 17:43                                                           ` Ulrich Weigand
2023-02-03 11:10                                                             ` Aditya Kamath1
2023-02-06 19:07                                                               ` Ulrich Weigand
2023-02-07 11:57                                                                 ` Aditya Kamath1
2023-02-08 18:44                                                                   ` Ulrich Weigand
2023-02-10 16:33                                                                     ` Aditya Kamath1
2023-02-10 16:46                                                                       ` Aditya Kamath1
2023-02-13 19:01                                                                       ` Ulrich Weigand
2023-02-14 14:13                                                                         ` Aditya Kamath1
2023-02-16 19:46                                                                           ` Ulrich Weigand
2023-02-17 11:26                                                                             ` Aditya Kamath1
2023-02-17 12:04                                                                               ` Ulrich Weigand
2023-02-17 13:22                                                                                 ` Aditya Kamath1
2023-02-17 14:18                                                                                   ` Ulrich Weigand
2023-02-17 15:15                                                                                     ` Aditya Kamath1
2023-02-17 19:14                                                                                       ` Ulrich Weigand
2022-11-08 12:00 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=87v8knn6hn.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 \
    --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).