Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH] Document lazy computation for pretty-printer "children" method
Date: Fri, 10 May 2019 14:33:00 -0000	[thread overview]
Message-ID: <20190510143323.19979-1-tromey@adacore.com> (raw)

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


             reply	other threads:[~2019-05-10 14:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-10 14:33 Tom Tromey [this message]
2019-05-10 15:18 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190510143323.19979-1-tromey@adacore.com \
    --to=tromey@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox