From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32587 invoked by alias); 8 Oct 2010 18:40:18 -0000 Received: (qmail 32410 invoked by uid 22791); 8 Oct 2010 18:40:16 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Fri, 08 Oct 2010 18:40:11 +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.13.8/8.13.8) with ESMTP id o98Ie0xv024871 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Oct 2010 14:40:01 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o98IdxJY009338; Fri, 8 Oct 2010 14:40:00 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o98IdwIN025142; Fri, 8 Oct 2010 14:39:58 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 8E7703797CC; Fri, 8 Oct 2010 12:39:57 -0600 (MDT) From: Tom Tromey To: pmuldoon@redhat.com Cc: Pedro Alves , gdb-patches@sourceware.org, dan@codesourcery.com Subject: Re: [patch] Add visible flag to breakpoints. References: <20100930144132.GA15652@caradoc.them.org> <201009301741.32379.pedro@codesourcery.com> Date: Fri, 08 Oct 2010 18:40:00 -0000 In-Reply-To: (Phil Muldoon's message of "Fri, 08 Oct 2010 13:50:34 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2010-10/txt/msg00148.txt.bz2 >>>>> "Phil" == Phil Muldoon writes: Phil> +/* Top and bottom of the breakpoint chain. We store bottom so we do Phil> + not have to constantly iterate through the chain when we add a new Phil> + breakpoint. */ Phil> +struct breakpoint_object *top; Phil> +struct breakpoint_object *bottom; These should be static. Phil> + if (Breakpoint == NULL) Pedro pointed out the problem here. I suspect you want ((Breakpoint)->bp) instead. There are 2 instances of this. Phil> +/* Python function to get the visibility of the breakpoint. */ Phil> +static PyObject * Phil> +bppy_get_visibility (PyObject *self, void *closure) Blank line between the comment & function. We're trying to enforce this now. Phil> + if (internal) Phil> + { Phil> + if (! PyBool_Check (internal)) Phil> + { Phil> + PyErr_SetString (PyExc_TypeError, Phil> + _("The value of `internal' keyword must be a boolean.")); Use PyObject_IsTrue, don't type-check for a boolean. Phil> + int i = 0; Phil> + ALL_PY_BREAKPOINTS (b) Phil> + { Phil> + Py_INCREF (b); Phil> + PyTuple_SetItem (result, i, (PyObject *) b); Phil> + ++i; I know this is copied code, as it were, but I think this needs an error check on PyTuple_SetItem. Phil> + PyErr_SetString (PyExc_RuntimeError, Phil> + _("Error while creating breakpoint from GDB.")); Phil> + return; Phil> + } I don't think it is ok to do this here. I think it will just confuse some future call into Python. I am not sure what is the best thing to do here. We can't throw a gdb exception, because we are in an observer. Maybe setting the python error, as above, then immediately calling gdbpy_print_stack. This is sort of weird, but at least it properly handles the user's settings. Tom