summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--share/txr/stdlib/trace.tl4
-rw-r--r--txr.124
2 files changed, 26 insertions, 2 deletions
diff --git a/share/txr/stdlib/trace.tl b/share/txr/stdlib/trace.tl
index 951b67f8..33a1bf08 100644
--- a/share/txr/stdlib/trace.tl
+++ b/share/txr/stdlib/trace.tl
@@ -16,7 +16,9 @@
(each ((n names))
(unless [sys:*trace-hash* n]
(let* ((name n)
- (prev (symbol-function n))
+ (prev (or (symbol-function n)
+ (throwf 'eval-error
+ "~s: ~s does not name a function" 'trace n)))
(hook (lambda (. args)
(let ((abandoned t)
(sys:*trace-level* (succ sys:*trace-level*)))
diff --git a/txr.1 b/txr.1
index 8b1b31eb..8e1d2dca 100644
--- a/txr.1
+++ b/txr.1
@@ -48586,11 +48586,19 @@ When
is called with one or more arguments, it considers each
argument to be the name of a global function. For each
function, it turns on tracing, if it is not already turned on.
+If an argument denotes a nonexistent function, or is invalid
+function name syntax,
+.code trace
+terminates by throwing an exception, without processing the
+subsequent arguments, or undoing the effects already applied
+due to processing the previous arguments.
When
.code trace
is called with no arguments, it lists the names of functions
-for which tracing is currently enabled.
+for which tracing is currently enabled. In other cases it
+returns
+.codn nil .
When
.code untrace
@@ -48603,6 +48611,13 @@ When
is called with no arguments, it disables tracing for all
functions.
+The
+.code untrace
+macro always returns
+.code nil
+and silently tolerates arguments which are not names of functions
+currently being traced.
+
Tracing a function consists of printing a message prior to entry into the
function indicating its name and arguments, and another message upon leaving
the function indicating its return value, which is syntactically correlated
@@ -48638,6 +48653,13 @@ will not show the destructured internal macro arguments, but only the
two arguments passed to the expander function: the whole form, and the
environment.
+The
+.code trace
+and
+.code untrace
+functions return
+.codn nil .
+
.SH* INTERACTIVE LISTENER
.SS* Overview