From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id 292DF385E836 for ; Thu, 2 May 2024 23:56:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 292DF385E836 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 292DF385E836 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2610:1c1:1:606c::19:2 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1714694193; cv=pass; b=uMruZXpY9kictF5rWtR2AtuH/aenaFXiXwEyG4N0ErNgM/IGpZIHAnAnsiRzmAoNqkbtcGXdtyXGguzIAJJOIN8wjCxJgNGbzfhm9oJhlpZBjuUJ6CT2JFdUj4sjWooHzqIpsVxIU9m0IUzujGATHhQwlg7flob5GDeYwmIhT94= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1714694193; c=relaxed/simple; bh=lDrbw4qf0rvwnb60TJcxwk6ayulhQTdvvFydKw3iymA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=j4NWowxhmaeLN+HMV+FQ61RNdjSp4K9gKoSwPo0s8fPhmPeQ5IbS+/a3PStbXSvqzOtsSxKevV1V+T4gx+o4Wtv52h3TYksB3vYLl46RUYeca+rOCSCZKac8JW+5LA5HtZ8i8abHZTaFXFQKfm76gsADGL6u6ftTBX1WRI4/5u8= ARC-Authentication-Results: i=2; server2.sourceware.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 4VVrSC5snKz440J; Thu, 2 May 2024 23:56:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VVrSC4yzCz4P4N; Thu, 2 May 2024 23:56:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714694187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BbQyMepkKH8UHfBsh4JNi0Jk4NTGiRIzFTNL/Kj2Eig=; b=bOi4Kgk+i6HlZ9kTs6zzrNdzE7OAucOgNe5ThbthHPkdjd26cGhdsu0hcOfO+186+YTNXg S6gxOhUp2YkEu42oLGqB3ow1tHiVicvuBapHdxSUEfnbz9LSbj0jpS/zQMa3Rhm91AVbX2 XJ/fPTWtE29vmtnBziugyO6iJQyBdUzhy+r/IqipeMIaXayudxrecsyzIvV356BSUQoGX+ PznyiyUSpxc4OHHg6cRskqjx470vJ/gbvap7ZuM0MTtFQc1dAn+p0raUOKbmBd0bITL6n1 KhQMr3K0l5zux2yf/XeDtYWDSGMwFQ2dtyCJRqnkM3ynec9eQ7QYGSeVTdAkhw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714694187; a=rsa-sha256; cv=none; b=I7hUCRo+rfj9CZN1/kt35+rZ0YUR7ofJl2yNHwG3/Dg4JYPPjfhLlcbk5V4IPNmVe82zQ8 X4cpqtQtI2e0RY9QoVYml7Ky7jhNWajNkfch5IRGlFUXNR+ckxlovosOnD1kN3kpt5w/ov JuLUwrfI3wJwv/pIiMyI4f8jcw11nv0CSeVU0I7Ydf9gKgSG1fW3DRRVPMQytYyJ6gf96q UAoBJdjcih3ECnHBYPEjrqUS3XH3XyXZNw3s1D82iGU2pZiaHeDidnkZI3VXq6tHC+/VFm IdNsEWC/+y8eerMt2haNbqQFhgNvgr9c8sWJ81QMOCFACOY0O1al+jduAgdLoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714694187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BbQyMepkKH8UHfBsh4JNi0Jk4NTGiRIzFTNL/Kj2Eig=; b=hteaO+XxKHghOWOPnAODp1qQH714YC39OUqQRpan+EwZ7Igr9QD2LBiYulfv3+BzYaXo7Y wxDhDK0YmdZvk86/reZST9Fq4rQ7aeSnMj1BymmHAqB3w8Yu5pCK5dY35xqpm6x9MnkVRs IQ+R3e7d3+dtCIYJLNjbvCkcV9Ox0p0ch8BVb490KA9M2emxHlUYqIYqmqAnX5TdvR3eqh aDbpfRCZtGLObBiov4MnvpEYjClq0AiAumjFGWaCWbNWleY7Rw0AmPhBrjUabMRp2uKin1 uhxhuPIeKFhyjUliJnSxuaG09K3VzhxLqZ70EKDnTSjOO2EvggF2v3P+k6IACw== Received: from [IPV6:2601:644:937f:4c50:58ce:9dde:82e6:3594] (unknown [IPv6:2601:644:937f:4c50:58ce:9dde:82e6:3594]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4VVrSC0DZ6zDdC; Thu, 2 May 2024 23:56:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <2c4be617-571e-477e-a5c6-b6f361663d7f@FreeBSD.org> Date: Thu, 2 May 2024 16:56:25 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] [RFC] Fix AIX thread exit events not being reported and UI to show kernel thread ID. Content-Language: en-US To: Ulrich Weigand , "akamath996@gmail.com" , Aditya Kamath1 , "tom@tromey.com" Cc: "gdb-patches@sourceware.org" , Sangamesh Mallayya References: <20240502142944.14445-1-akamath996@gmail.com> <1e5a9e180681b4412e37f62257ba4e9ae70dcd55.camel@de.ibm.com> <6c90f4ec-782c-4a67-975c-95c173800fac@FreeBSD.org> <6f8de9ca2324d117a3bb9e88a97af94859e07d8f.camel@de.ibm.com> From: John Baldwin In-Reply-To: <6f8de9ca2324d117a3bb9e88a97af94859e07d8f.camel@de.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: On 5/2/24 11:28 AM, Ulrich Weigand wrote: > Aditya Kamath1 wrote: > >> There is no way pbuf is able tell us whether a thread exits or not. >> Though a thread reached the PST_TERM state it still ends up being in >> the for loop (cmd = FIRST to last) and therefore the pbuf list. > > My point was that you could simply check whether the state is > PST_TERM and if so, just not add this thread to the pbuf to begin > with. After that, just run through the pbuf vs. gbuf comparison > as it is today. I think the one edge case with that Aditya was trying to handle is that today AIX doesn't force a stop when a new thread appears. Thus, a thread can be created and exit in between two stops. If you ignore PST_TERM threads always, then GDB will never "notice" this thread, so the output doesn't match that of Linux. The current patch Aditya has will notice this case and report back-to-back "new thread" and "thread exited" messages for these threads when it rescans the thread lists at the stop after the thread was created and exited. Even if you don't do that, the fact that pbuf will always report some sort of status for all threads (including exited threads that have been seen before), does mean that a single loop over the list of threads from the thread library is sufficient to enumerate all possible threads. When comparing the before and after versions of the code side by side I find the newer version easier to understand as a single loop over the list reported by libthread_db even if the resulting diff is a bit larger. -- John Baldwin