* module/system/repl/error-handling.scm (call-with-error-handling):
Do _not_ enter the debugger if the thrown key is in `pass-keys'.
Previously, for example, (throw 'quit) entered the debugger when run
from the REPL, despite the fact that 'quit is in `pass-keys'.
* module/system/repl/command.scm:
* module/system/repl/debug.scm (terminal-width): Move terminal-width
here, make it thread-local, and export it.
(print-locals, print-frame, print-frames): Default width to
terminal-width.
* module/system/repl/error-handling.scm (call-with-error-handling): Add
`report' and `backtrace' on-error handlers.
* module/system/repl/common.scm (repl-default-options): Add on-error
REPL option, defaulting to `debug', but which may be changed.
* module/system/repl/repl.scm (run-repl): Pass the #:on-error REPL
option to call-with-error-handling.
* module/system/repl/error-handling.scm (error-string): Just use
print-exception instead of rolling our own printer.
(call-with-error-handling): Simplify.
* module/system/repl/error-handling.scm (display-syntax-error)
(error-string): Until we get the exception-printing patch merged in,
copy display-syntax-error into error-handling so that we avoid
display-error. Fixes bug 32365.
* module/system/repl/debug.scm (<debug>): New field, `for-trap?'. True
if the stack is for a trap, and thus the top frame should use
frame-next-source instead of frame-source.
* module/system/repl/command.scm (repl-pop-continuation-resumer)
(repl-next-resumer):
* module/system/repl/error-handling.scm (call-with-error-handling):
Update callers.
* module/system/repl/error-handling.scm (error-string): Refactor a
little.
(call-with-error-handling): Ensure a trailing newline when printing
the error-msg.
* module/system/repl/repl.scm (run-repl): We don't know the name of the
meta-command here.
* module/system/repl/error-handling.scm (error-string): Don't call
`display-error' when STACK is empty.
(call-with-error-handling): Display ERROR-MSG instead of using
`format', since ERROR-MSG may contain `format' escapes.
* module/system/repl/repl.scm (run-repl): Add missing argument to
`format'.
* module/system/repl/error-handling.scm (call-with-error-handling): If
the given index is false, assume this was an ephemeral trap, and don't
print a welcome message or reference the trap by index.
* module/system/vm/trap-state.scm (with-default-trap-handler): Don't
enable traps if we are setting a handler of #f.
* module/system/repl/error-handling.scm (call-with-error-handling): Add
#:trap-handler arg.
* module/system/repl/repl.scm (run-repl): Only have traps enabled while
running the thunk. Otherwise we trace on procedures called as part of
the repl.
* module/system/vm/trap-state.scm: New file, tracks a VM-specific set of
traps.
* module/Makefile.am: Add trap-state.scm.
* module/system/repl/error-handling.scm: While in a with-error-handling
block, bind a default trap handler that invokes a recursive prompt.
* module/system/repl/command.scm: Add a `break' repl meta-command.
* module/system/repl/error-handling.scm: use the error string to
construct the <debug> instance.
* module/system/repl/command.scm: new debug command `error-message'
that extracts the new <debug> field, available to stack commands as
`message'.
* doc/ref/scheme-using.texi: documentation for new command.
* module/system/repl/debug.scm: <debug> stores the error string in a
new field.
* module/system/repl/error-handling.scm (call-with-error-handling):
Previous post-error changed to "report"; now "catch", the default,
doesn't re-print the error.
* module/system/repl/repl.scm (run-repl): Run the thunk in a stack in a
prompt, similar to the default prompt. Gives proper backtraces.
* module/system/repl/error-handling.scm (call-with-error-handling):
Narrow one more outer frame, for the %start-stack thunk invocation.
* module/ice-9/boot-9.scm (%start-stack): Reindent.
* module/system/repl/debug.scm: New file, defines a data type to hold
state for a debugger stack, and some helper procedures to print the
stack or print a frame. Most pieces are from (system vm debug).
* module/system/repl/error-handling.scm: New file, implements
call-with-error-handling and with-error-handling, and instead of going
into a debugger, we go into a recursive repl that happens to have
debugging information. Will be removing the old debugger from (system
vm debug) shortly.
* module/Makefile.am (SYSTEM_SOURCES): Add error-handling and debug scm
files.
* module/system/repl/repl.scm (prompting-meta-read): Better error
handling -- we don't want to go into a debugger when reading a
command.
(start-repl): Add #:debug keyword argument, and just dispatch to
run-repl.
(run-repl): New function, with the guts of the old start-repl. Added a
prompt, to which a throw to 'quit will abort.
* module/system/repl/common.scm (repl-prepare-eval-thunk): New
helper. In the future we will use this to not enter the debugger on
errors that happen at compile time.
(repl-eval): Use repl-prepare-eval-thunk.
(repl-print): Run the before-print-hook when printing a value.
* module/system/repl/command.scm (*command-table*): Move `option' to the
`system' group. Move `trace' to the `profile' group. Add `debug' and
`inspect' groups.
(command-abbrevs): Rename from command-abbrev, and allow multiple
abbreviations.
(display-group): Fix the case where abbrev? was #f.
(display-summary): Fix alignment of the command and
abbreviations. Allow multiple abbreviations.
(read-command): Rename from read-datum, and have better error
handling.
(meta-command): Better error handling.
(define-meta-command): Better error handling.
(help, show, import, compile, disassemble, time, profile, trace): Fix
docstrings and error messages.
(define-stack-command): New helper, for commands that operate on a
saved stack.
(backtrace, up, down, frame, procedure, locals): New debugger
commands, in the REPL now.
(inspect, pretty-print): New "inspect" commands.