From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 0CC963858C66 for ; Thu, 12 Jan 2023 17:44:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0CC963858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 360E51E0D3; Thu, 12 Jan 2023 12:44:48 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1673545488; bh=X7AGf4sIB5oBnM5xm9suDOjDQZroHa0skgeJjMpDypc=; h=Date:Subject:To:References:From:In-Reply-To:From; b=j/euW0/mRmbEv1wxQ48VriKUynJZm+XTl4fZYLrY0ZU/kUPMjWGaxw+zZb/t6pJf3 rllEEgtW3hFUWsiGkq3MI8CeuBiDpNNYMZhg6SQJpt9MEm+sU0+qqD4l0p2+9H89xL xlieZrfD0XZE0F+xX1UZs2elAwVsnF+P6Nu3ypTk= Message-ID: Date: Thu, 12 Jan 2023 12:44:47 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH 2/3] Fix latent bug in Python breakpoint creation Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20221208191804.3819129-1-tromey@adacore.com> <20221208191804.3819129-3-tromey@adacore.com> From: Simon Marchi In-Reply-To: <20221208191804.3819129-3-tromey@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_PASS,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: On 12/8/22 14:18, Tom Tromey via Gdb-patches wrote: > While working on the previous patch, I noticed that Python breakpoint > creation does: > > - = (qualified != NULL && PyObject_IsTrue (qualified) > > PyObject_IsTrue can fail, so this is missing an error check. This > patch adds the missing check. > > Note that this could probably be improved by using the "p" format in > the call to gdb_PyArg_ParseTupleAndKeywords, but that was added in > Python 3.3, and I think gdb still supports 3.2. > --- > gdb/python/py-breakpoint.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c > index 917fd367d06..39d9bd5dff6 100644 > --- a/gdb/python/py-breakpoint.c > +++ b/gdb/python/py-breakpoint.c > @@ -818,7 +818,7 @@ bppy_init_validate_args (const char *spec, char *source, > static void > bppy_create_breakpoint (enum bptype type, int access_type, int temporary_bp, > int internal_bp, const char *spec, > - PyObject *qualified, const char *source, > + int qualified, const char *source, You might as well make this parameter "bool". Otherwise, LGTM. Simon