From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id EAE153858287 for ; Tue, 23 Aug 2022 06:52:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EAE153858287 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27N6VH1U003322; Tue, 23 Aug 2022 06:52:27 GMT Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2044.outbound.protection.outlook.com [104.47.51.44]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3j4spvrhck-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Aug 2022 06:52:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BSOfzORR+9Ke650cTE8ldLiWbqp33ZUsIWT+YkVPxTxuhUHZFDMrLfN+UMBnxFhjIfBdWDNO/uO8Ixr+bu6cHDFWteI/cN+5liicmPHoiFZne5x6hV7RbUuPO8GO5sQvvphWcPTBIxL/AiRpckmB426vJhO4YHJuIY4A7CqdwIv2SH4aufxUP5+xuT/IQ4dqQXbx873DNPv6C6kzKreJ0o+VSLXZ6zkLr9u50q2ipvzrmAR0kVbUOvICv8Y5BTtWkFZfzeT87IXa5AoT678J4eEcO2YV+XknO6v2mnPbRC0RdRtoG25FDFWijAmKZ1E+3+S7CQpV+5fql3KsTz2eSw== 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=SZzAZsdneJjrgaa6B4OuycJWr4Qc1OqACOropIdfAXg=; b=cuHR8x1bRojsQ+mle50hW32JkiHgdXs9Qsw/EDVSLlLxwNsYxYvr4gDKN7EhjikhBaNNRHjU89nGcSei/gyOAPrZ18CxuiLOCgYhsECAzpfgUKH+supa5HlFzRxJBe2aYmUQcAGXYodYOrg9eq+qKr3wFUF6RplsySmG/xNA10NDsRdgQBb8WPegLhfs02p8H1R10QH7A2Sb/wfvOj5ERMl6lae9Hjvc11Yq1wKgDOb7a+aygvAs32eY7bhDn/Sx/XNVRrqWtzSgdqo+c7qOGv2UXRUPN1v0W9bQ0Fu65XpyP/sM7lmsMlpwCkBBlX66HZGVeqFSL6YfrxaD2tXKBg== 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 CH2PR15MB3544.namprd15.prod.outlook.com (2603:10b6:610:5::26) by SN7PR15MB4224.namprd15.prod.outlook.com (2603:10b6:806:f5::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.23; Tue, 23 Aug 2022 06:52:25 +0000 Received: from CH2PR15MB3544.namprd15.prod.outlook.com ([fe80::802:6dec:b874:f15b]) by CH2PR15MB3544.namprd15.prod.outlook.com ([fe80::802:6dec:b874:f15b%4]) with mapi id 15.20.5546.022; Tue, 23 Aug 2022 06:52:25 +0000 From: Aditya Kamath1 To: Ulrich Weigand , "simark@simark.ca" , "gdb-patches@sourceware.org" CC: Sangamesh Mallayya Subject: Re: [PATCH] Enable multi process debugging for AIX Thread-Topic: [PATCH] Enable multi process debugging for AIX Thread-Index: AQHYtiqs7fBWvNWu7U6EFq8QRxtmC628DMiA Date: Tue, 23 Aug 2022 06:52:25 +0000 Message-ID: References: <44ad453e-6196-d334-312f-d5d0414f4476@simark.ca> In-Reply-To: Accept-Language: en-IN, en-US Content-Language: en-IN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 54a40fea-ebff-44d5-4f4c-08da84d40977 x-ms-traffictypediagnostic: SN7PR15MB4224:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: nxvlCIlDhQriJ3phrWD5edGpSodSwx/hb8KcF1SClq1FOXFzBBFx5oN8FjvVaWmU0iExBEwiGY0ZAse9Vjy0E4rGAdQ3/RYe8MdhJhjjpnFbOV8ZXLrollYtU/+gggW716876mI9luKOOABCzCE2q117ymEVCWPQn9+2BLhI4tCGsaTOcAr/mwK52lNWIEW1maMD5w47zb4qS10srvacT+kqFfXOlsm+YWxzmPNRXoqi2tCY0+BVbpZw4tZ2jqwZOGA5YjEOlNVwZX4VidIwZ2QqHsIyKqXwdBClfiuOWcBFhTlc0ovdXtTI51f7zduu7KkimBrc3AOFqzbWgkfSAnOWQBLFLGUqUS/BBnm64BH0OJdcAgno6XvIfXA4xq9GX38hNTbrC3rxUkFLhRSqmFTQwjRk3rpLJPUoEmGqy0zrrDkB93GdljjD5Erte2Q69oU8IA5KGCr8Gu7/1lLYFiy79IpUjjPahWUvGQ80DPI32iPGY8FxLTJB9nbeOJqPDpSR28czrPLfG+v03abnjaop60flvQ5Yc6OsKjwbI+KBLndmCC5mfdob81kHxIt2Xovvvh/OqQ6uRXKfbH6/Y4FyAD2Du50Fk+7FwJ5oMJsqSxin8meR62q8xoL8XlRZagwiZw9rM4AiZghu9GQo2GMiSpnSQtE+maGSmkFiGug2C/17f/k0jIJ/voENIqvOsda/MAZjT3w+JqWlmALdsoSl9CnZ/m/xKsTalqq0KRRI5FyTDPYx64cYc26DKbEDrWCn41G4uHpe3ichYWyyha6KZoyRrm72cftAQoa3o5o= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR15MB3544.namprd15.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(376002)(396003)(346002)(136003)(39860400002)(52536014)(8676002)(64756008)(110136005)(66446008)(4326008)(66476007)(66556008)(55016003)(316002)(76116006)(66946007)(91956017)(38100700002)(8936002)(5660300002)(2906002)(122000001)(86362001)(166002)(38070700005)(478600001)(33656002)(41300700001)(7696005)(6506007)(53546011)(71200400001)(186003)(26005)(9686003)(19627405001)(83380400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?LEcX4WMANOw3XbD8qaOZr9HHRFaFOtolN4GkFYy3k6STW64dV3RR79ldFPgC?= =?us-ascii?Q?oT133SbtuUMIECLhosWAU9eviYnBGrbbWgCev5tGpIDm3HBJQXHOgH/LxiZx?= =?us-ascii?Q?CQYFDUEROF1vXxMetun4nuBjH/a5Dz9bnVl1yO4ZQT/QP51jCdRN8Q372m8Y?= =?us-ascii?Q?mzossP219GYCBF0jTASxiRj7EY6fCq/Vu/VYWsiw6tuff9cZFimrTRnTtXQ0?= =?us-ascii?Q?hSlIMzDKKEU/HnmpAiMU5KiBUh7ZK14e9UJUEDlC/TwmvxgQk79yNTy5JAhH?= =?us-ascii?Q?oAAXBPn++iR1IaAffb53VpM+w7Qu/QkLY2caoSfL+TctuRXN3f82N6z6bAMN?= =?us-ascii?Q?sD//smBJyd6wV+WXTI5dEOZHa/ZbclouyRWTidJtoONdqeMH1wK6qpn5MRyO?= =?us-ascii?Q?H9ym2p/1iL4mMRW7hGq2aLJ6wm2kYMSy9eBG5caHsExFFhCVn7Op3lI9dUoY?= =?us-ascii?Q?IfmbXB5KWn3N8UvkRM7HCIwhTf6fUpoitRuPgHmB7z2yakWGHU+KHo5FgnLz?= =?us-ascii?Q?kFytncwetxOl79QpEFPgPjBpOnzZiHwt/4rDKSS6Fj59s+fHQ0pJcpBpJ5BS?= =?us-ascii?Q?Zw93t+t2+eoYaCORZeHMDpYECQaeIffHTw6bLl1k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Q?uQRKhgSlH60TVjrSJ2qMHTdomT2Xy+2GmP+4IaiwJlghlbHOo0cARn+6OS3q?= =?us-ascii?Q?I1NFUCOyH9hMVRFHagd9fFns1V4sNyUrNuB77cSv?= X-OriginatorOrg: ibm.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CH2PR15MB3544.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54a40fea-ebff-44d5-4f4c-08da84d40977 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Aug 2022 06:52:25.2781 (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: 6Y6MgCWTQR4JhG78n+P3JvIeqsKq+Ouc6G0B54iPilxv4KL8VGm7pUDFezCHYO9BI9+l+TdOmYN+CyuBP5KKLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR15MB4224 X-Proofpoint-GUID: lpKVLikNp30AM4mIj2QLRhyX9xdKf57D X-Proofpoint-ORIG-GUID: lpKVLikNp30AM4mIj2QLRhyX9xdKf57D X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-23_02,2022-08-22_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxscore=0 clxscore=1015 mlxlogscore=613 malwarescore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 bulkscore=0 spamscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2208230024 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Tue, 23 Aug 2022 06:52:31 -0000 Hi Ulrich, I understood what you and Simon are trying to tell. I get why this patch wi= ll fail. I will get back to you all in couple of days with the solution. Thanks and regards, Aditya. ________________________________ From: Ulrich Weigand Sent: 22 August 2022 18:55 To: simark@simark.ca ; Aditya Kamath1 ; gdb-patches@sourceware.org Cc: Sangamesh Mallayya Subject: Re: [PATCH] Enable multi process debugging for AIX Aditya Kamath1 wrote: >Enable PT_MULTI option in ptrace () call along with the process ID >parameter and the data parameter enabled. Usually one enables multi >process debugging for all the process debugged in post_startup_inferior >() function like in the Linux world. >On a fork () event either the child can report a wait event first or >the parent. >A status of 57e in hexadecimal or 1406 in decimal is returned from the >waitpid () with the process ID. This can be used to detect a fork () >event. >Since the child process will not have an inferior, we check with the >find_inferior_pid () to see if the child reports first. If it is the >next wait event is generated by the parent in AIX. This is how we >absorb the parent and child event to fetch their process ID. >The vice versa of the above can be done if the parent process reports a >fork () event first. >Once it is done we tell the gdb core that we forked with ourstatus by passing the child ptid. Simon already commented on this in his initial review, and I think this is still not completely addressed. Most importantly, your code simply assumes that it is guaranteed that the two wait events for parent and child will arrive immediately after one another, and the only uncertain issue is the sequence between the two. Is is actually guaranteed that this is the case? Or could we also have random other wait events (e.g. from other threads / processes) that can be reported in between? In that case, your implementation now introduces a race condition where some event might get lost. A proper fix might then have to be more involved, e.g. by storing those event on some sort of "pending list" and only report a fork event to common code once both sides have checked in, similar to the FreeBSD approach Simon already pointed out to you. As to this: +# define AIX_FORK_EVENT 0x57e It would be much preferable to use the official names for these constants. For example, the document you mention here: >More about this can be read in the document >https://www.ibm.com/docs/en/aix/7.2?topic=3Dp-ptrace-ptracex-ptrace64- subroutine talks about: W_SFWTED Process stopped during execution of the fork subroutine. Is this the 0x57e event? If so, we should call it W_SFWTED in GDB as well, and not some made-up name. It would be great if you could find the official names for all the other "magic" constants like 0x7f, 0x17f, 0x137f etc. as well. Bye, Ulrich