From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 4C1DA3858C51 for ; Mon, 18 Apr 2022 06:33:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4C1DA3858C51 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23I5mHho026717; Mon, 18 Apr 2022 06:33:42 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2105.outbound.protection.outlook.com [104.47.70.105]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fg7k9dves-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Apr 2022 06:33:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dWB3zf/xiIhCOX6hn8ZucYhHyOfNwOJP7m5bmIA/G6l71gf/cijLpghcdVtQkWNce6+n6OVlHXg4j9U0HqWf4zUioXil+VZ653YtgLGKIWkm+ocPuSdqGu/iNXGu1wqwpkCaZGPOvKHWsIBbCm6uN7NrIv2bn6KYMV0Q+6WXY1rWN9XCo83agPFRb+yVgVG1IBI5oulHWcs7VlkyryEcut9WD7GsL58GKMMI58e+74/F/91sMChCKQckC2jWg3q83NXKQ8ZQ16RBU7iwIB1XzfhFSZky01fxs4KM3tzxvj1WMs81jIUPdkA8u+ouvvXnYLx3Ffi3Q0BycNHOAps9fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xza6MAlbvtgD3c4VmPvZJ/9XMoUplH14S1OKgy+BI1o=; b=I/FWijvjDgfaWs6hD8/FEe6oI0TTh1cQh7tvVBwCCH9fxp5r0U12MEaYpfwFIxVy7rULoh4jjuUr+f6bRcda+U7NwFoUJcUcggDmFa7vtI/rzM6DyYs+dRu/PXssX83w45YZIRA2OQgbcDwAQcMq7aN6ppuUY6RHGm12DJye+VWVVHuAafVdbYvrGmm9TWLGs287yFZdD059HnUIEJFTIwfINURz7aNutOCEiq2SXmuRMFHmF3MVocAqNHj4fcEF/e+9F/OPCgG06vQ1zpcSRr9rg+RB3yuR7TpSMyTUh3Fe8TPOKbsggz0HuaDqA+0NHkQBm8FrLjgbXTzpgJDemg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ibm.com; dmarc=pass action=none header.from=ibm.com; dkim=pass header.d=ibm.com; arc=none Received: from BN8PR15MB2867.namprd15.prod.outlook.com (2603:10b6:408:83::15) by BL0PR1501MB2065.namprd15.prod.outlook.com (2603:10b6:207:32::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.18; Mon, 18 Apr 2022 06:33:39 +0000 Received: from BN8PR15MB2867.namprd15.prod.outlook.com ([fe80::946a:26fb:3b14:d38e]) by BN8PR15MB2867.namprd15.prod.outlook.com ([fe80::946a:26fb:3b14:d38e%6]) with mapi id 15.20.5164.025; Mon, 18 Apr 2022 06:33:39 +0000 From: Aditya Vidyadhar Kamath To: Simon Marchi , Joel Brobecker via Gdb-patches , Aditya Vidyadhar Kamath CC: Sangamesh Mallayya Thread-Topic: [EXTERNAL] RE: [PATCH] Use current_inferior ()->pid for AIX Thread-Index: AQHYQzomuN6vfkBMD0KaGHkq0D0viKzWU60AgAGS5NqACWl/AIALCa68gAj8HEU= Date: Mon, 18 Apr 2022 06:33:39 +0000 Message-ID: References: <5f142468-bc68-9128-d4d6-80cf36f12a48@polymtl.ca> <87169b93-8be2-5ccd-6b58-51b395a367bd@polymtl.ca> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: 9e1d213b-edb7-6c54-1dde-e2aa254eff61 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1cae7d92-67a1-4fea-e452-08da21055fe1 x-ms-traffictypediagnostic: BL0PR1501MB2065:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uzUSAEdSEeIE7dme4f42bPrO91UjIj7yRVWu5Ue951+0pnPolW9ROatM8YC0TP6XEIOqh0LijdcM3tnDvJByZa3CifsTCZnO8nQ3tbX1b1gftGLnTOwBPuwnvEwct3JfUv62BFamhMlJGv2vt9chNA//dWeV9w1Vdx2SRqV3+FwunmgGnKSQu6TN9GfL6MRnmttbGT0YEg4QUYuX1UQ9N4DKaFkJx9GL4Qv1VGWxwrIZHjlDxfOFoZPVCEAPlbWpEIBLcoQum2gEWLVjnDVMH2VXQRQ42kHrLUe+cXGy4bmPc7QnUHcjEeGUJiB3UPx7UNHJyUincV39gCmKYvmPHW2DhJsu63r36HToXbQqiVsfPqJXnQxmls9NtFY/w+4U2ede16zHgyLfOvD6+tGH0kTMPHwzLm8rxaxA2vsNYr9zsSXD58tbz6xTLCO/eh5f2ZYEPrcBISB8AxEZ++s6/BYP7g6iFyJHV7O8dptn/Jln1d2qisujv/X1jqzMW8Oc5r+EvuV3ukNOHE5kP/jgxOJrYeIuvIZ+IduZRkKb3HjfszkMyzrukE/Q45JoGh+GnkKZd1vg4PVTfhqcyIuMR2PRilEiouQL2wm/KVtRHVQjaYt/6hpVrakdEoiQIOC2145lk8LQ4kiky2JNWBo0DiKpoRbRZq8zIwDAS7DTxZ3SPVjDLtXxSdb1unJEKcHr x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR15MB2867.namprd15.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(316002)(55016003)(8676002)(6506007)(7696005)(9686003)(83380400001)(33656002)(38100700002)(508600001)(122000001)(30864003)(8936002)(52536014)(5660300002)(66476007)(66556008)(53546011)(66446008)(66946007)(71200400001)(91956017)(4326008)(38070700005)(2906002)(76116006)(64756008)(110136005)(86362001)(186003)(19627405001)(26005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?MjtgF9dCmRqZa88DnjzSaRjXsy+2bRcIXK1p5pNuXVtiD4mk0wOlJca8JZS4?= =?us-ascii?Q?0TwWhdZPr1D//qSu8gaGtUsJ+346m7AEkoPOAIzGMDESOX/0HsbaxxZWWu36?= =?us-ascii?Q?3BO0OmBdtScg9wcx6p+FhzYf/kCp1LxkCXOy/4R1Qj11s++nnmqGTHi8KdcI?= =?us-ascii?Q?17EZWhqB5S5ODX6GBBMYB2yD1UYJyr6iFikVSUtvzdwAh/+12GpfX17aahW6?= =?us-ascii?Q?tvsaRMHrbakIO3BXJy+/CnAIHTeZgifCEckvYMXjrNPzxghkO3w/jBYS/Lyb?= =?us-ascii?Q?9nP8m81LE2SiqPL955GiCjJcKM5z9FCnRXXFX6Mw/FqEC1/qJcWp3WlX+Sku?= =?us-ascii?Q?hcdXbIe76X7XHfsjyXch/53wJDNl9FFhFfsCi2SjKZC0PkGWiFgXIM4DNlq/?= =?us-ascii?Q?UMEuEveCDlDMi0FazExWpJbCH26htkS+aVKSVaxuNXVu3SpW3G3ZkQ0aXdU8?= =?us-ascii?Q?94fpLLeQ0e8C8AtxSxg2VfPc6A0vLhFqoFQt11t1T5vgNCoQ2wPtgZrekJbl?= =?us-ascii?Q?izFkqIiOhQONIvDhYBXkWh8u7dGxRCQWddQl5/7Ni38Il6mON3h3WLChfc8L?= =?us-ascii?Q?fNb4P0GkYLcMhwxbRUAbpIFaRnTiaTNO2ZGS0c/6rbeq+i0QVtNB3kjaoDf5?= =?us-ascii?Q?sZExHbbNWMHH5/huYIMt4u9EiT67JPhzxlcj+fiyWUWsQl6A2FWCVJuTxmaO?= =?us-ascii?Q?Z7yNmdSME7/ExJgCgnU1RyeyglBVZ70o+A0DXWIzOK3LV2r0lgbBH7u8Pb/u?= =?us-ascii?Q?eTj6RUCHhrsFLIXXSamwv4g4IzJvEUQEdVnV3SmtWzTOJ40if/7Qh3ioB1tL?= =?us-ascii?Q?NAWuIhivjBDy5yZYoTyUjnzYWw2VlE47DVb8nRYhdTFQgBmaf8HgjlCkRxZS?= =?us-ascii?Q?o327iPwZ6eJFuiLtMReZrr/utHA9IG372WesRc+if/mW2TZkilbz7PZ8O5g6?= =?us-ascii?Q?85ujHM66PVKurqRD1G72VWHJYkcsBIj5o0FLMFuohd4lpS4JHWHEMSckf1Wl?= =?us-ascii?Q?gHCFF/PdykkvyN/DWWs47yeUEvocu5qX5HoDQJnJJeLNOeHh4sw0hOP//Qs/?= =?us-ascii?Q?jDu5nIAWnePQOuTXUEtJlnR+IZM7J302gA9UgGlKmiLvP3vcu0kDRVtn8TYW?= =?us-ascii?Q?pNjpi2r0+HLmfwXK00+Y1a5tpqnbG5XQ3BMlQ+FyBt6nDThY5Jp8CEhDc2K2?= =?us-ascii?Q?SszrwLEZoL7Ja+thrVunyBj4pIMZod6O7lVK5ZFzdueloFlkx244J7YHr5Pb?= =?us-ascii?Q?lXhF1W7T5AfKHL212Ex7oFTh9eZfTdOYCU4AOaBwV8jJn/qvIO3RIAAkCFH1?= =?us-ascii?Q?s6vlUD3B34mLrxv2/80xRZzHut5aRf/zhKuyIz8qGwPmWm+fj5Dwu/T9utZz?= =?us-ascii?Q?a+IrVVWf3r2P3saio+XrzX/CLMwkFMR59fjXx22TQ3mYfY7eZ0IZ12zOzpJ0?= =?us-ascii?Q?toKA472e5PmlJcU8u6h2Dr/BOzc15i+fL21ohZnHmFRA6YFeme5rf5/NeMjJ?= =?us-ascii?Q?9V+c/w9+ZMu3j44+84pL7h7PopLlm3Av3jBiMAGhk8r2abEEpTsRr3LutAVQ?= =?us-ascii?Q?ykgBwXu7K3lxJFst2OT41D6Pvkf4ReuG2Gh/2vf3kizlhBL/Bc7AqYICOb7z?= =?us-ascii?Q?XqH+KpKz1G62I8/x/VeIpnrR6+EOeDsPaL4xPqNLLlDXSXtqLf3GVAVim0Qk?= =?us-ascii?Q?KYUPvfffuNZ86/5tHYkybAFutEK6blSKO3o62TghVC2ahWV3KCskT0gu6qB9?= =?us-ascii?Q?SF4NXttkMrx/5KLPMpkedhQ+zPAx3SQ=3D?= MIME-Version: 1.0 X-OriginatorOrg: ibm.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR15MB2867.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1cae7d92-67a1-4fea-e452-08da21055fe1 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Apr 2022 06:33:39.2601 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: fcf67057-50c9-4ad4-98f3-ffca64add9e9 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nD8ZgCdAGgmNkN5p/gEdtxuEND5fFxZTOKc5027ype5OvQRiwB17fa7p1TkWXY73rh7quTXRLVXB20L/ufTVppjBaRGyv8TCnAPt3VrJkR4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR1501MB2065 X-Proofpoint-ORIG-GUID: 3Nw6mxuu4EmNaiP7klFIksejEV-B_lNv X-Proofpoint-GUID: 3Nw6mxuu4EmNaiP7klFIksejEV-B_lNv Subject: RE: [PATCH] Use current_inferior ()->pid for AIX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-18_02,2022-04-15_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 priorityscore=1501 adultscore=0 malwarescore=0 suspectscore=0 phishscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204180037 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2022 06:33:54 -0000 Any update on this? Kindly let me know. Thanks and regards, Aditya. ________________________________ From: Gdb-patches on behalf of Aditya Vidyadhar Kamath via Gdb-patches Sent: Tuesday, April 12, 2022 7:02 PM To: Simon Marchi ; Joel Brobecker via Gdb-patches = Cc: Sangamesh Mallayya Subject: [EXTERNAL] RE: [PATCH] Use current_inferior ()->pid for AIX Hi, A case by case analysis as suggested by you the last time has been done. While the child process [the program to be debugged] is running inferior_pt= id.pid() will not contain the child process ID. One has to use pid_t(curren= t_inferior ()->pid) inorder to get the child process in AIX. GDB may allow = you to execute many programmes at the same time. Numerous threads of execut= ion can be initiated from multiple executables in each of multiple processe= s. GDB uses an inferior object to represent the status of each programme run. = An inferior usually correlates to a process, although it is more broad and = may be used to targets without processes as well. Inferiors can be produced= before a process runs and kept after it has completed. Inferiors have thei= r own unique IDs, which are not the same as process ids. Each inferior may = have several threads going through it. As a result, inferior ptid.pid may n= ot need to contain the current inferior thread id. To obtain the inferior p= rocess ID, we must utilise current inferior()->pid in particular areas. When the child process's pd_active variable is not set i.e. the process is = not active one has to use the pid_t(current_inferior ()->pid) instead of in= ferior_ptid.pid() in AIX. This can be demonstrated by the following code: #include #include int main() { int i =3D 1; return 0; } Sample output without patch changes only in aix-thread.c at line 883 and no= t in rs6000-aix-nat.c: inferior.c:303: internal-error: find_inferior_pid: Assertion `pid !=3D 0' f= ailed. A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- 0x100e87543 ??? 0x100e8770b ??? 0x10003724b ??? 0x100037697 ??? 0x1000363f3 ??? 0x1000593a3 ??? 0x1000594ff ??? 0x10053aa9b ??? 0x1002f6e7b ??? 0x1002f2ec3 ??? 0x100b26d43 ??? 0x100302a03 ??? 0x10077e413 ??? 0x10077b1a7 ??? 0x100001dff ??? 0x100002007 ??? 0x10000421b ??? 0x1000042ef ??? 0x100000a9f ??? 0x100000583 ??? --------------------- inferior.c:303: internal-error: find_inferior_pid: Assertion `pid !=3D 0' f= ailed. Sample output with patch changes in aix-thread.c and without patch changes = in rs6000-aix-nat.c: Child process unexpectedly missing: There are no child processes.. Program terminated with signal ?, Unknown signal. The program no longer exists. Output with patch: (gdb) b main Breakpoint 1 at 0x1000070c: file test.cc, line 3. (gdb) r Starting program: /home/gdb_tests/test Breakpoint 1, main () at test.cc:3 3 int i =3D 1; ------------------------------------------- When there are multiple threads running in a debugging process, inferior_pt= id will not have the exact current inferior thread. Instead we need to use = ptid_t (current_inferior ()->pid) to get it in AIX. This can be shown by the following program: #include #include #include #include #include pthread_barrier_t barrier; #define NUM_THREADS 2 void * thread_function (void *arg) { pthread_barrier_wait (&barrier); while (1); /* break here */ } int main (void) { int i; alarm (300); pthread_barrier_init (&barrier, NULL, NUM_THREADS); for (i =3D 0; i < NUM_THREADS; i++) { pthread_t thread; int res; res =3D pthread_create (&thread, NULL, thread_function, NULL); assert (res =3D=3D 0); } while (1) sleep (1); return 0; } Sample output without patch changes in aix-thread.c at line 921 and 883 and= not in rs6000-aix-nat.c: inferior.c:303: internal-error: find_inferior_pid: Assertion `pid !=3D 0' f= ailed. A problem internal to GDB has been detected, further debugging may prove unreliable. ----- Backtrace ----- 0x100e87543 ??? 0x100e8770b ??? 0x10003724b ??? 0x100037697 ??? 0x1000363f3 ??? 0x1000593a3 ??? 0x1000594ff ??? 0x10053aa9b ??? 0x1002f6e7b ??? 0x1002f2ec3 ??? 0x100b26d43 ??? 0x100302a03 ??? 0x10077e413 ??? 0x10077b1a7 ??? 0x100001dff ??? 0x100002007 ??? 0x10000421b ??? 0x1000042ef ??? 0x100000a9f ??? 0x100000583 ??? --------------------- inferior.c:303: internal-error: find_inferior_pid: Assertion `pid !=3D 0' f= ailed. Output with patch: (gdb) b main Breakpoint 1 at 0x1000070c: file test.cc, line 3. (gdb) r Starting program: /home/gdb_tests/test Breakpoint 1, main () at test.cc:3 3 int i =3D 1; Summary of the gdb.base testsuites. Without Patch ------------------------ # of expected passes 8096 # of unexpected failures 2160 # of unexpected successes 1 # of expected failures 4 # of known failures 5 # of unresolved testcases 113 # of untested testcases 83 # of unsupported tests 40 # of paths in test names 2 # of duplicate test names 13 With Patch ------------------------ # of expected passes 13822 # of unexpected failures 7399 # of unexpected successes 1 # of expected failures 11 # of known failures 6 # of unresolved testcases 78 # of untested testcases 88 # of unsupported tests 63 # of paths in test names 1 # of duplicate test names 2 (See attached file: 0001-Use-current_inferior-pid-for-AIX) Thanks and regards, Aditya. ________________________________ From: Simon Marchi Sent: Tuesday, April 5, 2022 6:17 PM To: Aditya Vidyadhar Kamath ; Joel Brobeck= er via Gdb-patches Cc: Sangamesh Mallayya Subject: [EXTERNAL] Re: [PATCH] Use current_inferior ()->pid for AIX Hi Aditya, I don't think that using current_inferior throughout is a good solution to your problems. It will be case by case, unfortunately there's no easy way out of this but to dig in GDB and understand its internals a bit. > From eb10e0ebc422d01f5ce96786f0bcf78a4f57d7ef Mon Sep 17 00:00:00 2001 > From: Aditya Vidyadhar Kamath > > Date: Wed, 30 Mar 2022 11:19:14 +0530 > Subject: [PATCH] Use current_inferior ()->pid for AIX. > > --- > gdb/aix-thread.c | 15 ++++++++------- > gdb/rs6000-aix-nat.c | 8 ++++---- > 2 files changed, 12 insertions(+), 11 deletions(-) > > diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c > index 85be4c15f1c..9331de3beb2 100644 > --- a/gdb/aix-thread.c > +++ b/gdb/aix-thread.c > @@ -708,7 +708,7 @@ get_signaled_thread (void) > > while (1) > { > - if (getthrds (inferior_ptid.pid (), &thrinf, > + if (getthrds (current_inferior ()->pid, &thrinf, > sizeof (thrinf), &ktid, 1) !=3D 1) This function doesn't seem to depend on the current inferior/thread, so it could easily be changed to receive the pid as a parameter. > break; > > @@ -791,7 +791,7 @@ sync_threadlists (void) > > /* Apply differences between the two arrays to GDB's thread list. */ > > - infpid =3D inferior_ptid.pid (); > + infpid =3D current_inferior ()->pid; > for (pi =3D gi =3D 0; pi < pcount || gi < gcount;) > { > if (pi =3D=3D pcount) > @@ -883,11 +883,11 @@ pd_update (int set_infpid) > struct thread_info *thread =3D NULL; > > if (!pd_active) > - return inferior_ptid; > + return ptid_t (current_inferior ()->pid); > > status =3D pthdb_session_update (pd_session); > if (status !=3D PTHDB_SUCCESS) > - return inferior_ptid; > + return ptid_t (current_inferior ()->pid); Here, the pd_update function seems to want to return the event ptid unmodified. So, perhaps that ptid could be passed by the caller and returned here. Or, pd_update could be changed to return an optional and the caller deals with returning the right ptid. > > sync_threadlists (); > > @@ -897,7 +897,7 @@ pd_update (int set_infpid) > if (tid !=3D 0) > thread =3D iterate_over_threads (iter_tid, &tid); > if (!thread) > - ptid =3D inferior_ptid; > + ptid =3D ptid_t (current_inferior ()->pid); > else > { > ptid =3D thread->ptid; > @@ -921,7 +921,7 @@ pd_activate (int set_infpid) > &pd_session); > if (status !=3D PTHDB_SUCCESS) > { > - return inferior_ptid; > + return ptid_t (current_inferior ()->pid); This is the same idea as in pd_update. > } > pd_active =3D 1; > return pd_update (set_infpid); > @@ -932,11 +932,12 @@ pd_activate (int set_infpid) > static void > pd_deactivate (void) > { > + ptid_t ptdrtn =3D ptid_t (current_inferior ()->pid) > if (!pd_active) > return; > pthdb_session_destroy (pd_session); > > - pid_to_prc (&inferior_ptid); > + pid_to_prc (&ptdrtn); Since pid_to_prc only writes to ptdrtn, it essentially a no-op. I would try just removing that call. It was used to modify inferior_ptid after the thread layer was disabled, which does not seem useful to me. > diff --git a/gdb/rs6000-aix-nat.c b/gdb/rs6000-aix-nat.c > index 8563aea313a..0b8e4d2c687 100644 > --- a/gdb/rs6000-aix-nat.c > +++ b/gdb/rs6000-aix-nat.c > @@ -397,7 +397,7 @@ rs6000_nat_target::xfer_partial (enum target_object o= bject, > ULONGEST offset, ULONGEST len, > ULONGEST *xfered_len) > { > - pid_t pid =3D inferior_ptid.pid (); > + pid_t pid =3D current_inferior ()->pid; > int arch64 =3D ARCH64 (); > > switch (object) Here, inferior_ptid should be valid, this change should not be necessary. > @@ -525,11 +525,11 @@ rs6000_nat_target::wait (ptid_t ptid, struct target= _waitstatus *ourstatus, > > /* Claim it exited with unknown signal. */ > ourstatus->set_signalled (GDB_SIGNAL_UNKNOWN); > - return inferior_ptid; > + return ptid_t (current_inferior ()->pid); > } > > /* Ignore terminated detached child processes. */ > - if (!WIFSTOPPED (status) && pid !=3D inferior_ptid.pid ()) > + if (!WIFSTOPPED (status) && pid !=3D pid_t(current_inferior ()->pi= d)) > pid =3D -1; > } > while (pid =3D=3D -1); The target_ops::wait method implemenattions should ne rely on the current inferior either. I don't think that this target supports debugging multiple processes at the same time, but imagine that it does, eventually. When rs6000_nat_target::wait gets called, the current inferior is one of the inferiors managed by that target, at random. So what the wait method needs to do is fetch an event from the OS, and returning, regardless of which inferior it applies to (except if a ptid argument is given). So, you should never need to use either inferior_ptid nor current_inferior in wait. > @@ -658,7 +658,7 @@ rs6000_nat_target::xfer_shared_libraries > if (writebuf) > return TARGET_XFER_E_IO; > > - gdb::byte_vector ldi_buf =3D rs6000_ptrace_ldinfo (inferior_ptid); > + gdb::byte_vector ldi_buf =3D rs6000_ptrace_ldinfo (ptid_t(current_infe= rior ()->pid)); > result =3D rs6000_aix_ld_info_to_xml (target_gdbarch (), ldi_buf.data = (), > readbuf, offset, len, 1); This is used by xfer_partial, where inferior_ptid should be valid, so this change shouldn't be necessary. Simon