MTS 8: LISP and SLIP in MTS
June 1976
world and affect the course of the computation. It uses the prompting
character (=) to indicate it is ready to accept input for evaluation, in
the same way as the top level of LISP uses "*". The user may type in an
expression for evaluation and the value will be printed out, followed by
another (=). Or the user can type in one of the commands described
below which are specifically recognized by BREAKFUNCTION. Since BREAK-
FUNCTION puts all of the power of LISP at the user’s command, anything
that can be done at the top level of LISP can be done with BREAKFUNC-
TION. For example, one can define new functions or edit existing ones,
set breaks, or trace functions. The user may evaluate an expression,
see that the value was incorrect, call the editor, change a function,
and evaluate the expression again, all without leaving the break.
It is important to emphasize that once a break occurs, the user is in
complete control of the flow of the computation, and the computation
will not proceed without specific instruction. Only if the user gives
one of the commands that exits from the break (GO, OK, RETURN, FROM)
will the computation continue. The computation can also be aborted
(using # or ##, which are defined later in this section).
Note that BREAKFUNCTION is just another LISP function, not a special
system feature like the interpreter or the garbage collector. It has
arguments and returns a value, like any other function. A call to
BREAKFUNCTION has the form
(BREAKFUNCTION BREAKEXPR BREAKWHEN BREAKFN BREAKCMDS BREAKTYPE)
BREAKWHEN This argument is a LISP function which is evaluated to
determine if a break will occur.
BREAKEXPR BREAKEXPR is a form to be evaluated by BREAKFUNCTION.
If BREAKWHEN returns NIL, BREAKEXPR is evaluated and
returned as the value of the break. If BREAKWHEN
returns any other value, a break occurs. After a
break occurs, the commands GO, OK, and EVAL (see
command descriptions) cause BREAKEXPR to be evaluated.
BREAKFN This argument is the name of the function being
broken. BREAKFN is used to print the above message
when a break occurs.
BREAKCMDS This argument is a list of command lines which are
executed immediately, in the event of a break. The
command lines on BREAKCMDS are executed before com-
mands are accepted from the terminal, so that if one
of the commands on BREAKCMDS causes a return, a break
occurs without the need for user interaction.
BREAKTYPE This argument identifies the type of break. It is
used primarily by the Error Package. In all cases the
user can use BREAK for this argument.
102 LISP Debugging Facilities

MTS 8: LISP and SLIP in MTS
June 1976
The value returned by BREAKFUNCTION is called "the value of the
break." The user can specify this value explicitly by using the RETURN
command described below. In most cases, however, the value of the break
is given implicitly, via a GO or OK command, and is the result of
evaluating "the break expression," BREAKEXPR.
BREAKEXPR is, in general, an expression equivalent to the computation
that would have taken place had no break occurred. In other words, one
can think of BREAKFUNCTION as a fancy EVAL, which permits interaction
before and after evaluation. The break expression then corresponds to
the argument to EVAL. For BREAKF and TRACEF, BREAKEXPR is a form
equivalent to that of the function being traced or broken. For errors,
BREAKEXPR is the form which causes the error.
Break Commands ______________
Once in a break, in addition to evaluating expressions, the user can
ask BREAKFUNCTION to perform certain useful actions by issuing atomic
items as "break commands." The following commands can be entered
directly by the user or may be put on the BREAKCMDS list.
GO This command releases the break and allows the compu-
tation to proceed. BREAKFUNCTION evaluates BREAKEXPR,
prints and returns the value, as the value of the
break.
OK This command operates in the same manner as GO except
that the value of BREAKEXPR is not printed.
EVAL This command causes BREAKEXPR to be evaluated. The
break is maintained and the value of the evaluation is
printed and bound on the variable BREAKVALUE. Neither
GO nor OK will cause reevaluation of BREAKEXPR follow-
ing EVAL, but another EVAL will. EVAL is a useful
command when the user is not sure whether the break
will produce the correct value and wants to be able to
correct it if it is wrong.
RETURN form The "form" is evaluated and its value is returned as
the value of the break. For example, one might RETURN
(REVERSE BREAKVALUE).
FROM form This permits the user to release the break and return
to a previous context with "form" to be evaluated.
For details, see the subsection "Context Commands."
USE expr For use either with UNDEFINED ATOM error or UNDEFINED
FUNCTION error. USE replaces the expression (using
RPLACA, the change is permanent) containing the error
with expr (not the value of "expr") e.g.,
LISP Debugging Facilities 103
Previous Page Next Page