From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4Qx2EBaQGWqH+CYAWB0awg (envelope-from ) for ; Fri, 29 May 2026 09:09:42 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=p6N3SDuY; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3CABC1E0A3; Fri, 29 May 2026 09:09:42 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 622A01E062 for ; Fri, 29 May 2026 09:09:41 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 12BE94BA2E3E for ; Fri, 29 May 2026 13:09:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12BE94BA2E3E Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=p6N3SDuY Received: from omta34.uswest2.a.cloudfilter.net (omta34.uswest2.a.cloudfilter.net [35.89.44.33]) by sourceware.org (Postfix) with ESMTPS id 552DE4BA2E35 for ; Fri, 29 May 2026 13:09:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 552DE4BA2E35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 552DE4BA2E35 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780060151; cv=none; b=Zt3LhHe6PoM2/ES1SmnYyAjUuqR2ePg5usVWN9ri3egUwEAnfamkICqR8kvkNLlpfbBPS6ojMaCJ6MiqwiDLaHY1yxMu+u/oYvLJGq3bPgxP706nLDeCr7JQxvcOVToHkkm7QHop4S+6EzeM7UyDMdcq/ERmDAVHANgGeM9mcb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780060151; c=relaxed/simple; bh=ECkYZW+wiuccPE7FBsIPbj59KArK1E1ZfaOB1iEi5O0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=C1Ng6x4j5OptZ+mslPPIkM6qdgWvkDvU5Jl4M3rIyozbNBqf9SGjrrhLsCJJYZ/YMt8zmSV1LDriSTti384PQsv7CsuzCnOOQ06FB/1GCY4E16y8bxkI4EdS6eKLFMZEQIZXQys7Vk492EqrMsoEfJWIvnXlRcnswvIxhDth9q0= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=p6N3SDuY reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 552DE4BA2E35 Received: from eig-obgw-5004b.ext.cloudfilter.net ([10.0.29.208]) by cmsmtp with ESMTPS id SuwdwqoBrlPo5SwxawaH90; Fri, 29 May 2026 13:09:10 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id SwxZwQo3enfJUSwxZwvHe7; Fri, 29 May 2026 13:09:09 +0000 X-Authority-Analysis: v=2.4 cv=KajSsRYD c=1 sm=1 tr=0 ts=6a198ff5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=NGcC8JguVDcA:10 a=ItBw4LHWJt0A:10 a=20KFwNOVAAAA:8 a=O_Mxit_qWb6G3_4wDPYA:9 a=DCx65vhANUyCzuf5D8fC: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:Date:References:In-Reply-To :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=+lRkgnw5J1Dn6aw28w3CuGvRBFl6IEQ+o2ZgnfUSKOU=; b=p6N3SDuY1mU8Cej6NrTj6C+ZaV HPCIw4m92/YuA7gC9mmfiMYWnpEejfsnXStWKiY9Ry4kyuR3RukfMiPNZj+HiKebrneLe6wFIbm0l vud5K4YxApqYBClyikEoSywfe; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:36142 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.2) (envelope-from ) id 1wSwxY-00000001OoB-3W8O; Fri, 29 May 2026 07:09:08 -0600 From: Tom Tromey To: Andrew Burgess Cc: Matthieu Longo , Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH v1] gdb/python: fix memory leak in gdb_py_tp_name In-Reply-To: <87zf1ixzc9.fsf@redhat.com> (Andrew Burgess's message of "Fri, 29 May 2026 11:52:06 +0100") References: <20260526160459.270322-1-matthieu.longo@arm.com> <87fr3e6sdp.fsf@tromey.com> <11b35b46-7e18-471a-94e2-91fef5b287d2@arm.com> <87tsrr5vtl.fsf@tromey.com> <62841b2c-9d0e-4efc-9b26-ca9bfd8787b9@arm.com> <87ldd35php.fsf@tromey.com> <87zf1ixzc9.fsf@redhat.com> X-Attribution: Tom Date: Fri, 29 May 2026 07:09:07 -0600 Message-ID: <87cxye5pn0.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) 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: 75.166.225.82 X-Source-L: No X-Exim-ID: 1wSwxY-00000001OoB-3W8O X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net (bapiya) [75.166.225.82]:36142 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfKVqe8Jt2yOr6tNMtFdBck3jWwRyF+UWEJGaS1WtQI4iXGdrR+9vcuvfdG2ttT1d87QQr1OJhtXeFNQPnxmELyDwYKfcKLXymii341U8g80zbVLgjgGu gmCTRBFQOc9zFamMLk2wuc05vLmJ4nm4UKFI0Yy4954gXR4BNlFU5NAR/RQpTOURjZxr54TPC2oZzBaBZRAXnMNm7rCmFOmtoHs= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org >>>>> "Andrew" == Andrew Burgess writes: Andrew> isn't throwing an error here going to be problematic as gdb_py_tp_name Andrew> is called from Python callbacks? Unless these are catching and handling Andrew> exceptions then the error is going to end up trying to pass through Andrew> Python's C code. Yeah. I guess maybe it isn't explicitly stated anywhere (not sure) but the rule in gdb's Python layer is that gdb exceptions can't propagate into Python itself. So if a function is called from Python (say like a __repr__ implementation), then that function has to be sure that it does not throw. And since most things in gdb can throw, this is why at present we wrap calls into gdb's core in try/catch. Andrew> So maybe just returning something like "" would Andrew> be better? This might be better even when the safety work _is_ merged; Andrew> if gdb_py_tp_name is called as part of logging then we'd probably rather Andrew> log "" than have GDB throw an exception? Yeah, I think this is what should be done, since IIUC the cases where this can set the Python exception are pathological in nature. Or just propagating the Python exception. Though this would mean using a return type other than std::string. Tom