% -*-LaTeX-*-
% <BEEBE.EPSILON>TECODBG.LTX.10,  3-Jun-86 10:22:53, Edit by BEEBE
% This is part of TECO.LTX

The \TECO{} debugger is run by the command \EC{step-minibuffer},
normally bound to \T{C-X} \A{ESC}.  It just invokes the function
\EF{teco\_interpreter} with the debug step flag set.  In this
mode, the interpreter calls the function \EF{teco\_debugger}
before executing each command when the \X{single step flag} is
set, and turns on the \X{trace flag} whenever the quiet count is
non-positive.

The debugger waits for input of a single character which is
interpreted before returning.  If the character is a ``?'', it
displays a help message showing the available commands:
\begin{verbatim}
HELP or H or ?: help
CTL-L:          refresh window
CTL-R:          recursive edit of minibuffer
G:              go without single stepping
N:              step silently until newline
Q:              quit
V:              view Q-register
nnn:            step next nnn functions silently
other:          continue single stepping
\end{verbatim}

The \T{G} response turns off all debug tracing, and allows the
program to be executed to completion, as if it had been invoked by
\EC{execute-minibuffer} in the first place.

The \T{N} response suppresses tracing for the rest of the current
line in the program.  When a newline is reached by the interpreter,
tracing is restored.

The \T{Q} response terminates the interpreter completely, returning
control to the top-level \EPSILON{} command loop.  The \EC{abort}
function on \T{C-G} will do the same thing.

A decimal digit string defines a quiet count which is
decremented each time a \TECO{} function is invoked; while the
count is positive, debug tracing is suppressed.

The \CTL{R} response enters a \X{recursive edit} on the minibuffer.
It does this simply by invoking the function \EC{minibuffer}.
Since this is a normal \EPSILON{} editing mode, other buffers
can be visited too, but \EC{exit-level} should be run from the
minibuffer.  When exit occurs, control returns to the debugger,
which then runs \EC{save-minibuffer}, which in turn copies the
possibly-changed minibuffer contents back into the interpreter
string, and control returns to the interpreter, which resumes
execution wherever you left \POINT{} when the minibuffer exit
occurred.  This allows changes made to the minibuffer to take
immediate effect, giving a run-time patch capability.

The \X{patching} has one flaw which you need to be aware of---if
execution resumes in the middle of a loop, and the position of
the loop beginning, \T{<}, has changed because of edits, then
when the loop-end function, \T{>}, is run, it will jump back to
the saved position of the \T{<}, which might no longer be there.
The execution thread will then no longer be what you think it
is.  To try to catch this error, \T{>} checks the interpreter
string and aborts if it does not find the expected \T{<}.
