From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gLtbJN3CyGpYgR4AWB0awg (envelope-from ) for ; Fri, 09 Oct 2026 06:33:01 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JXaMBQYI; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 5CA891E051; Fri, 09 Oct 2026 06:33:01 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 416FB1E04E for ; Fri, 09 Oct 2026 06:33:00 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 288394BA2E0E for ; Fri, 9 Oct 2026 10:32:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 288394BA2E0E Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JXaMBQYI Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id EC7094BA540B for ; Fri, 9 Oct 2026 10:32:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC7094BA540B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EC7094BA540B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791541951; cv=none; b=ioCbd4kic38NHTOaaWPMXnOg+zxqNU4RsChuJu2JcPczsgMzANexrz58SuokcGdVBpPH1bWTADEBLisyY5oOK7h5V9UeMdVmdG/53lwXl8CEdP40lncuZQEFsTs3TjNIEjlMxrHE0lm3JRtLggGmJIdA9H/TgaIzlEn4wzF5xS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791541951; c=relaxed/simple; bh=SF3BcvMSsxL2I6yeaXGaKBew9LS28sUBiwEP0logyD4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RrNwgggGfIXffO54uz+Ejn0rwvFln+2/DUKWhsgPh+KEPxpde9Ex84KngCP1Aq79cGAxrgAfrizBpmkE0KCm1L0LSB5g3qlQnwf6kMz5rmCEAjoApMDHCb8WEwu7jenA5cqCq/RgSupHvE25Dz0Qzj7hHU4H+lh/KTa26C1RxVk= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JXaMBQYI DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC7094BA540B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1791541950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tP9YB5AucMs4pTFqXJhl7Qnx8LL7gMw2hab64UYyen0=; b=JXaMBQYIOzb0NB8QNVv3XC6tCSk5wexCzr5g1UwJOlU6cYdqKoVD4Bf0rPicqyy75QXQmt 7R5gorKZno+JeflfCrnFPo21CZHB0vjeJAqnRy6mXW1shw4T3OpS1i9t5amP8+fKjUeTT0 kQalvIp+2hsiNdoJw6zbBhbx+CjsIFE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-283-UZjCQv3lPU6LEgNLadu1Vg-1; Fri, 9 Oct 2026 10:32:28 +0000 X-MC-Unique: UZjCQv3lPU6LEgNLadu1Vg-1 X-Mimecast-MFC-AGG-ID: UZjCQv3lPU6LEgNLadu1Vg_1791541947 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-495689bfcc8so49870635e9.1 for ; Fri, 09 Oct 2026 03:32:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791541947; x=1792146747; h=content-type:mime-version:message-id:date:references:in-reply-to :subject:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=tP9YB5AucMs4pTFqXJhl7Qnx8LL7gMw2hab64UYyen0=; b=DzpMNj7CTik48viRUsggqaB+003t4ACfJhSvEFmFfsoa4aiwSMq7/4Canx09wBS9WV esWeVPmQT1I/xs+d3H4/9CVFHNHK+1zl0RI6AzZCHbwvY0uXaVX8pN3+HDcDZS4W/ThF xdftC+6ZHE7AJxliG46E6xZOUVqRuxZV8e0lQN+lozZhv9CBkop0AamAQCa8kbNxPFXP lZajhtjOs39IBKIpU6gnPT13TikfQIq9yjUevMweppTizYYMXlRRxv0bgxW6ymCZeagA ct+BhmktZTdy4/D3UspqDGB9XNusS8lZrwb6Rsob7gYz11Wbv8zi87SCP8Z/JIwiA1OG Ly+g== X-Forwarded-Encrypted: i=1; AKwUvBx7NaDkbh3/chAFe25qm0EQ5tXaQntaOWu/x02YCm9qLuDCkJemHF78dH9VMXbM6xfiaWntmv2ktUt8sA==@sourceware.org X-Gm-Message-State: AFuF++mKub8sU4ExvFdv+wWTSGmyrn8z2UaGWx7FqtFp+U5PYRx4I+md PeuB0Wa05Fk8g91yvUxck/wZP12baUqIjy9dqUzRGP/DFE6r2jlhHm7ECRnMe6jbRwfsMtlOoqD wUTkhqWddmK9QUxbFibREnD1B4BdXepe0kn2c1w58rhZS1Nqi3cNl24DUA0yG1v+m8SM6RmU= X-Gm-Gg: AYBFou3vNDuwGZ0g57OmKsqmT/+yjluwg6jJ8WnkkDlgpdX/hp5jQyVlMvtScnkIQLr 5NA06B91j0xMzV9LtQWg+2D5b9mz5O1AJRbcc+EtihqatOZPZ6NmnZp9iwvpKbRLlh8+Mw4Q7u6 OdPiTkGkXagiovharYHSWOgJMPxoaHLKWCRz4RG7XcTtcIW/CzEJOPlO9aih/7SOvUjicoJ/Kiz IONiJQUBQN9upBcvy5fNFqKV2BQQqjEx2vQzbtfpOyq89WFG0YQjIBRcvBkrvFST0S4KVUWcSkN Guf2r5bu2Jq+HsxWjjU3TCm/mCrQNKVQCR7eNgdJilpYbjwoQ9c9yJQDZxtc4DWKfTh+ X-Received: by 2002:a05:600c:348d:b0:4a1:813f:2a63 with SMTP id 5b1f17b1804b1-4a18e4aa26amr26791545e9.18.1791541947218; Fri, 09 Oct 2026 03:32:27 -0700 (PDT) X-Received: by 2002:a05:600c:348d:b0:4a1:813f:2a63 with SMTP id 5b1f17b1804b1-4a18e4aa26amr26791085e9.18.1791541946735; Fri, 09 Oct 2026 03:32:26 -0700 (PDT) Received: from localhost ([213.31.44.29]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a18f3b43efsm43369875e9.1.2026.10.09.03.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2026 03:32:26 -0700 (PDT) From: Andrew Burgess To: Stephan Rohr , gdb-patches@sourceware.org Subject: Re: [PATCH] gdbsupport: assert upon an unhandled exception in scope_exit In-Reply-To: <20261007122724.924118-1-stephan.rohr@intel.com> References: <20261007122724.924118-1-stephan.rohr@intel.com> Date: Fri, 09 Oct 2026 11:32:25 +0100 Message-ID: <87pkxjtb9i.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ktAF13r1aHh7Iuh0grPzmrW__ZfyBWgST_iltwli5CM_1791541947 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Stephan Rohr writes: > From: Mihails Strasuns > > Add a catch-all statement in a scope_exit_base class destructor to turn > any unhandled exception from "POLICY::on_exit ()" into a GDB assertion - > any such case is a programming error, because it is not legal in C++ to > throw from a destructor. > > Co-Authored-By: Rohr, Stephan > --- > gdbsupport/scope-exit.h | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/gdbsupport/scope-exit.h b/gdbsupport/scope-exit.h > index c90b3194cb5..1dfdb1ef695 100644 > --- a/gdbsupport/scope-exit.h > +++ b/gdbsupport/scope-exit.h > @@ -68,7 +68,17 @@ class scope_exit_base : private POLICY > ~scope_exit_base () > { > if (!m_released) > - POLICY::on_exit (); > + { > + try > + { > + POLICY::on_exit (); > + } > + catch (const gdb_exception &ex) > + { > + gdb_assert_not_reached ("unhandled exception in scope exit: %s", > + ex.message != nullptr ? ex.what () : ""); I was originally going to write ex.message cannot be nullptr as we never guard calls to ex.what anywhere else in GDB. But after checking, it is possible to create a gdb_exception with a nullptr message. I guess in practice though this never happens as any exception thrown vie error(...) will always have been give a message, you'd have to work hard to throw an exception without a message. I wonder if we should make the what() function handle this case? But I suspect that's for another day. I think this commit is fine as is, so: Approved-By: Andrew Burgess Thanks, Andrew > + } > + } > } > > DISABLE_COPY_AND_ASSIGN (scope_exit_base); > -- > 2.43.0 > > ________________________________________ > Intel Deutschland GmbH > > Registered Address: Dornacher Strasse 1, 85622 Feldkirchen, Germany > > Tel: +49 (89) 99143-0 > > www.intel.de > > Managing Directors: Candice Moore, Jeffrey Schneiderman, Ramachandran Sitaraman > > Chairperson of the Supervisory Board: Sonja Pierer > > Registered Seat: Munich Commercial Register B: Amtsgericht Munich HRB 186928 > > This e-mail and any attachments may contain confidential material for > the sole use of the intended recipient(s). Any review or distribution > by others is strictly prohibited. If you are not the intended > recipient, please contact the sender and delete all copies.