Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

Pretty_002dPrinter-Commands.html 7.2KB

3 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software" and "Free Software Needs
  8. Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
  9. and with the Back-Cover Texts as in (a) below.
  10. (a) The FSF's Back-Cover Text is: "You are free to copy and modify
  11. this GNU Manual. Buying copies from GNU Press supports the FSF in
  12. developing GNU and promoting software freedom." -->
  13. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <title>Pretty-Printer Commands (Debugging with GDB)</title>
  17. <meta name="description" content="Pretty-Printer Commands (Debugging with GDB)">
  18. <meta name="keywords" content="Pretty-Printer Commands (Debugging with GDB)">
  19. <meta name="resource-type" content="document">
  20. <meta name="distribution" content="global">
  21. <meta name="Generator" content="makeinfo">
  22. <link href="index.html#Top" rel="start" title="Top">
  23. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  24. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  25. <link href="Pretty-Printing.html#Pretty-Printing" rel="up" title="Pretty Printing">
  26. <link href="Value-History.html#Value-History" rel="next" title="Value History">
  27. <link href="Pretty_002dPrinter-Example.html#Pretty_002dPrinter-Example" rel="prev" title="Pretty-Printer Example">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.indentedblock {margin-right: 0em}
  32. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  33. blockquote.smallquotation {font-size: smaller}
  34. div.display {margin-left: 3.2em}
  35. div.example {margin-left: 3.2em}
  36. div.lisp {margin-left: 3.2em}
  37. div.smalldisplay {margin-left: 3.2em}
  38. div.smallexample {margin-left: 3.2em}
  39. div.smalllisp {margin-left: 3.2em}
  40. kbd {font-style: oblique}
  41. pre.display {font-family: inherit}
  42. pre.format {font-family: inherit}
  43. pre.menu-comment {font-family: serif}
  44. pre.menu-preformatted {font-family: serif}
  45. pre.smalldisplay {font-family: inherit; font-size: smaller}
  46. pre.smallexample {font-size: smaller}
  47. pre.smallformat {font-family: inherit; font-size: smaller}
  48. pre.smalllisp {font-size: smaller}
  49. span.nolinebreak {white-space: nowrap}
  50. span.roman {font-family: initial; font-weight: normal}
  51. span.sansserif {font-family: sans-serif; font-weight: normal}
  52. ul.no-bullet {list-style: none}
  53. -->
  54. </style>
  55. </head>
  56. <body lang="en">
  57. <a name="Pretty_002dPrinter-Commands"></a>
  58. <div class="header">
  59. <p>
  60. Previous: <a href="Pretty_002dPrinter-Example.html#Pretty_002dPrinter-Example" accesskey="p" rel="prev">Pretty-Printer Example</a>, Up: <a href="Pretty-Printing.html#Pretty-Printing" accesskey="u" rel="up">Pretty Printing</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  61. </div>
  62. <hr>
  63. <a name="Pretty_002dPrinter-Commands-1"></a>
  64. <h4 class="subsection">10.9.3 Pretty-Printer Commands</h4>
  65. <a name="index-pretty_002dprinter-commands"></a>
  66. <dl compact="compact">
  67. <dd><a name="index-info-pretty_002dprinter"></a>
  68. </dd>
  69. <dt><code>info pretty-printer [<var>object-regexp</var> [<var>name-regexp</var>]]</code></dt>
  70. <dd><p>Print the list of installed pretty-printers.
  71. This includes disabled pretty-printers, which are marked as such.
  72. </p>
  73. <p><var>object-regexp</var> is a regular expression matching the objects
  74. whose pretty-printers to list.
  75. Objects can be <code>global</code>, the program space&rsquo;s file
  76. (see <a href="Progspaces-In-Python.html#Progspaces-In-Python">Progspaces In Python</a>),
  77. and the object files within that program space (see <a href="Objfiles-In-Python.html#Objfiles-In-Python">Objfiles In Python</a>).
  78. See <a href="Selecting-Pretty_002dPrinters.html#Selecting-Pretty_002dPrinters">Selecting Pretty-Printers</a>, for details on how <small>GDB</small>
  79. looks up a printer from these three objects.
  80. </p>
  81. <p><var>name-regexp</var> is a regular expression matching the name of the printers
  82. to list.
  83. </p>
  84. <a name="index-disable-pretty_002dprinter"></a>
  85. </dd>
  86. <dt><code>disable pretty-printer [<var>object-regexp</var> [<var>name-regexp</var>]]</code></dt>
  87. <dd><p>Disable pretty-printers matching <var>object-regexp</var> and <var>name-regexp</var>.
  88. A disabled pretty-printer is not forgotten, it may be enabled again later.
  89. </p>
  90. <a name="index-enable-pretty_002dprinter"></a>
  91. </dd>
  92. <dt><code>enable pretty-printer [<var>object-regexp</var> [<var>name-regexp</var>]]</code></dt>
  93. <dd><p>Enable pretty-printers matching <var>object-regexp</var> and <var>name-regexp</var>.
  94. </p></dd>
  95. </dl>
  96. <p>Example:
  97. </p>
  98. <p>Suppose we have three pretty-printers installed: one from library1.so
  99. named <code>foo</code> that prints objects of type <code>foo</code>, and
  100. another from library2.so named <code>bar</code> that prints two types of objects,
  101. <code>bar1</code> and <code>bar2</code>.
  102. </p>
  103. <div class="smallexample">
  104. <pre class="smallexample">(gdb) info pretty-printer
  105. library1.so:
  106. foo
  107. library2.so:
  108. bar
  109. bar1
  110. bar2
  111. (gdb) info pretty-printer library2
  112. library2.so:
  113. bar
  114. bar1
  115. bar2
  116. (gdb) disable pretty-printer library1
  117. 1 printer disabled
  118. 2 of 3 printers enabled
  119. (gdb) info pretty-printer
  120. library1.so:
  121. foo [disabled]
  122. library2.so:
  123. bar
  124. bar1
  125. bar2
  126. (gdb) disable pretty-printer library2 bar;bar1
  127. 1 printer disabled
  128. 1 of 3 printers enabled
  129. (gdb) info pretty-printer library2
  130. library1.so:
  131. foo [disabled]
  132. library2.so:
  133. bar
  134. bar1 [disabled]
  135. bar2
  136. (gdb) disable pretty-printer library2 bar
  137. 1 printer disabled
  138. 0 of 3 printers enabled
  139. (gdb) info pretty-printer library2
  140. library1.so:
  141. foo [disabled]
  142. library2.so:
  143. bar [disabled]
  144. bar1 [disabled]
  145. bar2
  146. </pre></div>
  147. <p>Note that for <code>bar</code> the entire printer can be disabled,
  148. as can each individual subprinter.
  149. </p>
  150. <p>Printing values and frame arguments is done by default using
  151. the enabled pretty printers.
  152. </p>
  153. <p>The print option <code>-raw-values</code> and <small>GDB</small> setting
  154. <code>set print raw-values</code> (see <a href="Print-Settings.html#set-print-raw_002dvalues">set print raw-values</a>) can be
  155. used to print values without applying the enabled pretty printers.
  156. </p>
  157. <p>Similarly, the backtrace option <code>-raw-frame-arguments</code> and
  158. <small>GDB</small> setting <code>set print raw-frame-arguments</code>
  159. (see <a href="Print-Settings.html#set-print-raw_002dframe_002darguments">set print raw-frame-arguments</a>) can be used to ignore the
  160. enabled pretty printers when printing frame argument values.
  161. </p>
  162. <hr>
  163. <div class="header">
  164. <p>
  165. Previous: <a href="Pretty_002dPrinter-Example.html#Pretty_002dPrinter-Example" accesskey="p" rel="prev">Pretty-Printer Example</a>, Up: <a href="Pretty-Printing.html#Pretty-Printing" accesskey="u" rel="up">Pretty Printing</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  166. </div>
  167. </body>
  168. </html>