Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Document lazy computation for pretty-printer "children" method
@ 2019-05-10 14:33 Tom Tromey
  2019-05-10 15:18 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2019-05-10 14:33 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I found out recently that some users didn't know that the Python
pretty-printers "children" method should compute its result lazily.
This has been a good idea since the earliest days, but wasn't
mentioned in the docs.  This patch adds some text to this effect.

gdb/doc/ChangeLog
2019-05-10  Tom Tromey  <tromey@adacore.com>

	* python.texi (Pretty Printing API): Mention lazy computation for
	"children".
---
 gdb/doc/ChangeLog   | 5 +++++
 gdb/doc/python.texi | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index b47c38deef7..98e52bb770c 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -1371,6 +1371,12 @@ object which is convertible to a @value{GDBN} value.
 This method is optional.  If it does not exist, @value{GDBN} will act
 as though the value has no children.
 
+For efficiency, the @code{children} method should lazily compute its
+results.  This will let @value{GDBN} read as few elements as
+necessary, for example when various print settings (@pxref{Print
+Settings}) or @code{-var-list-children} (@pxref{GDB/MI Variable
+Objects}) limit the number of elements to be displayed.
+
 Children may be hidden from display based on the value of @samp{set
 print max-depth} (@pxref{Print Settings}).
 @end defun
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Document lazy computation for pretty-printer "children" method
  2019-05-10 14:33 [PATCH] Document lazy computation for pretty-printer "children" method Tom Tromey
@ 2019-05-10 15:18 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2019-05-10 15:18 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> From: Tom Tromey <tromey@adacore.com>
> Cc: Tom Tromey <tromey@adacore.com>
> Date: Fri, 10 May 2019 08:33:23 -0600
> 
> I found out recently that some users didn't know that the Python
> pretty-printers "children" method should compute its result lazily.
> This has been a good idea since the earliest days, but wasn't
> mentioned in the docs.  This patch adds some text to this effect.
> 
> gdb/doc/ChangeLog
> 2019-05-10  Tom Tromey  <tromey@adacore.com>
> 
> 	* python.texi (Pretty Printing API): Mention lazy computation for
> 	"children".

Thanks, this is fine.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-10 15:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-10 14:33 [PATCH] Document lazy computation for pretty-printer "children" method Tom Tromey
2019-05-10 15:18 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox