From patchwork Fri May 10 14:33:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32633 Received: (qmail 20125 invoked by alias); 10 May 2019 14:33:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 19971 invoked by uid 89); 10 May 2019 14:33:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=earliest, displayed, lazily, act X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 May 2019 14:33:26 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 689801178DD; Fri, 10 May 2019 10:33:25 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id v+GzZXLcxlWi; Fri, 10 May 2019 10:33:25 -0400 (EDT) Received: from murgatroyd.Home (97-122-168-123.hlrn.qwest.net [97.122.168.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 140DB1177EB; Fri, 10 May 2019 10:33:25 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Document lazy computation for pretty-printer "children" method Date: Fri, 10 May 2019 08:33:23 -0600 Message-Id: <20190510143323.19979-1-tromey@adacore.com> MIME-Version: 1.0 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 * 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