[RFC][Python] gdbpy_frame_stop_reason_string bug

Eli Zaretskii eliz@gnu.org
Tue Oct 25 12:49:00 GMT 2011


> From: Kevin Pouget <kevin.pouget@gmail.com>
> Date: Tue, 25 Oct 2011 09:20:19 +0200
> Cc: pedro@codesourcery.com, pmuldoon@redhat.com, gdb-patches@sourceware.org, 
> 	tromey@redhat.com
> 
> >> +@item gdb.FRAME_UNWIND_FIRST_ERROR
> >> +All the conditions after this alias are considered errors;
> >
> > Hmm...  This table is preceded by this text:
> >
> >  @defun Frame.unwind_stop_reason ()
> >  Return an integer representing the reason why it's not possible to find
> >  more frames toward the outermost frame.  Use
> >  @code{gdb.frame_stop_reason_string} to convert the value returned by this
> >  function 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.  Can you
> > 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

  Any stop reason greater or equal to this value indicates some kind
  of error.  This special value facilitates writing code that tests
  for errors in unwinding in a way that will work correctly even if
  the list of the other values is modified in future @value{GDBN}
  versions.  Using it, you could write:
  @smallexample
  ... insert here a snippet of code using this value ...
  @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) == 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.  Moreover, 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.

Thanks.



More information about the Gdb-patches mailing list