From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gCt/I45M1mqhODMAWB0awg (envelope-from ) for ; Mon, 19 Oct 2026 12:59:58 -0400 Received: by simark.ca (Postfix, from userid 112) id 6DCAC1E050; Mon, 19 Oct 2026 12:59:58 -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.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, 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 8CA321E04F for ; Mon, 19 Oct 2026 12:59:57 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E7F74BA23D3 for ; Mon, 19 Oct 2026 16:59:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E7F74BA23D3 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 5F1844BA2E27; Mon, 19 Oct 2026 16:59:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F1844BA2E27 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5F1844BA2E27 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792429173; cv=none; b=Q7qKWAz46Ybv0vHS9qgY2QrZIiRgfH3RfJvuBgJfnpBP7k+nsXlo0vfQ4JIwYOzvVhtJ5+E0jS0swN+SSGwdwzAenIZMtbtUtbgrHQ5o/5VVuC5InjWKdcwOncmkmXP9UthGkCquTN9yh/tP6hsptjfZuZWY3JpwmAm3AjbgI2c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792429173; c=relaxed/simple; bh=scNwFDPfDQ1IOmvbfhOruVRBNh3tfxJIlHPVdAzjQ4s=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=Tq1uhs4qbVaPQ3+AbLLZD3nX1PBNjgHeMtxp5WIyUuTuBXilMsY5XQfmeyCVpG9fua4MhpuSxBlbEyamj9f1WzJ8CKLdcubu0yWLCsr1xG8iekHi8iy+nsVIoBmqSUlwa85h7IRxcfWQAlpjESkw0q9xY7PIsS057JrHroZglG0= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F1844BA2E27 Received: by simark.ca (Postfix) id 9A54F1E04F; Mon, 19 Oct 2026 12:59:31 -0400 (EDT) From: Simon Marchi To: gcc-patches@sourceware.org, gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/6] gdb/unittests: catch gdb_exception_error in scoped_mmap test Date: Mon, 19 Oct 2026 12:58:17 -0400 Message-ID: <20261019165929.792697-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261019165929.792697-1-simon.marchi@efficios.com> References: <20261019165929.792697-1-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Most places should generally catch gdb_exception_error and not gdb_exception, to avoid catching gdb_exception_quit and gdb_exception_forced_quit. I think that this function is such a place. I happened to see it while working on a following patch. While at it, format the try/catch block using the correct style. Change-Id: I80e1d43d3ea2f940e3b75baae77672e267fde446 --- gdb/unittests/scoped_mmap-selftests.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gdb/unittests/scoped_mmap-selftests.c b/gdb/unittests/scoped_mmap-selftests.c index 06026b459cda..ce03d7559f7a 100644 --- a/gdb/unittests/scoped_mmap-selftests.c +++ b/gdb/unittests/scoped_mmap-selftests.c @@ -112,11 +112,14 @@ test_invalid_filename () { bool threw = false; - try { + try + { ::scoped_mmap m = ::mmap_file ("/this/file/should/not/exist"); - } catch (const gdb_exception &e) { + } + catch (const gdb_exception_error &) + { threw = true; - } + } SELF_CHECK (threw); } -- 2.56.0