From patchwork Wed Mar 20 14:15:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31913 Received: (qmail 98459 invoked by alias); 20 Mar 2019 14:15:30 -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 98381 invoked by uid 89); 20 Mar 2019 14:15:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 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=prettyprinter, pretty-printer, HContent-Transfer-Encoding:8bit 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; Wed, 20 Mar 2019 14:15:13 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 51157560CC; Wed, 20 Mar 2019 10:15:08 -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 Pi1tbMaSGnwb; Wed, 20 Mar 2019 10:15:08 -0400 (EDT) Received: from murgatroyd.Home (174-29-37-56.hlrn.qwest.net [174.29.37.56]) (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 089C8560C1; Wed, 20 Mar 2019 10:15:07 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Use @defvar to document gdb.pretty_printers Date: Wed, 20 Mar 2019 08:15:04 -0600 Message-Id: <20190320141504.15527-1-tromey@adacore.com> MIME-Version: 1.0 While referencing the manual, I noticed that gdb.pretty_printers wasn't documented using @defvar. This made it more difficult to find in the info pages. This patch adds the @defvar and also an introductory paragraph in that node. gdb/doc/ChangeLog 2019-03-20 Tom Tromey * python.texi (Selecting Pretty-Printers): Use @defvar for gdb.pretty_printers. --- gdb/doc/ChangeLog | 5 +++++ gdb/doc/python.texi | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index b02a154ce1b..6fadaffa371 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -1363,10 +1363,21 @@ printer exists, then this returns @code{None}. @subsubsection Selecting Pretty-Printers @cindex selecting python pretty-printers +@value{GDBN} provides several ways to register a pretty-printer: +globally, per program space, and per objfile. When choosing how to +register your pretty-printer, a good rule is to register it with the +smallest scope possible: that is prefer a specific objfile first, then +a program space, and only register a printer globally as a last +resort. + +@findex gdb.pretty_printers +@defvar gdb.pretty_printers The Python list @code{gdb.pretty_printers} contains an array of functions or callable objects that have been registered via addition as a pretty-printer. Printers in this list are called @code{global} printers, they're available when debugging all inferiors. +@end defvar + Each @code{gdb.Progspace} contains a @code{pretty_printers} attribute. Each @code{gdb.Objfile} also contains a @code{pretty_printers} attribute.