From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KZQrDiONz2oLJgkAWB0awg (envelope-from ) for ; Wed, 14 Oct 2026 10:09:39 -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=qEGUxaHd; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 34B111E050; Wed, 14 Oct 2026 10:09:39 -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 A0F531E04E for ; Wed, 14 Oct 2026 10:09:38 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C5A4E4BA23FA for ; Wed, 14 Oct 2026 14:09:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C5A4E4BA23FA 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=qEGUxaHd Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id 8FC2E4BA23E1 for ; Wed, 14 Oct 2026 14:09:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8FC2E4BA23E1 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 8FC2E4BA23E1 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791986944; cv=none; b=jxwl3+WaoMr7Eul9a6W1isLj+McNebbFH5WpCgYnJIRSvi87GmKbkn6vAWiJhIMiBIqbyjR4uc+/rV4CIZ16Tj8X6WyGLcOxRrGlaMyzmNi6jxH3/f53SUCDfZauoSLQLojy6URFmiwnrn1c/RNHM3x3RGWQSaJPI2SaUUR/cxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791986944; c=relaxed/simple; bh=bn0stkDWKF6JDOX68v1lgg2BC7lW4O0ImTcilIjhkZs=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=RJ2HJxlp6Mxz7FWALAcpUZhHYZe+Itxou0R8eDsZ0ebmGB6Fqcd/KXSRfceXkJRPhJkS+mbGy70/8chcmG2vkr+QxmgBZKAjhx8+ywpIf/0IWFPieXEEFtR5TxL0iXkcay5tKBZEzpsncBQapmRyE9zg3ZWp9rUKTDbDPNl8M4g= 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=qEGUxaHd reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8FC2E4BA23E1 Received: from eig-obgw-5003b.ext.cloudfilter.net ([10.0.29.155]) by cmsmtp with ESMTPS id GmPcxKIs5c3XsGzfExy9Bk; Wed, 14 Oct 2026 14:09:04 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id Gzf1xuLVqFB8dGzf2xWkP3; Wed, 14 Oct 2026 14:08:52 +0000 X-Authority-Analysis: v=2.4 cv=HcoUTjE8 c=1 sm=1 tr=0 ts=6acf8cfe a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=660iZSQnnn4A:10 a=ItBw4LHWJt0A:10 a=sB3jitL7EuGHL1Va3YoA:9 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fdeZJUDaU76YkypHhOD9cEQSnFOhKEY6BIQ6kmuP2Ew=; b=qEGUxaHdvhAuLcv5usOmjPmyqZ bSnElBLB/0C0P2c0k3T2toRhB/TUBNjEwqRJiNPrpTrx1xMOD2LuzQk/Ezef13kTGAD3tx3r6DNjV 7DkH61LJ7CawskHyr5p1LatnN; Received: from 97-122-110-129.hlrn.qwest.net ([97.122.110.129]:45562 helo=[192.168.0.17]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xGzf1-000000002J7-2NF8; Wed, 14 Oct 2026 08:08:51 -0600 From: Tom Tromey Date: Wed, 14 Oct 2026 08:08:50 -0600 Subject: [PATCH 2/5] Move two macros from python-internal.h to py-breakpoint.c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261014-python-safety-breakpoint-v1-2-c8e72d58f3cd@tromey.com> References: <20261014-python-safety-breakpoint-v1-0-c8e72d58f3cd@tromey.com> In-Reply-To: <20261014-python-safety-breakpoint-v1-0-c8e72d58f3cd@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 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.110.129 X-Source-L: No X-Exim-ID: 1xGzf1-000000002J7-2NF8 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-129.hlrn.qwest.net ([192.168.0.17]) [97.122.110.129]:45562 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfPnOVcAKZCeafGh3Iy7OZEXDF4cFn9QrVZwMk48sCMdsf+MZEFQN3rHfQars5IOTQN+GCg3b1XQsPnqJKa8F5+sr0oiVN5roXEioJ5pLwxS2kSfE7/ZF XZSzwJMij1rDN1nzMm/E5avxEPjT3rb2nHFeHoUKN92FLC25T8CD0yzUmi1vHtwNsTAqziMFtTiGDCUMQsMsgNGr9+IcnhlVK1o= 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 I found a couple of macros in python-internal.h that don't need to be. This moves them into py-breakpoint.c. --- gdb/python/py-breakpoint.c | 22 ++++++++++++++++++++++ gdb/python/python-internal.h | 23 ----------------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index cb18fec11f9..8781c17838b 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -37,6 +37,28 @@ extern PyTypeObject breakpoint_location_object_type; +/* Require that BREAKPOINT be a valid breakpoint ID; throw a Python + exception if it is invalid. */ +#define BPPY_REQUIRE_VALID(Breakpoint) \ + do { \ + if ((Breakpoint)->bp == NULL) \ + return PyErr_Format (PyExc_RuntimeError, \ + _("Breakpoint %d is invalid."), \ + (Breakpoint)->number); \ + } while (0) + +/* Require that BREAKPOINT be a valid breakpoint ID; throw a Python + exception if it is invalid. This macro is for use in setter functions. */ +#define BPPY_SET_REQUIRE_VALID(Breakpoint) \ + do { \ + if ((Breakpoint)->bp == NULL) \ + { \ + PyErr_Format (PyExc_RuntimeError, _("Breakpoint %d is invalid."), \ + (Breakpoint)->number); \ + return -1; \ + } \ + } while (0) + struct gdbpy_breakpoint_location_object : public PyObject { /* An owning reference to the gdb breakpoint location object. */ diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index 763504dfc46..55e5e8eaabe 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -431,29 +431,6 @@ struct gdbpy_breakpoint_object : public PyObject static_assert (gdb::is_python_allocatable_v); -/* Require that BREAKPOINT be a valid breakpoint ID; throw a Python - exception if it is invalid. */ -#define BPPY_REQUIRE_VALID(Breakpoint) \ - do { \ - if ((Breakpoint)->bp == NULL) \ - return PyErr_Format (PyExc_RuntimeError, \ - _("Breakpoint %d is invalid."), \ - (Breakpoint)->number); \ - } while (0) - -/* Require that BREAKPOINT be a valid breakpoint ID; throw a Python - exception if it is invalid. This macro is for use in setter functions. */ -#define BPPY_SET_REQUIRE_VALID(Breakpoint) \ - do { \ - if ((Breakpoint)->bp == NULL) \ - { \ - PyErr_Format (PyExc_RuntimeError, _("Breakpoint %d is invalid."), \ - (Breakpoint)->number); \ - return -1; \ - } \ - } while (0) - - /* Variables used to pass information between the Breakpoint constructor and the breakpoint-created hook function. */ extern gdbpy_breakpoint_object *bppy_pending_object; -- 2.49.0