From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from outbound-ss-761.bluehost.com (outbound-ss-761.bluehost.com [74.220.211.250]) by sourceware.org (Postfix) with ESMTPS id 0B17D3858D1E for ; Mon, 30 Jan 2023 19:54:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B17D3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw11.mail.unifiedlayer.com (unknown [10.0.90.126]) by progateway8.mail.pro1.eigbox.com (Postfix) with ESMTP id 43C6410047ABD for ; Mon, 30 Jan 2023 19:54:15 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id MaEIpQatzGjYaMaEJpw25y; Mon, 30 Jan 2023 19:54:15 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=cdgXElPM c=1 sm=1 tr=0 ts=63d82067 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=RvmDmJFTN0MA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=CCpqsmhAAAAA:8 a=NbLD4bAmDdqiRRjkVA8A:9 a=ul9cdbp4aOFLsgKbc677:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iA9YZj/eZx+VqIlLEyOQ3YBuctLG7e2ItrodoahrbaI=; b=clzrCHtWYNLqvd39wJZyRT/OHV F7l02JFkvgbjPMoDJF0MTi2pVJ8DWxt/AT5HrhTRR/Wk2REeCOhuZxatG7edMjiJsY3Qdwjiwyzin l5Q6g3WcTDpmD5bywYgNY5oWK; Received: from 71-211-157-143.hlrn.qwest.net ([71.211.157.143]:39418 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pMaEI-001it8-Kw; Mon, 30 Jan 2023 12:54:14 -0700 From: Tom Tromey To: Aditya Kamath1 via Gdb-patches Cc: Ulrich Weigand , "simark@simark.ca" , Aditya Kamath1 , Sangamesh Mallayya Subject: Re: [PATCH] 0001-Fix-multi-thread-debug-bug-in-AIX.patch References: <5956432ab1e0eedc8f65e01d3793a80ccf3a3a1f.camel@de.ibm.com> <139ff3da5e35905c963869569bebf280733740c2.camel@de.ibm.com> <8302c3570292b864ab21176e58bdee546f6e4544.camel@de.ibm.com> <5324a4027099ed44a32b3de8db71df875e034deb.camel@de.ibm.com> <37f1252e8d8bc1bad3f7a4ac9b38749ee6791e17.camel@de.ibm.com> X-Attribution: Tom Date: Mon, 30 Jan 2023 12:54:12 -0700 In-Reply-To: (Aditya Kamath's message of "Fri, 27 Jan 2023 14:40:30 +0000") Message-ID: <87v8knn6hn.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.157.143 X-Source-L: No X-Exim-ID: 1pMaEI-001it8-Kw X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-157-143.hlrn.qwest.net (murgatroyd) [71.211.157.143]:39418 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3027.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> Aditya Kamath1 via Gdb-patches 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 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 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