1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>trace (ANSI and GNU Common Lisp Document)</title>
<meta name="description" content="trace (ANSI and GNU Common Lisp Document)">
<meta name="keywords" content="trace (ANSI and GNU Common Lisp Document)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Environment-Dictionary.html" rel="up" title="Environment Dictionary">
<link href="step.html" rel="next" title="step">
<link href="describe_002dobject.html" rel="prev" title="describe-object">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<span id="trace"></span><div class="header">
<p>
Next: <a href="step.html" accesskey="n" rel="next">step</a>, Previous: <a href="describe_002dobject.html" accesskey="p" rel="prev">describe-object</a>, Up: <a href="Environment-Dictionary.html" accesskey="u" rel="up">Environment Dictionary</a> </p>
</div>
<hr>
<span id="trace_002c-untrace-_005bMacro_005d"></span><h4 class="subsection">25.2.8 trace, untrace [Macro]</h4>
<p><code>trace</code> <i>{<i>function-name</i>}*</i> ⇒ <i>trace-result</i>
</p>
<p><code>untrace</code> <i>{<i>function-name</i>}*</i> ⇒ <i>untrace-result</i>
</p>
<span id="Arguments-and-Values_003a_003a-494"></span><h4 class="subsubheading">Arguments and Values::</h4>
<p><i>function-name</i>—a <i>function name</i>.
</p>
<p><i>trace-result</i>—<i>implementation-dependent</i>,
unless no <i>function-names</i> are supplied,
in which case <i>trace-result</i> is a <i>list</i> of <i>function names</i>.
</p>
<p><i>untrace-result</i>—<i>implementation-dependent</i>.
</p>
<span id="Description_003a_003a-656"></span><h4 class="subsubheading">Description::</h4>
<p><b>trace</b> and <b>untrace</b> control the invocation of the trace facility.
</p>
<p>Invoking <b>trace</b> with one or more <i>function-names</i> causes
the denoted <i>functions</i> to be “traced.”
Whenever a traced <i>function</i> is invoked, information
about the call,
about the arguments passed,
and about any eventually returned values
is printed to <i>trace output</i>.
If <b>trace</b> is used with no <i>function-names</i>,
no tracing action is performed;
instead, a list of the <i>functions</i> currently being traced is returned.
</p>
<p>Invoking <b>untrace</b> with one or more function names causes those
functions to be “untraced” (<i>i.e.</i>, no longer traced).
If <b>untrace</b> is used with no <i>function-names</i>,
all <i>functions</i> currently being traced are untraced.
</p>
<p>If a <i>function</i> to be traced has been open-coded
(<i>e.g.</i>, because it was declared <b>inline</b>),
a call to that <i>function</i> might not produce trace output.
</p>
<span id="Examples_003a_003a-466"></span><h4 class="subsubheading">Examples::</h4>
<div class="example">
<pre class="example"> (defun fact (n) (if (zerop n) 1 (* n (fact (- n 1)))))
⇒ FACT
(trace fact)
⇒ (FACT)
;; Of course, the format of traced output is implementation-dependent.
(fact 3)
<tt> |> </tt> 1 Enter FACT 3
<tt> |> </tt> | 2 Enter FACT 2
<tt> |> </tt> | 3 Enter FACT 1
<tt> |> </tt> | | 4 Enter FACT 0
<tt> |> </tt> | | 4 Exit FACT 1
<tt> |> </tt> | 3 Exit FACT 1
<tt> |> </tt> | 2 Exit FACT 2
<tt> |> </tt> 1 Exit FACT 6
⇒ 6
</pre></div>
<span id="Side-Effects_003a_003a-84"></span><h4 class="subsubheading">Side Effects::</h4>
<p>Might change the definitions of the <i>functions</i> named by <i>function-names</i>.
</p>
<span id="Affected-By_003a_003a-124"></span><h4 class="subsubheading">Affected By::</h4>
<p>Whether the functions named are defined or already being traced.
</p>
<span id="Exceptional-Situations_003a_003a-239"></span><h4 class="subsubheading">Exceptional Situations::</h4>
<p>Tracing an already traced function,
or untracing a function not currently being traced,
should produce no harmful effects, but might signal a warning.
</p>
<span id="See-Also_003a_003a-534"></span><h4 class="subsubheading">See Also::</h4>
<p><b>*trace-output*</b>,
<a href="step.html">step</a>
</p>
<span id="Notes_003a_003a-327"></span><h4 class="subsubheading">Notes::</h4>
<p><b>trace</b> and <b>untrace</b> may also accept additional
<i>implementation-dependent</i> argument formats. The format of the trace
output is <i>implementation-dependent</i>.
</p>
<p>Although <b>trace</b> can be extended to permit non-standard options,
<i>implementations</i> are nevertheless encouraged (but not required)
to warn about the use of syntax or options
that are neither specified by this standard
nor added as an extension by the <i>implementation</i>,
since they could be symptomatic of typographical errors
or of reliance on features supported in <i>implementations</i>
other than the current <i>implementation</i>.
</p>
<hr>
<div class="header">
<p>
Next: <a href="step.html" accesskey="n" rel="next">step</a>, Previous: <a href="describe_002dobject.html" accesskey="p" rel="prev">describe-object</a>, Up: <a href="Environment-Dictionary.html" accesskey="u" rel="up">Environment Dictionary</a> </p>
</div>
</body>
</html>
|