You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
6.8KB

  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>Selecting Guile Pretty-Printers (Debugging with GDB)</title>
  17. <meta name="description" content="Selecting Guile Pretty-Printers (Debugging with GDB)">
  18. <meta name="keywords" content="Selecting Guile Pretty-Printers (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="Guile-API.html#Guile-API" rel="up" title="Guile API">
  26. <link href="Writing-a-Guile-Pretty_002dPrinter.html#Writing-a-Guile-Pretty_002dPrinter" rel="next" title="Writing a Guile Pretty-Printer">
  27. <link href="Guile-Pretty-Printing-API.html#Guile-Pretty-Printing-API" rel="prev" title="Guile Pretty Printing API">
  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="Selecting-Guile-Pretty_002dPrinters"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Writing-a-Guile-Pretty_002dPrinter.html#Writing-a-Guile-Pretty_002dPrinter" accesskey="n" rel="next">Writing a Guile Pretty-Printer</a>, Previous: <a href="Guile-Pretty-Printing-API.html#Guile-Pretty-Printing-API" accesskey="p" rel="prev">Guile Pretty Printing API</a>, Up: <a href="Guile-API.html#Guile-API" accesskey="u" rel="up">Guile API</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="Selecting-Guile-Pretty_002dPrinters-1"></a>
  64. <h4 class="subsubsection">23.3.3.9 Selecting Guile Pretty-Printers</h4>
  65. <a name="index-selecting-guile-pretty_002dprinters"></a>
  66. <p>There are three sets of pretty-printers that <small>GDB</small> searches:
  67. </p>
  68. <ul>
  69. <li> Per-objfile list of pretty-printers (see <a href="Objfiles-In-Guile.html#Objfiles-In-Guile">Objfiles In Guile</a>).
  70. </li><li> Per-progspace list of pretty-printers (see <a href="Progspaces-In-Guile.html#Progspaces-In-Guile">Progspaces In Guile</a>).
  71. </li><li> The global list of pretty-printers (see <a href="Guile-Pretty-Printing-API.html#Guile-Pretty-Printing-API">Guile Pretty Printing API</a>).
  72. These printers are available when debugging any inferior.
  73. </li></ul>
  74. <p>Pretty-printer lookup is done by passing the value to be printed to the
  75. lookup function of each enabled object in turn.
  76. Lookup stops when a lookup function returns a non-<code>#f</code> value
  77. or when the list is exhausted.
  78. Lookup functions must return either a <code>&lt;gdb:pretty-printer-worker&gt;</code>
  79. object or <code>#f</code>. Otherwise an exception is thrown.
  80. </p>
  81. <p><small>GDB</small> first checks the result of <code>objfile-pretty-printers</code>
  82. of each <code>&lt;gdb:objfile&gt;</code> in the current program space and iteratively
  83. calls each enabled lookup function in the list for that <code>&lt;gdb:objfile&gt;</code>
  84. until a non-<code>#f</code> object is returned.
  85. If no pretty-printer is found in the objfile lists, <small>GDB</small> then
  86. searches the result of <code>progspace-pretty-printers</code> of the current
  87. program space, calling each enabled function until a non-<code>#f</code> object
  88. is returned.
  89. After these lists have been exhausted, it tries the global pretty-printers
  90. list, obtained with <code>pretty-printers</code>, again calling each enabled
  91. function until a non-<code>#f</code> object is returned.
  92. </p>
  93. <p>The order in which the objfiles are searched is not specified. For a
  94. given list, functions are always invoked from the head of the list,
  95. and iterated over sequentially until the end of the list, or a
  96. <code>&lt;gdb:pretty-printer-worker&gt;</code> object is returned.
  97. </p>
  98. <p>For various reasons a pretty-printer may not work.
  99. For example, the underlying data structure may have changed and
  100. the pretty-printer is out of date.
  101. </p>
  102. <p>The consequences of a broken pretty-printer are severe enough that
  103. <small>GDB</small> provides support for enabling and disabling individual
  104. printers. For example, if <code>print frame-arguments</code> is on,
  105. a backtrace can become highly illegible if any argument is printed
  106. with a broken printer.
  107. </p>
  108. <p>Pretty-printers are enabled and disabled from Scheme by calling
  109. <code>set-pretty-printer-enabled!</code>.
  110. See <a href="Guile-Pretty-Printing-API.html#Guile-Pretty-Printing-API">Guile Pretty Printing API</a>.
  111. </p>
  112. <hr>
  113. <div class="header">
  114. <p>
  115. Next: <a href="Writing-a-Guile-Pretty_002dPrinter.html#Writing-a-Guile-Pretty_002dPrinter" accesskey="n" rel="next">Writing a Guile Pretty-Printer</a>, Previous: <a href="Guile-Pretty-Printing-API.html#Guile-Pretty-Printing-API" accesskey="p" rel="prev">Guile Pretty Printing API</a>, Up: <a href="Guile-API.html#Guile-API" accesskey="u" rel="up">Guile API</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>
  116. </div>
  117. </body>
  118. </html>