From 50cbab589eb6e5b841dd2e916a1026f477b7be15 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku <kaz@kylheku.com> Date: Sat, 19 Nov 2016 21:04:49 -0800 Subject: Diagnose undefined functions in trace. * share/txr/stdlib/trace.tl (sys:trace): If symbol-function returns nil, throw exception. * txr.1: Document the behavior, along with return values of trace and untrace, and the tolerance of untrace to bad arguments. --- txr.1 | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'txr.1') 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 -- cgit v1.2.3