Clarify documentation for pretty_printer.child

Message ID 20240521111728.928069-1-tromey@adacore.com
State New
Headers
Series Clarify documentation for pretty_printer.child |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm warning Patch is already merged
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 warning Patch is already merged

Commit Message

Tom Tromey May 21, 2024, 11:17 a.m. UTC
  An Ada pretty-printer had a bug where its 'child' method returned a
gdb.Value rather than a tuple.  Kévin suggested that the documentation
for this method could be improved to clarify this.
---
 gdb/doc/python.texi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
  

Comments

Kévin Le Gouguec May 21, 2024, 11:48 a.m. UTC | #1
Tom Tromey <tromey@adacore.com> writes:

> An Ada pretty-printer had a bug where its 'child' method returned a
> gdb.Value rather than a tuple.  Kévin suggested that the documentation
> for this method could be improved to clarify this.
> ---
>  gdb/doc/python.texi | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
> index 4ca3ae4eca4..86ccc140c6d 100644
> --- a/gdb/doc/python.texi
> +++ b/gdb/doc/python.texi
> @@ -1869,8 +1869,9 @@ If available, this method should return the number of children.
>  This is not a basic method, so @value{GDBN} will only ever call it for
>  objects derived from @code{gdb.ValuePrinter}.
>  
> -If available, this method should return the child value indicated by
> -@var{n}.  Indices start at zero.
> +If available, this method should return the child item (that is, a
> +tuple holding the name and value of this child) indicated by @var{n}.
> +Indices start at zero.
>  @end defun
>  
>  @value{GDBN} provides a function which can be used to look up the

Thanks, I think that clear things up pretty well!

Reviewed-By: Kévin Le Gouguec <legouguec@adacore.com>
  
Eli Zaretskii May 21, 2024, 12:16 p.m. UTC | #2
> From: Tom Tromey <tromey@adacore.com>
> Cc: Tom Tromey <tromey@adacore.com>
> Date: Tue, 21 May 2024 05:17:28 -0600
> 
> An Ada pretty-printer had a bug where its 'child' method returned a
> gdb.Value rather than a tuple.  Kévin suggested that the documentation
> for this method could be improved to clarify this.
> ---
>  gdb/doc/python.texi | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

This is okay, thanks.

Approved-By: Eli Zaretskii <eliz@gnu.org>
  

Patch

diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index 4ca3ae4eca4..86ccc140c6d 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -1869,8 +1869,9 @@  If available, this method should return the number of children.
 This is not a basic method, so @value{GDBN} will only ever call it for
 objects derived from @code{gdb.ValuePrinter}.
 
-If available, this method should return the child value indicated by
-@var{n}.  Indices start at zero.
+If available, this method should return the child item (that is, a
+tuple holding the name and value of this child) indicated by @var{n}.
+Indices start at zero.
 @end defun
 
 @value{GDBN} provides a function which can be used to look up the