From patchwork Thu May 19 22:06:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 12400 Received: (qmail 98912 invoked by alias); 19 May 2016 22:06:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 98702 invoked by uid 89); 19 May 2016 22:06:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, FSL_HELO_HOME, RCVD_IN_DNSWL_NONE, SPF_PASS, T_FILL_THIS_FORM_SHORT autolearn=no version=3.3.2 spammy=H*m:tromey, H*m:tom, Hx-languages-length:1803, subtly X-HELO: gproxy9-pub.mail.unifiedlayer.com Received: from gproxy9-pub.mail.unifiedlayer.com (HELO gproxy9-pub.mail.unifiedlayer.com) (69.89.20.122) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with SMTP; Thu, 19 May 2016 22:06:29 +0000 Received: (qmail 23868 invoked by uid 0); 19 May 2016 22:06:27 -0000 Received: from unknown (HELO cmgw3) (10.0.90.84) by gproxy9.mail.unifiedlayer.com with SMTP; 19 May 2016 22:06:27 -0000 Received: from box522.bluehost.com ([74.220.219.122]) by cmgw3 with id wN6B1s00F2f2jeq01N6ESM; Thu, 19 May 2016 16:06:27 -0600 X-Authority-Analysis: v=2.1 cv=cYhB8BzM c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=PnD2wP_eR3oA:10 a=_v2sUkyEFrwA:10 a=yrkiwgmsf1kA:10 a=zstS-IiYAAAA:8 a=m3vPugrDIVBiyZX471MA:9 a=9r0SOA_iZi7RPC6n:21 a=2pinqKRGvNYLkOK-:21 a=4G6NA9xxw8l3yy4pmD5M:22 Received: from [71.215.116.141] (port=49672 helo=bapiya.Home) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1b3W54-0005Pc-VW; Thu, 19 May 2016 16:06:11 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 2/3] use user_breakpoint_p in python code Date: Thu, 19 May 2016 16:06:02 -0600 Message-Id: <1463695563-4130-3-git-send-email-tom@tromey.com> In-Reply-To: <1463695563-4130-1-git-send-email-tom@tromey.com> References: <1463695563-4130-1-git-send-email-tom@tromey.com> X-Identified-User: {36111:box522.bluehost.com:elynrobi:tromey.com} {sentby:smtp auth 71.215.116.141 authed with tom+tromey.com} I noticed that bppy_get_visibility and gdbpy_breakpoint_created implemented their own visibility checks, but subtly different from user_breakpoint_p. I think the latter is more correct, and so changed the Python code to use it. I suspect there isn't a decent way to test this, so no new test. Built and regtested on x86-64 Fedora 23. 2016-05-19 Tom Tromey * python/py-breakpoint.c (bppy_get_visibility) (gdbpy_breakpoint_created): Use user_breakpoint_p. --- gdb/ChangeLog | 5 +++++ gdb/python/py-breakpoint.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0968b85..a03d290 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2016-05-19 Tom Tromey + + * python/py-breakpoint.c (bppy_get_visibility) + (gdbpy_breakpoint_created): Use user_breakpoint_p. + 2016-05-19 Andreas Schwab * ia64-libunwind-tdep.c (libunwind_descr): Add cast from void *. diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 611a41e..f86da8d 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -540,10 +540,10 @@ bppy_get_visibility (PyObject *self, void *closure) BPPY_REQUIRE_VALID (self_bp); - if (self_bp->bp->number < 0) - Py_RETURN_FALSE; + if (user_breakpoint_p (self_bp->bp)) + Py_RETURN_TRUE; - Py_RETURN_TRUE; + Py_RETURN_FALSE; } /* Python function to determine if the breakpoint is a temporary @@ -862,7 +862,7 @@ gdbpy_breakpoint_created (struct breakpoint *bp) gdbpy_breakpoint_object *newbp; PyGILState_STATE state; - if (bp->number < 0 && bppy_pending_object == NULL) + if (!user_breakpoint_p (bp) && bppy_pending_object == NULL) return; if (bp->type != bp_breakpoint