From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta034.useast.a.cloudfilter.net (omta034.useast.a.cloudfilter.net [44.202.169.33]) by sourceware.org (Postfix) with ESMTPS id B8A9B3858D20 for ; Thu, 17 Oct 2024 19:09:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B8A9B3858D20 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 B8A9B3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729192198; cv=none; b=GRZIeEg5dLPF6ypywKNT0kqFuQEc900NbL2MXZywVImS1FXeCBG5HdBxUpR2gZLnYo3q+KitToKMlg1D+O01WySSnvsKZw58VnwFie6NWw9gD68+Ajn6wQCfpuh2JhtnshBycUxHSwD+zmszGbi67s3KI8DaT9NDExhZ9dvjthY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1729192198; c=relaxed/simple; bh=L+PPOOFc4bmNmEVfFLvN0wZrArS6Vy4HMXqGXUMv150=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=TDE5nrjAy6tjIHt9etd17386PzC8nhLVl1Mmp4zW7oStkziZ8JcP+kQaO72UAqdyl+eBBAItdBIYHi9lNokTl1YyKVnG8f9k7cMIGZHr6LdbHnCg9Nw+vw0NNfINKj3CGnPrgAyGl2tlAKAYjDBfhmxIIKRf9adnvEPz2CRYxpM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6001a.ext.cloudfilter.net ([10.0.30.140]) by cmsmtp with ESMTPS id 1Tcstbi0h1zuH1VsYt9PLv; Thu, 17 Oct 2024 19:09:47 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 1VsXtMTuR2Zy01VsXtKiwK; Thu, 17 Oct 2024 19:09:45 +0000 X-Authority-Analysis: v=2.4 cv=Q4EZ4J2a c=1 sm=1 tr=0 ts=671160f9 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=DAUX931o1VcA:10 a=ItBw4LHWJt0A:10 a=2zQE9g85XVbo3BCm4v4A:9 a=6Ogn3jAGHLSNbaov7Orx: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=DgWnfFJDwq9zi5gLPCdJR7d/OQp52TEDSmKj8wb3dco=; b=Bckh/raM8a3sZGcUTso9o8VVem hxS0DK57gmBJe3+8XpB6i/QeFQgbYunup69nMVUpfnDgs1WaeKnL6UAZaQf6vbYPCX3/yb3H510pV DxG+CWb397Hgdb+aiRWYfvUbJ; Received: from 97-122-113-155.hlrn.qwest.net ([97.122.113.155]:36938 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1t1VsX-002bVt-0c; Thu, 17 Oct 2024 13:09:45 -0600 From: Tom Tromey To: Tom de Vries Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 1/5] [gdb] Don't create registry keys in destructor In-Reply-To: <20241011143544.15400-1-tdevries@suse.de> (Tom de Vries's message of "Fri, 11 Oct 2024 16:35:40 +0200") References: <20241011143544.15400-1-tdevries@suse.de> X-Attribution: Tom Date: Thu, 17 Oct 2024 13:09:44 -0600 Message-ID: <87h69afsw7.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: 97.122.113.155 X-Source-L: No X-Exim-ID: 1t1VsX-002bVt-0c X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-113-155.hlrn.qwest.net (murgatroyd) [97.122.113.155]:36938 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfLc/UCQZItDscS0U2x2TQpoUrsn2sazcHDEIGRb1Y33FAMNPOrQJE9iEKjcAinPkhU9vtqzQKNemP/SZRxEQIbXC87AwIkHMKSfk++ofi/EiOEFL9b8a /Bf5y36Z5PgBwQkKQhAVF3jZVCcv34Sxsn+Z8V1akVFAU8EUB9WToPxv/PhBN8zKzahiJKOU48TJKtuS030DIMNrUpnMmrPRHHk= X-Spam-Status: No, score=-3014.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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: >>>>> "Tom" == Tom de Vries writes: Tom> Creating a registry key using emplace calls new: Tom> ... Tom> DATA *result = new DATA (std::forward (args)...); Tom> ... Tom> which can throw a bad alloc, which will terminate gdb if called from a Tom> destructor. I don't think gdb generally tries to be robust if allocation fails. Tom> static struct ada_tasks_pspace_data * Tom> -get_ada_tasks_pspace_data (struct program_space *pspace) Tom> +get_ada_tasks_pspace_data (struct program_space *pspace, bool create = true) Tom> { In many of these cases, it is fine to just delete the data. Tom> data = ada_tasks_pspace_data_handle.get (pspace); Tom> if (data == NULL) In cases where it is not, the caller can use .get() instead and do nothing when the data hasn't been set. IMO this is preferable to adding optional 'bool create' flags. Tom