From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18271 invoked by alias); 25 Oct 2011 12:49:07 -0000 Received: (qmail 18247 invoked by uid 22791); 25 Oct 2011 12:49:06 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Oct 2011 12:48:47 +0000 Received: by vcbfk1 with SMTP id fk1so496224vcb.0 for ; Tue, 25 Oct 2011 05:48:47 -0700 (PDT) Received: by 10.220.108.84 with SMTP id e20mr3015vcp.3.1319546926198; Tue, 25 Oct 2011 05:48:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.180.75 with HTTP; Tue, 25 Oct 2011 05:48:24 -0700 (PDT) In-Reply-To: References: <201110141600.20561.pedro@codesourcery.com> <8339eie2ij.fsf@gnu.org> From: Kevin Pouget Date: Tue, 25 Oct 2011 14:27:00 -0000 Message-ID: Subject: Re: [RFC][Python] gdbpy_frame_stop_reason_string bug To: Eli Zaretskii Cc: pedro@codesourcery.com, pmuldoon@redhat.com, gdb-patches@sourceware.org, tromey@redhat.com 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-10/txt/msg00655.txt.bz2 On Tue, Oct 25, 2011 at 2:22 PM, Eli Zaretskii wrote: >> From: Kevin Pouget >> Date: Tue, 25 Oct 2011 09:20:19 +0200 >> Cc: pedro@codesourcery.com, pmuldoon@redhat.com, gdb-patches@sourceware.= org, >> =A0 =A0 =A0 tromey@redhat.com >> >> >> +@item gdb.FRAME_UNWIND_FIRST_ERROR >> >> +All the conditions after this alias are considered errors; >> > >> > Hmm... =A0This table is preceded by this text: >> > >> > =A0@defun Frame.unwind_stop_reason () >> > =A0Return an integer representing the reason why it's not possible to = find >> > =A0more frames toward the outermost frame. =A0Use >> > =A0@code{gdb.frame_stop_reason_string} to convert the value returned b= y this >> > =A0function to a string. The value can be one of: >> > >> > So "conditions after this alias" seems inappropriate in the list that >> > follows, because we are not describing conditions or aliases. =A0Can y= ou >> > rephrase this to be consistent with the rest of the list. >> >> I'm not sure about you see wrong with "alias". We could replace it >> with "reference" (like the & operator in C++, but also used in Python >> and Java), but it sounds more or less the same to me. >> >> What do you think about: >> "Stop reasons greater or equal to this value/alias/reference" > > Now that I understand the intent, I would suggest > > =A0Any stop reason greater or equal to this value indicates some kind > =A0of error. =A0This special value facilitates writing code that tests > =A0for errors in unwinding in a way that will work correctly even if > =A0the list of the other values is modified in future @value{GDBN} > =A0versions. =A0Using it, you could write: yes, if you feel like it has to be explicited, it's better this way @smallexample reason =3D gdb.selected_frame().unwind_stop_reason () reason_str =3D gdb.frame_stop_reason_string (reason) if reason >=3D gdb.FRAME_UNWIND_FIRST_ERROR: print "An error occured during the unwinding process: %s" % reason_str @end smallexample > >> > And why is it important that the value is an alias for another? >> >> it's important because it's not a distinct value as the other ones, so >> > frame_stop_reason_string(UNWIND_FIRST_ERROR) =3D=3D frame_stop_reason_= string(UNWIND_UNAVAILABLE) >> is True, which might be counter-intuitive if you don't know that >> UNWIND_FIRST_ERROR is an alias/reference > > I still don't see the importance, sorry. =A0Moreover, having this text > means that we will need to update the manual each time the list of > unwind reasons is modified, **which in a way works against this very > feature.** You're half right with this last sentence, but this Python value is not here to ease *our* (GDB developers) lives, but rather for Python developers. this value is not meant to change very often (not to say almost never), so I think it's not a big burden to change the documentation as well when it happens. The very reason why I wrote it is that I think it's useful for the reader: when you look over this list, you can easily see what is a normal reason for unwinders to stop, and what isn't (I think that not so many people will actually have the chance to use it, but out of curiosity, some people will want to read and understand it). But that put aside, you're not convinced yet and I'm running short of arguments ... Pedro, Tom, Phil, how do you see that ?