Use @defvar to document gdb.pretty_printers

Message ID 20190320141504.15527-1-tromey@adacore.com
State New, archived
Headers

Commit Message

Tom Tromey March 20, 2019, 2:15 p.m. UTC
  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  <tromey@adacore.com>

	* 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(+)
  

Comments

Eli Zaretskii March 20, 2019, 5:27 p.m. UTC | #1
> From: Tom Tromey <tromey@adacore.com>
> Cc: Tom Tromey <tromey@adacore.com>
> Date: Wed, 20 Mar 2019 08:15:04 -0600
> 
> 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  <tromey@adacore.com>
> 
> 	* python.texi (Selecting Pretty-Printers): Use @defvar for
> 	gdb.pretty_printers.

This is OK, thanks.
  

Patch

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.