From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id eIuTLP1EamM9PxUAWB0awg (envelope-from ) for ; Tue, 08 Nov 2022 07:01:01 -0500 Received: by simark.ca (Postfix, from userid 112) id B25D31E124; Tue, 8 Nov 2022 07:01:01 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=ZibAqKql; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 4396E1E0D3 for ; Tue, 8 Nov 2022 07:01:01 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3A3C43854176 for ; Tue, 8 Nov 2022 12:00:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A3C43854176 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667908855; bh=rXoi3FO6iHeN/OM+L9MNDQaqCNsnN17EB1fsIkG2Lic=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ZibAqKqlEiQ0FFuMjG4Ky7L/NrM5XPF/XCcPsyuZsmmOIRpZT10Jq0OQbztvpCkt1 X0eF+AMsRt8wxkTJokq/ZA1ZRHsmlk+i3OnACxZsyOEXrooRZAKpRjaOno0UTEuOkX CW8D5TbXtKBlJ4O8+4RAimLnQJ3uP6ebEO99bvwo= Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 10DF23858402 for ; Tue, 8 Nov 2022 12:00:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 10DF23858402 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A8A3U6m025970; Tue, 8 Nov 2022 12:00:29 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2173.outbound.protection.outlook.com [104.47.59.173]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3kqn18k0gc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 08 Nov 2022 12:00:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lYI2waozTaH1MbOHTyqLmDS9m0uUDAtWPH77LGPdPGPv5Hn2p0mpm+yYK5Yj8IO8UbUxkrMJRs1OznMTzyLD/y2tgS9E0G8UPBpkwm21DQzc5OTBQYORmstfLQAS8LXiKjwXXlDIbJfK56yq6ctHKg3kZ1KH51aJolmzAynCecr+NNUArX6A/WCTk52QMgmQJsGWpo2zcnRJ3mU5j/R7i4/YavAGpuqtXTO4eqZkhMb+C3iulu8uuMxoaSPd9H46aA55JTJh5rDhGfsC/z2ksxTNEU/fg8NvMkhL5I/HGqDa+n4KnI8gimUhEN04TMroYvzKHYiczpm2UPw4caktNQ== 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=MDVORnkHpFjPmFkfNlzWgR9Ns0CxeIv2wR/PjOIw5u4=; b=T8pb0BKXC3AreFYru1/aFUKiZ+ZNLQ2GEQdsfUlAYTTr7gCTsX8mtu8sLjHYpW8ox95PppezVCqzywUhEvpsD/1aNxFKA7oIBC/kSa9bVPPWjpnQSb8jJF25DDUEtft32b0uYbDP6YPDioq/clk5r2X3b/UxSrjvnlHH/AF4BzRGuHECNPKfpmC2yH3kbM1owl0Xu5DovwzX90Etc5NGIR3elkWBM0r016FiJQosM9xXSh10lq+rBhR4+V3A1ffh2FFtTMyhsZXtQ6KJDCN//Ne3ykAjgqzJHpcurDkq5wwtRWNBxf7cazWXSB+SCY2zVlh8JSiw5L4uug4R0Yzgmg== 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 SN6PR15MB2413.namprd15.prod.outlook.com (2603:10b6:805:1b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Tue, 8 Nov 2022 12:00:25 +0000 Received: from CH2PR15MB3544.namprd15.prod.outlook.com ([fe80::4b0:172e:c48:151d]) by CH2PR15MB3544.namprd15.prod.outlook.com ([fe80::4b0:172e:c48:151d%7]) with mapi id 15.20.5791.026; Tue, 8 Nov 2022 12:00:25 +0000 To: Ulrich Weigand , "simark@simark.ca" , "gdb-patches@sourceware.org" CC: Sangamesh Mallayya Subject: Re: [PATCH] 0001-Fix-multi-thread-debug-bug-in-AIX.patch Thread-Topic: [PATCH] 0001-Fix-multi-thread-debug-bug-in-AIX.patch Thread-Index: AQHY82mw/itJdafR3kib+cFzCP6i5w== Date: Tue, 8 Nov 2022 12:00:25 +0000 Message-ID: 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-traffictypediagnostic: CH2PR15MB3544:EE_|SN6PR15MB2413:EE_ x-ms-office365-filtering-correlation-id: 42914db5-56b0-4e8b-ca5a-08dac180d290 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: a1XR4b9z+3RM6wBT9r479Y6W3ynfpwltl1u53HS+qW2u1XVwCFP53SusfzNAV5fbavEDZGHYoz79CMIBBHNHaNMTXIVjpiFkeYrLft8dZpNR/9iU4A4o62pN0l5kEECCGDs2Gb6qVp3637mNUot+lVUIdVaYSl0dOqw2rG5ZvNTbvNhUSJpLImMaQ2FHu9jNQArnOSvv7IanznXv8t/DzMzkImUtuhtT9jfsA0ocTZ1Px0FEJoXeqvXtovvH0cJWEiF+fyVum5sHQWQ1Poz11KO5pIaxUXkbOBVIvUAc3wRyxPs/cT4ezjo49FEFFjps8Gdf3L9z3Ee7I5JY0Km4ebM49jgw8Cy7BZKgm7DTG2u5HciRBoW8sf+ImmhKiZdeVasDlgBMJNOG9FIm7c7+sQbsSIBNPRQoV/LoUCdSmhex12+572fuIacP6Q0lOdLZ/v0UbPyLt7yVB/LkhIq080+3GyL16MXnmsLauYZaH5VwQT9QVUHHYD0AgGqoEyu+qCvhSYETKmqn4UFx6r73j00vy193DquMXeCb/mr939b0RBTzLuosXBJn0DkuveH6OoTRoUf2CYO6dl/XOtcvh+VZW+Tw9C9VpDSwzSE1J9hrIrg9RtxA5kf1ttiFkDKRUnpHWMiOv2MRbNoMuzZAEKjrBG8uu+Vmii0hJCG6hBxgdzoc9KoiXD6vxdUIa1dgbiAIYYKTRc/IZUv/qHAQjVKxLEGYAEMUJjUwurAZFt19x7x8plR1Qpn0VVPN4w9ipLHs4e98L6Qu9EeV60haIg== 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:(13230022)(39860400002)(376002)(346002)(396003)(366004)(136003)(451199015)(478600001)(41300700001)(55016003)(33656002)(38100700002)(83380400001)(8936002)(2906002)(122000001)(26005)(9686003)(7696005)(53546011)(6506007)(86362001)(52536014)(5660300002)(38070700005)(186003)(19627405001)(316002)(8676002)(4326008)(66476007)(66446008)(66556008)(64756008)(66946007)(71200400001)(91956017)(76116006)(110136005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?iBjzZCBuxVQZfVBidN6nOnXlLiH7PgIOONRWz1PV0M8+i0azJSJvOzAkcA?= =?iso-8859-1?Q?lgpLC4J4vwQu7IKFhdrW9ZZv5UfvK/DEKOgYSksLEM0GjG1nWB9Aj0y//s?= =?iso-8859-1?Q?xy+E282sBPDsrPD/8nIqvWbO7uI253I2XqQWntp0nPsub5ZOWWXvkcq+zp?= =?iso-8859-1?Q?PuNzplUqx/T3E/BkvGn5U2OEiFenhrCNWzK4uZGhN0XgZTygaaXB4r3t3Y?= =?iso-8859-1?Q?/o6T//mvj7v+BdoV+4yOl578M4MBdXvKQDIibMToE8omDiCsvX7Kyt/Bx+?= =?iso-8859-1?Q?qzyVY6/tc7j+XYXvDfSazxs/cOFBx9eXT1xSCAO79iC4/OKlLhbtV9Rtu9?= =?iso-8859-1?Q?bv1oP9rQCQ29N3MLWBrPNB4TQw7cNG34XAMcBTvg6a0Eyv7MvFdtCavHx5?= =?iso-8859-1?Q?F7OaUGiePOWMEBPxImUOLyM5LpxLhSlKXKJerxfLF0Os7w2vucRaVrTtOi?= =?iso-8859-1?Q?KOHtuQH//BdILt8Rgszf5s6iDmCY1uYCyAvtpKnlexaayHIXDImZSur72Y?= =?iso-8859-1?Q?T068WXGGee6qiWF3OAEDokN7c7Nv+Pu6LNNi8Ggc+hlWQ3fEWYzrkk+LH8?= =?iso-8859-1?Q?a1dKn6OPhaKOLo9Iod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?Q?C+omfrq2wOlnURcY4pqlGiZ9EXda/++ckYcTel80uwbRT8OIKIPiApXxCv?= =?iso-8859-1?Q?HR0tu26Hxad6qPnIHkbhQPa5ZbKucRlCw7ifmXBnrY6G0ivEKD7ByMa1Ao?= =?iso-8859-1?Q?lNMQpx/dB+JUCpul2y/gEa6USb9ZV9+s7J?= MIME-Version: 1.0 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: 42914db5-56b0-4e8b-ca5a-08dac180d290 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Nov 2022 12:00:25.8400 (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: w0Wyj4vsEq+6TladKPHcWjuFxFGG+kB29CGzLvgWE4mhkiJC3LzHLhJ8S5BfHwdRHtWkglXDA9CxwD/D9+pvGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR15MB2413 X-Proofpoint-GUID: bXblzPKs7ygsaql4A0HxvlAJ7VLtkNNg X-Proofpoint-ORIG-GUID: bXblzPKs7ygsaql4A0HxvlAJ7VLtkNNg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-07_11,2022-11-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 bulkscore=0 impostorscore=0 clxscore=1015 mlxlogscore=945 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211080065 Content-Type: text/plain; charset="iso-8859-1" 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: , From: Aditya Kamath1 via Gdb-patches Reply-To: Aditya Kamath1 Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi Ulrich, >You should find out why the "priv" field isn't >set up correctly, and fix whatever was going >wrong there. (I believe this should have been >done in sync_threadlists.) You were right about this. What is happening is the main process and the th= read representing it are treated as two separate threads by the libpthread = library. Main process had no private data set whereas the thread representi= ng it had. Usually, both of them should have it and their private data must= be the same. For example , Consider the program below:- [ Program Credits:- GDB test case continue-pe= nding-status.c] #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; } Here is the gdb output of the above code, Clearly when I switched to threa= d 2 which same as thread1 and interrupted, thread 1 received the input. So,= when we added a private data in sync_threadlists() we added for thread 2 b= ut not 1 which is main thread and same as thread 1. This is why we got that= assertion failure as thread 1 did not have a private data. Reading symbols from /home/XYZ/gdb_tests/continue-pending-status... (gdb) r Starting program: /home/XYZ/gdb_tests/continue-pending-status [New Thread 1] ^C[New Thread 258] [New Thread 515] Thread 1 received signal SIGINT, Interrupt. 0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o) (gdb) info threads Id Target Id Frame * 1 process 12059046 0xd0595fb0 in _p_nsleep () from /= usr/lib/libpthread.a(shr_xpg5.o) 2 Thread 1 (tid 39125487, running) 0xd0595fb0 in _p_nsleep () from /= usr/lib/libpthread.a(shr_xpg5.o) 3 Thread 258 (tid 23396809, running) thread_function (arg=3D0x0) at co= ntinue-pending-status.c:36 4 Thread 515 (tid 36503883, running) thread_function (arg=3Dwarning: (= Internal error: pc 0x0 in read in psymtab, but not in symtab.) 0x0) at continue-pending-status.c:36 (gdb) thread 2 [Switching to thread 2 (Thread 1)] #0 0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o) (gdb) c Continuing. ^C Thread 1 received signal SIGINT, Interrupt. [Switching to process 12059046] 0xd0595fb0 in _p_nsleep () from /usr/lib/libpthread.a(shr_xpg5.o) (gdb) I have written my comments in the patch. Hope this works and if it is right= kindly push the same in git, otherwise Let me know what you think. Have a nice day ahead. Thanks and regards, Aditya. ________________________________ From: Ulrich Weigand Sent: 28 October 2022 15:19 To: simark@simark.ca ; Aditya Kamath1 ; gdb-patches@sourceware.org Cc: Sangamesh Mallayya Subject: Re: [PATCH] 0001-Fix-multi-thread-debug-bug-in-AIX.patch Aditya Kamath1 wrote: > static aix_thread_info * > get_aix_thread_info (thread_info *thread) > { >+ if (thread->priv =3D=3D NULL) >+ return NULL; This doesn't look right. Note that all users of get_aix_thread_info assume the pointer returned from there is never NULL. You should find out why the "priv" field isn't set up correctly, and fix whatever was going wrong there. (I believe this should have been done in sync_threadlists.) Bye, Ulrich