From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24515 invoked by alias); 28 Feb 2013 19:21:12 -0000 Received: (qmail 24499 invoked by uid 22791); 28 Feb 2013 19:21:10 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BP,TW_HP X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 28 Feb 2013 19:20:39 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1SJKcdm017619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Feb 2013 14:20:38 -0500 Received: from barimba (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1SJKb5O002567 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 28 Feb 2013 14:20:38 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Subject: Re: [2/5] RFC: fix py-finishbreakpoint bug References: <87bobvvnyt.fsf@fleche.redhat.com> <87hakwxnw0.fsf@fleche.redhat.com> Date: Thu, 28 Feb 2013 19:24:00 -0000 In-Reply-To: <87hakwxnw0.fsf@fleche.redhat.com> (Tom Tromey's message of "Thu, 28 Feb 2013 12:02:39 -0700") Message-ID: <878v68xn22.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2013-02/txt/msg00762.txt.bz2 >>>>> "Tom" == Tom Tromey writes: Tom> I'm checking this in now. Pre-commit testing showed a bug. I'm checking in this patch instead. Tom * py-finishbreakpoint.c (bpfinishpy_init): Reorganize to call frame_object_to_frame_info inside TRY_CATCH. --- gdb/python/py-finishbreakpoint.c | 69 ++++++++++++++++++------------------- 1 files changed, 34 insertions(+), 35 deletions(-) diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index 5685308..d3d6bfd 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -173,39 +173,43 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) &frame_obj, &internal)) return -1; - /* Default frame to gdb.newest_frame if necessary. */ - if (!frame_obj) - frame_obj = gdbpy_newest_frame (NULL, NULL); - else - Py_INCREF (frame_obj); - - frame = frame_object_to_frame_info (frame_obj); - Py_DECREF (frame_obj); - - if (frame == NULL) - goto invalid_frame; - TRY_CATCH (except, RETURN_MASK_ALL) { - prev_frame = get_prev_frame (frame); - if (prev_frame == 0) - { - PyErr_SetString (PyExc_ValueError, _("\"FinishBreakpoint\" not " \ - "meaningful in the outermost "\ - "frame.")); - } - else if (get_frame_type (prev_frame) == DUMMY_FRAME) - { - PyErr_SetString (PyExc_ValueError, _("\"FinishBreakpoint\" cannot "\ - "be set on a dummy frame.")); - } + /* Default frame to newest frame if necessary. */ + if (frame_obj == NULL) + frame = get_current_frame (); else - { - frame_id = get_frame_id (prev_frame); - if (frame_id_eq (frame_id, null_frame_id)) - PyErr_SetString (PyExc_ValueError, - _("Invalid ID for the `frame' object.")); - } + frame = frame_object_to_frame_info (frame_obj); + + if (frame == NULL) + { + PyErr_SetString (PyExc_ValueError, + _("Invalid ID for the `frame' object.")); + } + else + { + prev_frame = get_prev_frame (frame); + if (prev_frame == 0) + { + PyErr_SetString (PyExc_ValueError, + _("\"FinishBreakpoint\" not " + "meaningful in the outermost " + "frame.")); + } + else if (get_frame_type (prev_frame) == DUMMY_FRAME) + { + PyErr_SetString (PyExc_ValueError, + _("\"FinishBreakpoint\" cannot " + "be set on a dummy frame.")); + } + else + { + frame_id = get_frame_id (prev_frame); + if (frame_id_eq (frame_id, null_frame_id)) + PyErr_SetString (PyExc_ValueError, + _("Invalid ID for the `frame' object.")); + } + } } if (except.reason < 0) { @@ -305,11 +309,6 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) self_bpfinish->py_bp.bp->pspace = current_program_space; return 0; - - invalid_frame: - PyErr_SetString (PyExc_ValueError, - _("Invalid ID for the `frame' object.")); - return -1; } /* Called when GDB notices that the finish breakpoint BP_OBJ is out of -- 1.7.7.6