blob: 68c0ee19611928e002cab64021475f038146d9f9 [file] [log] [blame]
<html lang="en">
<head>
<title>gdb.printing - Debugging with GDB</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Debugging with GDB">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Python-modules.html#Python-modules" title="Python modules">
<link rel="next" href="gdb_002etypes.html#gdb_002etypes" title="gdb.types">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``Free Software'' and ``Free Software Needs
Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below.
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="gdb.printing"></a>
<a name="gdb_002eprinting"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="gdb_002etypes.html#gdb_002etypes">gdb.types</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Python-modules.html#Python-modules">Python modules</a>
<hr>
</div>
<h5 class="subsubsection">23.2.4.1 gdb.printing</h5>
<p><a name="index-gdb_002eprinting-2443"></a>
This module provides a collection of utilities for working with
pretty-printers.
<dl>
<dt><code>PrettyPrinter (</code><var>name</var><code>, </code><var>subprinters</var><code>=None)</code><dd>This class specifies the API that makes &lsquo;<samp><span class="samp">info pretty-printer</span></samp>&rsquo;,
&lsquo;<samp><span class="samp">enable pretty-printer</span></samp>&rsquo; and &lsquo;<samp><span class="samp">disable pretty-printer</span></samp>&rsquo; work.
Pretty-printers should generally inherit from this class.
<br><dt><code>SubPrettyPrinter (</code><var>name</var><code>)</code><dd>For printers that handle multiple types, this class specifies the
corresponding API for the subprinters.
<br><dt><code>RegexpCollectionPrettyPrinter (</code><var>name</var><code>)</code><dd>Utility class for handling multiple printers, all recognized via
regular expressions.
See <a href="Writing-a-Pretty_002dPrinter.html#Writing-a-Pretty_002dPrinter">Writing a Pretty-Printer</a>, for an example.
<br><dt><code>FlagEnumerationPrinter (</code><var>name</var><code>)</code><dd>A pretty-printer which handles printing of <code>enum</code> values. Unlike
<span class="sc">gdb</span>'s built-in <code>enum</code> printing, this printer attempts to
work properly when there is some overlap between the enumeration
constants. The argument <var>name</var> is the name of the printer and
also the name of the <code>enum</code> type to look up.
<br><dt><code>register_pretty_printer (</code><var>obj</var><code>, </code><var>printer</var><code>, </code><var>replace</var><code>=False)</code><dd>Register <var>printer</var> with the pretty-printer list of <var>obj</var>.
If <var>replace</var> is <code>True</code> then any existing copy of the printer
is replaced. Otherwise a <code>RuntimeError</code> exception is raised
if a printer with the same name already exists.
</dl>
</body></html>