Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

218 lines
9.1KB

  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>Guile Exception Handling (Debugging with GDB)</title>
  17. <meta name="description" content="Guile Exception Handling (Debugging with GDB)">
  18. <meta name="keywords" content="Guile Exception Handling (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="Values-From-Inferior-In-Guile.html#Values-From-Inferior-In-Guile" rel="next" title="Values From Inferior In Guile">
  27. <link href="GDB-Scheme-Data-Types.html#GDB-Scheme-Data-Types" rel="prev" title="GDB Scheme Data Types">
  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="Guile-Exception-Handling"></a>
  58. <div class="header">
  59. <p>
  60. Next: <a href="Values-From-Inferior-In-Guile.html#Values-From-Inferior-In-Guile" accesskey="n" rel="next">Values From Inferior In Guile</a>, Previous: <a href="GDB-Scheme-Data-Types.html#GDB-Scheme-Data-Types" accesskey="p" rel="prev">GDB Scheme Data Types</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="Guile-Exception-Handling-1"></a>
  64. <h4 class="subsubsection">23.3.3.4 Guile Exception Handling</h4>
  65. <a name="index-guile-exceptions"></a>
  66. <a name="index-exceptions_002c-guile"></a>
  67. <a name="index-set-guile-print_002dstack"></a>
  68. <p>When executing the <code>guile</code> command, Guile exceptions
  69. uncaught within the Guile code are translated to calls to the
  70. <small>GDB</small> error-reporting mechanism. If the command that called
  71. <code>guile</code> does not handle the error, <small>GDB</small> will
  72. terminate it and report the error according to the setting of
  73. the <code>guile print-stack</code> parameter.
  74. </p>
  75. <p>The <code>guile print-stack</code> parameter has three settings:
  76. </p>
  77. <dl compact="compact">
  78. <dt><code>none</code></dt>
  79. <dd><p>Nothing is printed.
  80. </p>
  81. </dd>
  82. <dt><code>message</code></dt>
  83. <dd><p>An error message is printed containing the Guile exception name,
  84. the associated value, and the Guile call stack backtrace at the
  85. point where the exception was raised. Example:
  86. </p>
  87. <div class="smallexample">
  88. <pre class="smallexample">(gdb) guile (display foo)
  89. ERROR: In procedure memoize-variable-access!:
  90. ERROR: Unbound variable: foo
  91. Error while executing Scheme code.
  92. </pre></div>
  93. </dd>
  94. <dt><code>full</code></dt>
  95. <dd><p>In addition to an error message a full backtrace is printed.
  96. </p>
  97. <div class="smallexample">
  98. <pre class="smallexample">(gdb) set guile print-stack full
  99. (gdb) guile (display foo)
  100. Guile Backtrace:
  101. In ice-9/boot-9.scm:
  102. 157: 10 [catch #t #&lt;catch-closure 2c76e20&gt; ...]
  103. In unknown file:
  104. ?: 9 [apply-smob/1 #&lt;catch-closure 2c76e20&gt;]
  105. In ice-9/boot-9.scm:
  106. 157: 8 [catch #t #&lt;catch-closure 2c76d20&gt; ...]
  107. In unknown file:
  108. ?: 7 [apply-smob/1 #&lt;catch-closure 2c76d20&gt;]
  109. ?: 6 [call-with-input-string &quot;(display foo)&quot; ...]
  110. In ice-9/boot-9.scm:
  111. 2320: 5 [save-module-excursion #&lt;procedure 2c2dc30 ... ()&gt;]
  112. In ice-9/eval-string.scm:
  113. 44: 4 [read-and-eval #&lt;input: string 27cb410&gt; #:lang ...]
  114. 37: 3 [lp (display foo)]
  115. In ice-9/eval.scm:
  116. 387: 2 [eval # ()]
  117. 393: 1 [eval #&lt;memoized foo&gt; ()]
  118. In unknown file:
  119. ?: 0 [memoize-variable-access! #&lt;memoized foo&gt; ...]
  120. ERROR: In procedure memoize-variable-access!:
  121. ERROR: Unbound variable: foo
  122. Error while executing Scheme code.
  123. </pre></div>
  124. </dd>
  125. </dl>
  126. <p><small>GDB</small> errors that happen in <small>GDB</small> commands invoked by
  127. Guile code are converted to Guile exceptions. The type of the
  128. Guile exception depends on the error.
  129. </p>
  130. <p>Guile procedures provided by <small>GDB</small> can throw the standard
  131. Guile exceptions like <code>wrong-type-arg</code> and <code>out-of-range</code>.
  132. </p>
  133. <p>User interrupt (via <kbd>C-c</kbd> or by typing <kbd>q</kbd> at a pagination
  134. prompt) is translated to a Guile <code>signal</code> exception with value
  135. <code>SIGINT</code>.
  136. </p>
  137. <p><small>GDB</small> Guile procedures can also throw these exceptions:
  138. </p>
  139. <dl compact="compact">
  140. <dt><code>gdb:error</code>
  141. <a name="index-gdb_003aerror"></a>
  142. </dt>
  143. <dd><p>This exception is a catch-all for errors generated from within <small>GDB</small>.
  144. </p>
  145. </dd>
  146. <dt><code>gdb:invalid-object</code>
  147. <a name="index-gdb_003ainvalid_002dobject"></a>
  148. </dt>
  149. <dd><p>This exception is thrown when accessing Guile objects that wrap underlying
  150. <small>GDB</small> objects have become invalid. For example, a
  151. <code>&lt;gdb:breakpoint&gt;</code> object becomes invalid if the user deletes it
  152. from the command line. The object still exists in Guile, but the
  153. object it represents is gone. Further operations on this breakpoint
  154. will throw this exception.
  155. </p>
  156. </dd>
  157. <dt><code>gdb:memory-error</code>
  158. <a name="index-gdb_003amemory_002derror"></a>
  159. </dt>
  160. <dd><p>This exception is thrown when an operation tried to access invalid
  161. memory in the inferior.
  162. </p>
  163. </dd>
  164. <dt><code>gdb:pp-type-error</code>
  165. <a name="index-gdb_003app_002dtype_002derror"></a>
  166. </dt>
  167. <dd><p>This exception is thrown when a Guile pretty-printer passes a bad object
  168. to <small>GDB</small>.
  169. </p></dd>
  170. </dl>
  171. <p>The following exception-related procedures are provided by the
  172. <code>(gdb)</code> module.
  173. </p>
  174. <dl>
  175. <dt><a name="index-make_002dexception"></a>Scheme Procedure: <strong>make-exception</strong> <em>key args</em></dt>
  176. <dd><p>Return a <code>&lt;gdb:exception&gt;</code> object given by its <var>key</var> and
  177. <var>args</var>, which are the standard Guile parameters of an exception.
  178. See the Guile documentation for more information (see <a href="http://www.gnu.org/software/guile/manual/html_node/Exceptions.html#Exceptions">Exceptions</a> in <cite>GNU Guile Reference Manual</cite>).
  179. </p></dd></dl>
  180. <dl>
  181. <dt><a name="index-exception_003f"></a>Scheme Procedure: <strong>exception?</strong> <em>object</em></dt>
  182. <dd><p>Return <code>#t</code> if <var>object</var> is a <code>&lt;gdb:exception&gt;</code> object.
  183. Otherwise return <code>#f</code>.
  184. </p></dd></dl>
  185. <dl>
  186. <dt><a name="index-exception_002dkey"></a>Scheme Procedure: <strong>exception-key</strong> <em>exception</em></dt>
  187. <dd><p>Return the <var>args</var> field of a <code>&lt;gdb:exception&gt;</code> object.
  188. </p></dd></dl>
  189. <dl>
  190. <dt><a name="index-exception_002dargs"></a>Scheme Procedure: <strong>exception-args</strong> <em>exception</em></dt>
  191. <dd><p>Return the <var>args</var> field of a <code>&lt;gdb:exception&gt;</code> object.
  192. </p></dd></dl>
  193. <hr>
  194. <div class="header">
  195. <p>
  196. Next: <a href="Values-From-Inferior-In-Guile.html#Values-From-Inferior-In-Guile" accesskey="n" rel="next">Values From Inferior In Guile</a>, Previous: <a href="GDB-Scheme-Data-Types.html#GDB-Scheme-Data-Types" accesskey="p" rel="prev">GDB Scheme Data Types</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>
  197. </div>
  198. </body>
  199. </html>