From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10332 invoked by alias); 26 Aug 2011 11:17:44 -0000 Received: (qmail 10321 invoked by uid 22791); 26 Aug 2011 11:17:41 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-gw0-f41.google.com (HELO mail-gw0-f41.google.com) (74.125.83.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Aug 2011 11:17:25 +0000 Received: by gwaa20 with SMTP id a20so2941958gwa.0 for ; Fri, 26 Aug 2011 04:17:25 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.9.101 with SMTP id 65mr6099600yhs.11.1314357445025; Fri, 26 Aug 2011 04:17:25 -0700 (PDT) Received: by 10.236.34.193 with HTTP; Fri, 26 Aug 2011 04:17:24 -0700 (PDT) In-Reply-To: <83sjoofo80.fsf@gnu.org> References: <1314198654-9008-1-git-send-email-ratmice@gmail.com> <1314198654-9008-7-git-send-email-ratmice@gmail.com> <83k4a2h8qr.fsf@gnu.org> <831uw9gzro.fsf@gnu.org> <83sjoofo80.fsf@gnu.org> Date: Fri, 26 Aug 2011 11:17:00 -0000 Message-ID: Subject: Re: [PATCH 6/7] [python] API for macros: Add docs. From: Matt Rice To: Eli Zaretskii Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-08/txt/msg00482.txt.bz2 On Fri, Aug 26, 2011 at 3:42 AM, Eli Zaretskii wrote: >> Date: Fri, 26 Aug 2011 01:04:21 -0700 >> From: Matt Rice >> Cc: gdb-patches@sourceware.org >> >> >> macro1.c:18 > >> include_trail=3D[('/home/ratmice/tests/macro1.h', 1), >> >> ('/home/ratmice/tests/macro1.c', 1)]> >> >> macro1.c:18 >> >> macro1.c:18 >> > [...] >> >> > =A0Returns all of the macros which are in effect for the source line >> >> > =A0given by the @code{gdb.Symtab_and_line}'s @code{line} attribute. >> >> >> >> The problem I was trying to avoid (and which made my documentation for >> >> this method admittedly crappy), is that your rephrased definition >> >> seems to be plausible for the case when the user wants (C) in the >> >> macro1.c:18 case, >> >> e.g. the macros which are used ON the line. =A0When Symtab_and_line.m= acros() >> >> outputs all of the macros which were defined before the line, which >> >> are still in effect. >> > >> > Sorry, I don't follow. =A0Did you mean "B" instead of "C"? =A0What is = the >> > problem you see here with "C"? =A0It is defined only once, on line 16, >> > and so is in effect on line 18. =A0I see no issues here. =A0What am I >> > missing? >> >> No, I mean "C". >> >> >> macro1.c:18: =A0foo(); C; return 0; >> >> So say we are stopped on this line, and have Symtab_and_line for it. >> the user wants to know `all the macros that are used at this source loca= tion' >> In this case the answer would be 'C', and my concern is that 'which >> are in effect' >> can be misconstrued. =A0e.g. with the above line in isolation, is 'C' in= effect? > > Now I'm utterly confused. =A0The output of `macros' shows not just C, > but also AMACRO and B. =A0All of them are "in effect" in line 18. =A0So > why are you talking only about C? =A0The fact that it's actually > mentioned in that line seems irrelevant, because you are documenting > what the `macros' method returns. =A0What am I missing here? That Symtab_and_line represents that single source line, and if we use 'in effect', without explicitly qualifying the scope under consideration, we leave the user to decide under what scope macros are considered to be in effect. and the user's idea of that scope may or may not match the actual scope that the function uses. e.g. it could be from `0 - line' as it is, or it could be 'macros used from line - line end' (which is a function we do not even implement.) >> how about the following. >> >> Returns all of the macros defined before the source line given by the >> @code{gdb.Symtab_and_line}'s @code{line} attribute which are in still >> effect. > > How is this different from my suggestion above? It explicitly specifies a scope as 'defined before the source line given...' >> >> >> +@defmethod Symtab macros >> >> >> +Return all of the macros contained in the symbol table. >> >> >> +@end defmethod >> >> > >> >> > Return what, exactly? only their names? something else? >> >> >> >> i'll try 'Return a list of macro objects for all of the macros >> >> contained in the symbol table.' >> > >> > Based on the example above (which I highly recommend to have in the >> > manual), I'd say "a list of macro objects with their values and >> > include trail". >> >> hrm, except what is above is the output of the string function, >> if you actually print the return value without converting to a string >> it prints something like (, ), > > What are the 0x.... numbers here? The addresses of the python objects.