[PATCH v1] gdb/DAP Introduce new methods to to Pretty Printers

Eli Zaretskii eliz@gnu.org
Sun Jun 25 10:22:32 GMT 2023


> From: Simon Farre <simon.farre.cx@gmail.com>
> Cc: tom@tromey.com,
> 	eliz@gnu.org,
> 	Simon Farre <simon.farre.cx@gmail.com>
> Date: Sun, 25 Jun 2023 11:21:16 +0200
> 
> diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
> index 9cb97a9597d..61a7e49d1df 100644
> --- a/gdb/doc/python.texi
> +++ b/gdb/doc/python.texi
> @@ -1707,6 +1707,23 @@ Children may be hidden from display based on the value of @samp{set
>  print max-depth} (@pxref{Print Settings}).
>  @end defun
>  
> +@defun pretty_printer.children_range (self, start, end)
> +This method is optional but @value{GDBN} will call this method to
> +be able to more effeciently compute a sub-range of children
> +of the pretty-printers value.  If the pretty printer is for an
> +array-like type, it is recommended that this method is implemented
> +as the DAP interpreter will make extended use of it.  For an example on how
> +to best implement this method @pxref{Writing a Pretty-Printer}.  Not
> +implementing this and @code{num_children} can have drastic effects on
> +the performance of a DAP-interpreter debug session.
> +@end defun

Shouldn't this tell what will happen if this method is not
implemented?  The text side-steps that, but I think we should says
something about that.

> +@defun pretty_printer.num_children (self)
> +@value{GDBN} can call this method to query how many children this pretty
> +printer will return from a @code{pretty_printer.children ()} call. This method

That should be just @code{pretty_printer.children}, without the
parentheses.  Also, please leave two spaces between sentences.

Thanks.

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


More information about the Gdb-patches mailing list