Debugging.xhtml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:pls="http://www.w3.org/2005/01/pronunciation-lexicon" xmlns:ssml="http://www.w3.org/2001/10/synthesis" xmlns:svg="http://www.w3.org/2000/svg">
  3. <head>
  4. <title>Debugging</title>
  5. <link rel="stylesheet" type="text/css" href="docbook-epub.css"/>
  6. <link rel="stylesheet" type="text/css" href="kawa.css"/>
  7. <script src="kawa-ebook.js" type="text/javascript"/>
  8. <meta name="generator" content="DocBook XSL-NS Stylesheets V1.79.1"/>
  9. <link rel="prev" href="Parameter-objects.xhtml" title="Parameter objects"/>
  10. <link rel="next" href="Input-Output.xhtml" title="Input, output, and file handling"/>
  11. </head>
  12. <body>
  13. <header/>
  14. <section class="chapter" title="Debugging" epub:type="chapter" id="Debugging">
  15. <div class="titlepage">
  16. <div>
  17. <div>
  18. <h2 class="title">Debugging</h2>
  19. </div>
  20. </div>
  21. </div>
  22. <p class="synopsis" kind="Syntax"><span class="kind">Syntax</span><span class="ignore">: </span><a id="idm139667873060208" class="indexterm"/> <code class="function">trace</code> <em class="replaceable"><code>procedure</code></em></p>
  23. <div class="blockquote">
  24. <blockquote class="blockquote">
  25. <p>Cause <em class="replaceable"><code>procedure</code></em> to be "traced", that is debugging output will
  26. be written to the standard error port every time <em class="replaceable"><code>procedure</code></em>
  27. is called, with the parameters and return value.
  28. </p>
  29. <p>Note that Kawa will normally assume that a procedure defined with
  30. the procedure-defining variant of <code class="literal">define</code> is constant,
  31. and so it might be inlined:
  32. </p>
  33. <pre class="screen">(define (ff x) (list x x))
  34. (trace ff) ;; probably won't work
  35. (ff 3) ;; not traced
  36. </pre>
  37. <p>It works if you specify the <code class="literal">--no-inline</code> flag to Kawa.
  38. Alternatively, you can use the variable-defining variant of <code class="literal">define</code>:
  39. </p>
  40. <pre class="screen">#|kawa:1|# (define ff (lambda (x) name: 'ff (list x x)))
  41. #|kawa:2|# (trace ff) ;; works
  42. #|kawa:3|# (ff 3)
  43. call to ff (3)
  44. return from ff =&gt; (3 3)
  45. (3 3)
  46. </pre>
  47. <p>Note the use of the <code class="literal">name:</code> procedure property to give the
  48. anonymous <code class="literal">lambda</code> a name.
  49. </p>
  50. </blockquote>
  51. </div>
  52. <p class="synopsis" kind="Syntax"><span class="kind">Syntax</span><span class="ignore">: </span><a id="idm139667873051408" class="indexterm"/> <code class="function">untrace</code> <em class="replaceable"><code>procedure</code></em></p>
  53. <div class="blockquote">
  54. <blockquote class="blockquote">
  55. <p>Turn off tracing (debugging output) of <em class="replaceable"><code>procedure</code></em>.
  56. </p>
  57. </blockquote>
  58. </div>
  59. <p class="synopsis" kind="Procedure"><span class="kind">Procedure</span><span class="ignore">: </span><a id="idm139667873047600" class="indexterm"/> <code class="function">disassemble</code> <em class="replaceable"><code>procedure</code></em></p>
  60. <div class="blockquote">
  61. <blockquote class="blockquote">
  62. <p>Returns a string representation of the disassembled bytecode
  63. for <em class="replaceable"><code>procedure</code></em>, when known.
  64. </p>
  65. </blockquote>
  66. </div>
  67. </section>
  68. <footer>
  69. <div class="navfooter">
  70. <p>
  71. Up: <a accesskey="u" href="pt01.xhtml">Part . Reference Documentation</a></p>
  72. <p>
  73. Previous: <a accesskey="p" href="Eval-and-Environments.xhtml">Eval and Environments</a></p>
  74. <p>
  75. Next: <a accesskey="n" href="Input-Output.xhtml">Input, output, and file handling</a></p>
  76. </div>
  77. </footer>
  78. </body>
  79. </html>