Selecting-Guile-Pretty_002dPrinters.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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 5.1, http://www.gnu.org/software/texinfo/ -->
  14. <head>
  15. <title>Debugging with GDB: Selecting Guile Pretty-Printers</title>
  16. <meta name="description" content="Debugging with GDB: Selecting Guile Pretty-Printers">
  17. <meta name="keywords" content="Debugging with GDB: Selecting Guile Pretty-Printers">
  18. <meta name="resource-type" content="document">
  19. <meta name="distribution" content="global">
  20. <meta name="Generator" content="makeinfo">
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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="previous" title="Guile Pretty Printing API">
  28. <style type="text/css">
  29. <!--
  30. a.summary-letter {text-decoration: none}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.indentedblock {margin-left: 3.2em}
  35. div.lisp {margin-left: 3.2em}
  36. div.smalldisplay {margin-left: 3.2em}
  37. div.smallexample {margin-left: 3.2em}
  38. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  50. span.nolinebreak {white-space:nowrap}
  51. span.roman {font-family:serif; font-weight:normal}
  52. span.sansserif {font-family:sans-serif; font-weight:normal}
  53. ul.no-bullet {list-style: none}
  54. -->
  55. </style>
  56. </head>
  57. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  58. <a name="Selecting-Guile-Pretty_002dPrinters"></a>
  59. <div class="header">
  60. <p>
  61. 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="previous">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>
  62. </div>
  63. <hr>
  64. <a name="Selecting-Guile-Pretty_002dPrinters-1"></a>
  65. <h4 class="subsubsection">23.3.3.9 Selecting Guile Pretty-Printers</h4>
  66. <a name="index-selecting-guile-pretty_002dprinters"></a>
  67. <p>There are three sets of pretty-printers that <small>GDB</small> searches:
  68. </p>
  69. <ul>
  70. <li> Per-objfile list of pretty-printers (see <a href="Objfiles-In-Guile.html#Objfiles-In-Guile">Objfiles In Guile</a>).
  71. </li><li> Per-progspace list of pretty-printers (see <a href="Progspaces-In-Guile.html#Progspaces-In-Guile">Progspaces In Guile</a>).
  72. </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>).
  73. These printers are available when debugging any inferior.
  74. </li></ul>
  75. <p>Pretty-printer lookup is done by passing the value to be printed to the
  76. lookup function of each enabled object in turn.
  77. Lookup stops when a lookup function returns a non-<code>#f</code> value
  78. or when the list is exhausted.
  79. Lookup functions must return either a <code>&lt;gdb:pretty-printer-worker&gt;</code>
  80. object or <code>#f</code>. Otherwise an exception is thrown.
  81. </p>
  82. <p><small>GDB</small> first checks the result of <code>objfile-pretty-printers</code>
  83. of each <code>&lt;gdb:objfile&gt;</code> in the current program space and iteratively
  84. calls each enabled lookup function in the list for that <code>&lt;gdb:objfile&gt;</code>
  85. until a non-<code>#f</code> object is returned.
  86. If no pretty-printer is found in the objfile lists, <small>GDB</small> then
  87. searches the result of <code>progspace-pretty-printers</code> of the current
  88. program space, calling each enabled function until a non-<code>#f</code> object
  89. is returned.
  90. After these lists have been exhausted, it tries the global pretty-printers
  91. list, obtained with <code>pretty-printers</code>, again calling each enabled
  92. function until a non-<code>#f</code> object is returned.
  93. </p>
  94. <p>The order in which the objfiles are searched is not specified. For a
  95. given list, functions are always invoked from the head of the list,
  96. and iterated over sequentially until the end of the list, or a
  97. <code>&lt;gdb:pretty-printer-worker&gt;</code> object is returned.
  98. </p>
  99. <p>For various reasons a pretty-printer may not work.
  100. For example, the underlying data structure may have changed and
  101. the pretty-printer is out of date.
  102. </p>
  103. <p>The consequences of a broken pretty-printer are severe enough that
  104. <small>GDB</small> provides support for enabling and disabling individual
  105. printers. For example, if <code>print frame-arguments</code> is on,
  106. a backtrace can become highly illegible if any argument is printed
  107. with a broken printer.
  108. </p>
  109. <p>Pretty-printers are enabled and disabled from Scheme by calling
  110. <code>set-pretty-printer-enabled!</code>.
  111. See <a href="Guile-Pretty-Printing-API.html#Guile-Pretty-Printing-API">Guile Pretty Printing API</a>.
  112. </p>
  113. <hr>
  114. <div class="header">
  115. <p>
  116. 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="previous">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>
  117. </div>
  118. </body>
  119. </html>