Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Li Yu <raise.sail@gmail.com>
To: pmuldoon@redhat.com
Cc: gdb-patches@sourceware.org, Paul Koning <paulkoning@comcast.net>,
	 Tom Tromey <tromey@redhat.com>
Subject: Re: [PATCH v4] gdb/python: add missing handling for anonymous members of struct and union
Date: Wed, 19 Oct 2011 08:28:00 -0000	[thread overview]
Message-ID: <4E9E3112.7050307@gmail.com> (raw)
In-Reply-To: <m3sjmq1jxi.fsf@redhat.com>



于 2011年10月18日 21:57, Phil Muldoon 写道:
> Li Yu <raise.sail@gmail.com> writes:
> 
>> gdb.Type.fields() missed handling for anonymous members.
>>
>> This patch fix it, below are details:
> 
> Sorry I missed this patch.  I have some questions.
> 
> Given this functionality, do you have any use-cases in mind for it? Do
> we really want to include anonymous members in field () output? I ask
> because I cannot decide if the additional anonymous field information
> constitutes an API break.  If so we may have to reconstitute this
> functionality from fields() so that it takes a keyword to turn this
> behavior on and off.
> 
> Also, this patch requires a GDB testcase, and probably a documentation
> update.  Also, a ChangeLog.
> 

The patch for test suite is here: http://www.cygwin.com/ml/gdb-patches/2011-10/msg00219.html

You may find the reason of this patch at http://sourceware.org/ml/gdb-patches/2011-09/msg00568.html

En, we may need a doc update, it seem that I indeed read tens of pages gnu coding standard carefully, it will spend some time.


>>  /* A type iterator object.  */
>> -typedef struct {
>> +typedef struct iterator_object
>> +{
>>    PyObject_HEAD
>> +  /* The iterators for support fields of anonymous field */
>> +  struct iterator_object *child;
> 
> Comments have to be complete sentences, including punctuation.  So add a
> period at the end of that comment.
> 
>> +  if (iter_obj->child)
>> +    {
>> +      result = typy_iterator_iternext((PyObject*)iter_obj->child);
> 
> Spacing around the ( and ) is incorrect.
> 
>> +      if (result)
>> +         return result;
>> +      Py_CLEAR(iter_obj->child);
>> +    }
>> +
>> +  type = iter_obj->source->type;
>> +
>> +restart:
>> +  if (iter_obj->field >= TYPE_NFIELDS (type))
>> +    return NULL;
>> +
>> +  name = TYPE_FIELD_NAME (type, iter_obj->field);
>> +  if (!name || name[0]) /* array element or regular named member */
>>      {
> 
> Comments need to be complete and punctuated.
> 
>>        result = make_fielditem (type, iter_obj->field, iter_obj->kind);
>>        if (result != NULL)
>> @@ -1269,7 +1289,14 @@ typy_iterator_iternext (PyObject *self)
>>        return result;
>>      }
>>  
>> -  return NULL;
>> +  type = TYPE_FIELD_TYPE(type, iter_obj->field++);
>> +  child_pytype = type_to_type_object(type);
> 
> Bracket spacing.
> 
>> +  if (!child_pytype)
>> +    return NULL;
>> +  child_iter_obj =
>> (typy_iterator_object*)typy_make_iter(child_pytype, iter_obj->kind);
> 
> Bracket spacing.
> 
>> +  iter_obj->child = child_iter_obj;
>> +  iter_obj = child_iter_obj;
>> +  goto restart;
>>  }
>>  
>>  static void
> 
> Cheers,
> 
> Phil
> 


      parent reply	other threads:[~2011-10-19  2:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-08  5:35 Li Yu
2011-10-18  1:48 ` Li Yu
2011-10-18  2:46 ` Yao Qi
2011-10-18 14:03 ` Phil Muldoon
     [not found]   ` <09787EF419216C41A903FD14EE5506DD030CB90864@AUSX7MCPC103.AMER.DELL.COM>
2011-10-18 19:31     ` Paul Koning
2011-10-19  8:28   ` Li Yu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E9E3112.7050307@gmail.com \
    --to=raise.sail@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=paulkoning@comcast.net \
    --cc=pmuldoon@redhat.com \
    --cc=tromey@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox