From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19916 invoked by alias); 24 Oct 2011 16:06:32 -0000 Received: (qmail 19903 invoked by uid 22791); 24 Oct 2011 16:06:30 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS 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; Mon, 24 Oct 2011 16:06: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.14.4/8.14.4) with ESMTP id p9OG68OF013449 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 Oct 2011 12:06:08 -0400 Received: from localhost.localdomain (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 p9OG65Qm006896; Mon, 24 Oct 2011 12:06:06 -0400 From: Phil Muldoon To: Kevin Pouget Cc: Tom Tromey , Eli Zaretskii , gdb-patches@sourceware.org Subject: Re: [RFC] Python Finish Breakpoints References: Reply-to: pmuldoon@redhat.com X-URL: http://www.redhat.com Date: Mon, 24 Oct 2011 16:27:00 -0000 In-Reply-To: (Kevin Pouget's message of "Mon, 24 Oct 2011 17:01:45 +0200") 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 X-IsSubscribed: yes 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: 2011-10/txt/msg00643.txt.bz2 Kevin Pouget writes: I have some comments regarding the Python bits. > > + ** A new class "gdb.FinishBreakpoint" is provided to catch the return > + of a function. This class is based on the "finish" command > + available in the CLI. > + > ** Type objects for struct and union types now allow access to > the fields using standard Python dictionary (mapping) methods. > For example, "some_type['myfield']" now works, as does > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index ba1b08f..ffd2ef6 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -5700,6 +5700,7 @@ init_raw_breakpoint_without_location (struct breakpoint *b, > b->frame_id = null_frame_id; > b->condition_not_parsed = 0; > b->py_bp_object = NULL; > + b->is_py_finish_bp = 0; Is there any reason why this need to be in the breakpoint struct? I think this should be encapsulated in breakpoint PyObject, and a accessor method provided for it. As a finish breakpoint can only ever be instantiated by Python, there will always be a py_bp_object attached to make the call. > +/* struct implementing the gdb.FinishBreakpoint object by extending > + the gdb.Breakpoint class. */ > +struct finish_breakpoint_object > +{ > + /* gdb.Breakpoint base class. */ > + struct breakpoint_object py_bp; > + /* gdb.Type object of the function finished by this breakpoint. */ > + PyObject *function_type; > + /* gdb.Type object of the value return by the breakpointed function. */ > + PyObject *return_type; > + /* When stopped at this FinishBreakpoint, value returned by the function; > + Py_None if the value is not computable; > + NULL if GDB is not stopped at a FinishBreakpoint. */ > + PyObject *return_value; > +}; I think these comments should wrap? They wrap for me in emacs. Cheers Phil