From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id p0j3BNk6xmpEhA4AWB0awg (envelope-from ) for ; Wed, 07 Oct 2026 08:28:09 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=FnFd08Ak; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id ED8C81E04E; Wed, 07 Oct 2026 08:28:08 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.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,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 40C691E04E for ; Wed, 07 Oct 2026 08:28:06 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 744F54BA2E0C for ; Wed, 7 Oct 2026 12:28:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 744F54BA2E0C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=FnFd08Ak Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by sourceware.org (Postfix) with ESMTPS id 100F34BA2E26 for ; Wed, 7 Oct 2026 12:27:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 100F34BA2E26 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 100F34BA2E26 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791376054; cv=none; b=WyvcbNjCpu5rx0/dona0mcZxzM4HQEmPpXnddA9uo+kvRYkDv02NW0P2HHlM1jlbeOiTPm6W5gjHbaNO//eSamOZpjk9FUoOy16+TtTtdF3qeX4g7u9p+uzRBUD5/1FNcFUWiA2r2e6YLrBiYFSZqYvFgHsFGRlKLnecAwfh6h8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791376054; c=relaxed/simple; bh=CQIn5ygsQERYbj9mDxvneG67fMNhseNMk58+75dwZxs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Ek36aZdj5/rZ324bCng4GpSxgKPZk/uLPbEfIURDPnKXgwvfnvMvDm61l0clIfJBS7GjVjD775MeAuXtm0rUD+vMAi0vB8oIL/K82LpF5Fkqq141R8EFhKVo7sqroUrFrnY8QaBauLnDlcSJ+mnNT31XKSN0XyHCSupzVRpWAfA= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=FnFd08Ak DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 100F34BA2E26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1791376054; x=1822912054; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=CQIn5ygsQERYbj9mDxvneG67fMNhseNMk58+75dwZxs=; b=FnFd08AkJOEoNJQmFpeBeKKCxKGPWddJa4uwOuWA+3uLFMMImae7bsMv hZnTnpexTy8uvNwkC8x5+ma7Yr8+jDCY5Qz7JxmV2qvh6nqs3DRLnwEM9 GtZ685ckfsJI3KOg4bJ3l3sSIxGz5WkMPUn8NL4886767ryrhB8SNjwst k5dpL8S7thPVKmfz70REVBmY/P2g3JmFYTc4s/zlFdZ4Kz48rJ4Kb/nsJ mRmwGldfzPQmN3Nx7/Rf9GaIDHm0oPK5z2q9ZPZ+P+5wszfUrtN+mMdvj 4iJEVrTZVorX4YDyGm3ul5ThDkcfpagvhbLJ0SOfndKPJGT87kCiBbjnz w==; X-CSE-ConnectionGUID: VLlkuM6YR9SzrRtTKHF+vg== X-CSE-MsgGUID: iKnSRCY9Tj6IKO3vHKM6pw== X-IronPort-AV: E=McAfee;i="6800,10657,11927"; a="243954" X-IronPort-AV: E=Sophos;i="6.27,144,1787036400"; d="scan'208";a="243954" Received: from fmviesa011.fm.intel.com ([10.60.135.151]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2026 05:27:32 -0700 X-CSE-ConnectionGUID: qBzIWRC+QpWS/R5MeflUZA== X-CSE-MsgGUID: WMgKp5FARdayiPDsuMw+IQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,144,1787036400"; d="scan'208";a="1541840" Received: from dut1048pvc.igk.intel.com (HELO localhost) ([10.211.177.228]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2026 05:27:31 -0700 From: Stephan Rohr To: gdb-patches@sourceware.org Subject: [PATCH] gdbsupport: assert upon an unhandled exception in scope_exit Date: Wed, 7 Oct 2026 12:27:24 +0000 Message-ID: <20261007122724.924118-1-stephan.rohr@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 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 () : ""); + } + } } 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.