From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24199 invoked by alias); 18 Apr 2013 12:13:28 -0000 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 Received: (qmail 24187 invoked by uid 89); 18 Apr 2013 12:13:27 -0000 X-Spam-SWARE-Status: No, score=-7.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 18 Apr 2013 12:13:27 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3ICDQbM012166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 18 Apr 2013 08:13:26 -0400 Received: from localhost.localdomain (ovpn-116-93.ams2.redhat.com [10.36.116.93]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3ICDOwJ016299; Thu, 18 Apr 2013 08:13:25 -0400 Message-ID: <516FE364.4040604@redhat.com> Date: Fri, 19 Apr 2013 14:24:00 -0000 From: Phil Muldoon MIME-Version: 1.0 To: Tom Tromey CC: "gdb-patches@sourceware.org" Subject: Re: [patch][python] 5 of 5 - Frame filter documentation changes References: <513E573C.7010502@redhat.com> <87k3ozxsoq.fsf@fleche.redhat.com> In-Reply-To: <87k3ozxsoq.fsf@fleche.redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2013-04/txt/msg00569.txt.bz2 > FrameDecorator also stores this in an attribute, "base". > Should that attribute just be declared public? > And if not, shouldn't it be renamed to start with a "_"? > > Phil> + def function(self): > Phil> + frame = self.inferior_frame() > Phil> + name = str(frame.name()) > Phil> + function = str(frame.function()) > Phil> + > Phil> + if frame.type() == gdb.INLINE_FRAME: > Phil> + name = name + " [inlined from "+ function +"]" > > This actually violates the FrameDecorator guidelines, since it bypasses > self.base to get the name from the inferior_frame. > > It seems like it should call self.base.name() instead. > And, it should have a comment explaining why it needs to use > inferior_frame to call function. This frame decorator does not have an inferior_frame API declared, so in the case of the call to inferior_frame, it calls the super class's inferior_function API (which in this case, will return self.base). I'll rename self.base to self._base, in the Frame Decorator. This example is just deferring the call to the frame decorator that actually wraps the gdb.Frame. > Phil> + try: > Phil> + eliding_frame = next(self.input_iterator) > Phil> + except StopIteration: > Phil> + return frame > Phil> + return ElidingFrameDecorator(eliding_frame, [frame]) > > What if there are multiple inline frames in a row? > Wouldn't you want to elide all of them? > That will make the example trickier though. Yeah there are several edge cases I did not cover. I did write an explanatory passage before this example noting that it just covers one view, and, there are many other cases to deal with. I noted the scope of a manual example can't encompass these. Cheers, Phil