[PATCH] gdb: update Type.fields doc based on actual GDB behavior
Eli Zaretskii
eliz@gnu.org
Tue May 4 18:48:41 GMT 2021
> Date: Tue, 4 May 2021 14:45:50 -0400
> From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
>
> I noticed two errors in the Type.fields documentation:
>
> 1. It is possible to call `fields` on an array type, in which case it
> returns one field representing the array's range. It is not
> mentioned.
>
> 2. When calling `fields` on a type that doesn't have fields (by nature,
> like an int), GDB raises a TypeError. It does not return an empty
> sequence, as currently documented.
>
> Fix these, and change the text into a bullet list. I find it easier to
> read than one big paragraph.
>
> The first issue is already tested in gdb.python/py-type.exp, but the
> second one doesn't seem tested. Add a test in gdb.python/py-type.exp
> for it.
>
> gdb/doc/ChangeLog:
>
> * python.texi (Types In Python): Re-organize Type.fields doc.
> Mention handling of array types. Correct doc for when calling
> the method on another type.
>
> gdb/testsuite/ChangeLog:
>
> * gdb.python/py-type.exp (test_fields): Test calling fields on
> an int type.
>
Thanks, the documentation part is OK.
More information about the Gdb-patches
mailing list