This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Python: add field access by name and standard python mapping methods to gdb.Type


> From: Paul Koning <paulkoning@comcast.net>
> Date: Thu, 15 Sep 2011 16:38:33 -0400
> 
> The attached proposed patch adds access to struct and enum fields by their name, just as field names can be used on gdb.Value objects.  It also adds the standard Python methods for mappings (dictionary-like objects), so that the kind of things that Python programmers would expect to work on objects that can be indexed by name indeed do work.  For example, you can iterate through the fields, or query if a field name exists.  

Comments for the documentation part:

> +If the type is a structure or class type, or an enum type, the fields
> +of that type can be accessed using the Python @dfn{dictionary syntax}.
> +For example, if @code{some_type} is a @code{gdb.Type} instance holding
> +a structure type, you can access its @code{foo} element with:
                                                   ^^^^^^^
For consistency with preceding text, I suggest to use "field" here.

> +@code{bar} will be a @code{gdb.Field} object; see below under the
> +description of the @code{fields()} method for a description of the

"@code{fields}", without the parens.  If you use the parentheses, it
looks like a call to `fields' with no arguments, which is not what you
want.

In general, good Texinfo usage and GNU standards frown on the man-page
tradition of using "()" to indicate that the symbol is a function.

> +gdb.Field class.

Forgot @code here.

> +Each field is an @code{gdb.Field} object, with some pre-defined attributes:
                 ^^
"a"

Okay with those changes.

Thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]