guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-11-200-g2


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-11-200-g2e67eb6
Date: Fri, 16 Jul 2010 15:33:14 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=2e67eb6f2d76e36350793a6f6e79d773f559f19c

The branch, master has been updated
       via  2e67eb6f2d76e36350793a6f6e79d773f559f19c (commit)
       via  ca9300a255f8e3d8053201f05414756e5b1890ee (commit)
       via  cd8e32c5cd935107d42f956ba4bda8abc9267fba (commit)
       via  21476d8472ce2ecf5ee8836603239456651f8591 (commit)
       via  04ca20430bba139a5946711c5f94e99cdb44564e (commit)
       via  3c0b7725ef769ce9d7d485ee90aa53520bbe99e6 (commit)
       via  019fdc97d9214e162a274c13011b823673f75a8b (commit)
       via  720a91c131d0f4bb5300a865130ca9a1c2afde2c (commit)
      from  e50d921bd87e53df33c04831ecf8b3d100af2b7b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2e67eb6f2d76e36350793a6f6e79d773f559f19c
Author: Andy Wingo <address@hidden>
Date:   Fri Jul 16 13:19:33 2010 +0200

    remove (system vm debug)
    
    * module/system/vm/debug.scm: Remove.
    * module/Makefile.am: Update.
    
    * module/system/repl/debug.scm: Add some TODOs and a commented-out
      function here.

commit ca9300a255f8e3d8053201f05414756e5b1890ee
Author: Andy Wingo <address@hidden>
Date:   Fri Jul 16 13:14:23 2010 +0200

    remove (ice-9 emacs)
    
    * module/ice-9/emacs.scm: Remove.
    * module/ice-9/deprecated.scm (load-emacs-interface): Remove wrapper
      with no callers.
    * module/Makefile.am: update.

commit cd8e32c5cd935107d42f956ba4bda8abc9267fba
Author: Andy Wingo <address@hidden>
Date:   Fri Jul 16 13:10:54 2010 +0200

    gut ice-9 debug
    
    * module/ice-9/debug.scm: Gut, though we keep the module around for code
      Out There that uses it.
    
    * module/ice-9/top-repl.scm (top-repl): Don't import (ice-9 debug)
    
    * module/ice-9/debugger/commands.scm:
    * module/ice-9/debugging/trace.scm:
    * module/ice-9/emacs.scm: Remove ice-9 debug includes.

commit 21476d8472ce2ecf5ee8836603239456651f8591
Author: Andy Wingo <address@hidden>
Date:   Fri Jul 16 12:44:44 2010 +0200

    update tour.texi examples
    
    * doc/ref/tour.texi (Running Guile Interactively): Update examples for
      formatting.

commit 04ca20430bba139a5946711c5f94e99cdb44564e
Author: Andy Wingo <address@hidden>
Date:   Fri Jul 16 12:41:04 2010 +0200

    tour.texi updates
    
    * doc/ref/tour.texi: Update Guile prompts for
      scheme@(guile-user)>. Update output to assume value-history is on. Lop
      and crop the bug reporting section -- it was too long.

commit 3c0b7725ef769ce9d7d485ee90aa53520bbe99e6
Author: Andy Wingo <address@hidden>
Date:   Fri Jul 16 11:54:19 2010 +0200

    update debugger docs
    
    * doc/ref/api-debug.texi (Debug on Error): Update xref.
    * doc/ref/scheme-using.texi (REPL Commands): New subsection.
      (Interactive Debugging): Rename from Interactive Debugger, to indicate
      that debugging is just part of the REPL. Update docs.

commit 019fdc97d9214e162a274c13011b823673f75a8b
Author: Andy Wingo <address@hidden>
Date:   Fri Jul 16 11:50:59 2010 +0200

    updates to system repl command
    
    * module/system/repl/command.scm (help): Update docs on how to get help
      on a particular command.
      (load): Remove #:f flag.

commit 720a91c131d0f4bb5300a865130ca9a1c2afde2c
Author: Andy Wingo <address@hidden>
Date:   Fri Jul 16 11:50:51 2010 +0200

    lower fill-column in .dir-locals.el
    
    * .dir-locals.el: Fill-columns back down to 72.

-----------------------------------------------------------------------

Summary of changes:
 .dir-locals.el                     |    5 +-
 doc/ref/api-debug.texi             |    2 +-
 doc/ref/scheme-using.texi          |  573 +++++++++++++++++++++++-------------
 doc/ref/tour.texi                  |  210 +++++---------
 module/Makefile.am                 |    2 -
 module/ice-9/debug.scm             |  116 +-------
 module/ice-9/debugger/commands.scm |    1 -
 module/ice-9/debugging/trace.scm   |    3 +-
 module/ice-9/deprecated.scm        |    9 -
 module/ice-9/emacs.scm             |  278 -----------------
 module/ice-9/top-repl.scm          |    5 +-
 module/system/repl/command.scm     |   14 +-
 module/system/repl/debug.scm       |   34 ++-
 module/system/vm/debug.scm         |  522 --------------------------------
 14 files changed, 493 insertions(+), 1281 deletions(-)
 delete mode 100644 module/ice-9/emacs.scm
 delete mode 100644 module/system/vm/debug.scm

diff --git a/.dir-locals.el b/.dir-locals.el
index ca0c337..e651538 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,8 +1,9 @@
 ;; Per-directory local variables for GNU Emacs 23 and later.
 
-((nil             . ((fill-column . 80)
+((nil             . ((fill-column . 72)
                      (tab-width   .  8)))
  (c-mode          . ((c-file-style . "gnu")))
  (scheme-mode     . ((indent-tabs-mode . nil)))
  (emacs-lisp-mode . ((indent-tabs-mode . nil)))
- (texinfo-mode    . ((indent-tabs-mode . nil))))
+ (texinfo-mode    . ((indent-tabs-mode . nil)
+                     (fill-column . 72))))
diff --git a/doc/ref/api-debug.texi b/doc/ref/api-debug.texi
index 0aa1bb6..c1730a1 100644
--- a/doc/ref/api-debug.texi
+++ b/doc/ref/api-debug.texi
@@ -504,7 +504,7 @@ highlighted wherever they appear in the backtrace.
 
 You can also use the @code{(debug)} command to explore the saved stack
 using an interactive command-line-driven debugger.  See @ref{Interactive
-Debugger} for more information about this.
+Debugging} for more information about this.
 
 @deffn {Scheme Procedure} debug
 Invoke the Guile debugger to explore the context of the last error.
diff --git a/doc/ref/scheme-using.texi b/doc/ref/scheme-using.texi
index 98fee16..cf4e230 100644
--- a/doc/ref/scheme-using.texi
+++ b/doc/ref/scheme-using.texi
@@ -35,10 +35,11 @@ current language is @code{scheme}, and the current module is
 support for languages other than Scheme.
 
 @menu
-* Readline::
-* Value Historyx::
-* Error Handling::
-* Interactive Debugger::        Using the interactive debugger.
+* Readline::                    
+* Value Historyx::              
+* REPL Commands::               
+* Error Handling::              
+* Interactive Debugging::       
 @end menu
 
 
@@ -125,276 +126,438 @@ data structure or closure, they may then be reclaimed 
by the garbage collector.
 @end deffn
 
 
address@hidden Error Handling
address@hidden Error Handling
address@hidden REPL Commands
address@hidden REPL Commands
 
-When code being evaluated from the REPL hits an error, Guile remembers
-the execution context where the error occurred and can give you three
-levels of information about what the error was and exactly where it
-occurred.
address@hidden commands
+The REPL exists to read expressions, evaluate them, and then print their
+results. But sometimes one wants to tell the REPL to evaluate an
+expression in a different way, or to do something else altogether. A
+user can affect the way the REPL works with a @dfn{REPL command}.
 
-By default, Guile displays only the first level, which is the most
-immediate information about where and why the error occurred, for
-example:
+The previous section had an example of a command, in the form of
address@hidden,option}.
 
 @lisp
-(make-string (* 4 (+ 3 #\s)) #\space)
address@hidden
-standard input:2:19: In procedure + in expression (+ 3 #\s):
-standard input:2:19: Wrong type argument: #\s
-ABORT: (wrong-type-arg)
-
-Type "(backtrace)" to get more information
-or "(debug)" to enter the debugger.
+scheme@@(guile-user)> ,option value-history #t
 @end lisp
 
 @noindent
-However, as the message above says, you can obtain more information
-about the context of the error by typing @code{(backtrace)} or
address@hidden(debug)}.
+Commands are distinguished from expressions by their initial comma
+(@samp{,}). Since a comma cannot begin an expression in most languages,
+it is an effective indicator to the REPL that the following text forms a
+command, not an expression.
 
address@hidden(backtrace)} displays the Scheme call stack at the point where the
-error occurred:
+REPL commands are convenient because they are always there. Even if the
+current module doesn't have a binding for @code{pretty-print}, one can
+always @code{,pretty-print}.
 
address@hidden
-(backtrace)
address@hidden
-Backtrace:
-In standard input:
-   2: 0* [make-string ...
-   2: 1*  [* 4 ...
-   2: 2*   [+ 3 #\s]
-
-Type "(debug-enable 'backtrace)" if you would like a backtrace
-automatically if an error occurs in the future.
address@hidden lisp
+The following sections document the various commands, grouped together
+by functionality. Many of the commands have abbreviations; see the
+online help (@code{,help}) for more information.
 
address@hidden
-In a more complex scenario than this one, this can be extremely useful
-for understanding where and why the error occurred.  You can make Guile
-show the backtrace automatically by adding @code{(debug-enable
-'backtrace)} to your @file{.guile}.
address@hidden
+* Help Commands::               
+* Module Commands::             
+* Language Commands::           
+* Compile Commands::            
+* Profile Commands::            
+* Debug Commands::              
+* Inspect Commands::            
+* System Commands::             
address@hidden menu
 
address@hidden(debug)} takes you into Guile's interactive debugger, which
-provides commands that allow you to
address@hidden Help Commands
address@hidden Help Commands
 
address@hidden @bullet
address@hidden
-display the Scheme call stack at the point where the error occurred
-(the @code{backtrace} command --- see @ref{Display Backtrace})
+When Guile starts interactively, it notifies the user that help can be
+had by typing @samp{,help}. Indeed, @code{help} is a command, and a
+particularly useful one, as it allows the user to discover the rest of
+the commands.
 
address@hidden
-move up and down the call stack, to see in detail the expression being
-evaluated, or the procedure being applied, in each @dfn{frame} (the
address@hidden, @code{down}, @code{frame}, @code{position}, @code{info args}
-and @code{info frame} commands --- see @ref{Frame Selection} and
address@hidden Information})
address@hidden {REPL Command} help address@hidden | group | @samp{[-c]} command]
+Show help.
 
address@hidden
-examine the values of variables and expressions in the context of each
-frame (the @code{evaluate} command --- see @ref{Frame Evaluation}).
address@hidden itemize
+With one argument, tries to look up the argument as a group name, giving
+help on that group if successful. Otherwise tries to look up the
+argument as a command, giving help on the command.
 
address@hidden
-The interactive debugger is documented further in the following section.
+If there is a command whose name is also a group name, use the @samp{-c
address@hidden form to give help on the command instead of the group.
 
+Without any argument, a list of help commands and command groups
+are displayed.
address@hidden deffn
 
address@hidden Interactive Debugger
address@hidden Using the Interactive Debugger
address@hidden {REPL Command} show [topic]
+Gives information about Guile.
 
-Guile's interactive debugger is a command line application that
-accepts commands from you for examining the stack and, if stopped at a
-trap, for continuing program execution in various ways.  Unlike in the
-normal Guile REPL, commands are typed mostly without parentheses.
+With one argument, tries to show a particular piece of information;
+currently supported topics are `warranty' (or `w'), `copying' (or `c'),
+and `version' (or `v').
 
-When you first enter the debugger, it introduces itself with a message
-like this:
+Without any argument, a list of topics is displayed.
address@hidden deffn
 
address@hidden
-This is the Guile debugger -- for help, type `help'.
-There are 3 frames on the stack.
address@hidden {REPL Command} apropos regexp
+Find bindings/modules/packages.
address@hidden deffn
 
-Frame 2 at standard input:36:19
-        [+ 3 #\s]
-debug> 
address@hidden lisp
address@hidden {REPL Command} describe obj
+Show description/documentation.
address@hidden deffn
 
address@hidden
-``debug>'' is the debugger's prompt, and a reminder that you are not in
-the normal Guile REPL.  In case you find yourself in the debugger by
-mistake, the @code{quit} command will return you to the REPL.  
address@hidden Module Commands
address@hidden Module Commands
 
address@hidden {Debugger Command} quit
-Exit the debugger.
address@hidden {REPL Command} module [module]
+Change modules / Show current module.
 @end deffn
 
-The other available commands are described in the following subsections.
-
address@hidden
-* Display Backtrace::           backtrace.
-* Frame Selection::             up, down, frame.
-* Frame Information::           info args, info frame, position.
-* Frame Evaluation::            evaluate.
-* Stepping and Continuing::     step, next, (trace-)finish, continue.
address@hidden menu
address@hidden {REPL Command} import [module ...]
+Import modules / List those imported.
address@hidden deffn
 
address@hidden {REPL Command} load file
+Load a file in the current module.
address@hidden deffn
 
address@hidden Display Backtrace
address@hidden Display Backtrace
address@hidden {REPL Command} binding
+List current bindings.
address@hidden deffn
 
-The @code{backtrace} command, which can also be invoked as @code{bt} or
address@hidden, displays the call stack (aka backtrace) at the point where
-the debugger was entered:
address@hidden Language Commands
address@hidden Language Commands
 
address@hidden
-debug> bt
-In standard input:
-  36: 0* [make-string ...
-  36: 1*  [* 4 ...
-  36: 2*   [+ 3 #\s]
address@hidden lisp
-
address@hidden {Debugger Command} backtrace [count]
address@hidden {Debugger Command} bt [count]
address@hidden {Debugger Command} where [count]
-Print backtrace of all stack frames, or of the innermost @var{count}
-frames.  With a negative argument, print the outermost address@hidden
-frames.  If the number of frames isn't explicitly given, the debug
-option @code{depth} determines the maximum number of frames printed.
address@hidden {REPL Command} language language
+Change languages.
 @end deffn
 
-The format of the displayed backtrace is the same as for the
address@hidden procedure (@pxref{Examining the Stack}).
address@hidden Compile Commands
address@hidden Compile Commands
 
address@hidden {REPL Command} compile exp
+Generate compiled code.
address@hidden deffn
 
address@hidden Frame Selection
address@hidden Frame Selection
address@hidden {REPL Command} compile-file file
+Compile a file.
address@hidden deffn
 
-A call stack consists of a sequence of stack @dfn{frames}, with each
-frame describing one level of the nested evaluations and applications
-that the program was executing when it hit a breakpoint or an error.
-Frames are numbered such that frame 0 is the outermost --- i.e. the
-operation on the call stack that began least recently --- and frame N-1
-the innermost (where N is the total number of frames on the stack).
address@hidden {REPL Command} disassemble exp
+Disassemble a compiled procedure.
address@hidden deffn
 
-When you enter the debugger, the innermost frame is selected, which
-means that the commands for getting information about the ``current''
-frame, or for evaluating expressions in the context of the current
-frame, will do so by default with respect to the innermost frame.  To
-select a different frame, so that these operations will apply to it
-instead, use the @code{up}, @code{down} and @code{frame} commands like
-this:
address@hidden {REPL Command} disassemble-file file
+Disassemble a file.
address@hidden deffn
 
address@hidden
-debug> up
-Frame 1 at standard input:36:14
-        [* 4 ...
-debug> frame 0
-Frame 0 at standard input:36:1
-        [make-string ...
-debug> down
-Frame 1 at standard input:36:14
-        [* 4 ...
address@hidden lisp
address@hidden Profile Commands
address@hidden Profile Commands
 
address@hidden {Debugger Command} up [n]
-Move @var{n} frames up the stack.  For positive @var{n}, this
-advances toward the outermost frame, to lower frame numbers, to
-frames that have existed longer.  @var{n} defaults to one.
address@hidden {REPL Command} time exp
+Time execution.
 @end deffn
 
address@hidden {Debugger Command} down [n]
-Move @var{n} frames down the stack.  For positive @var{n}, this
-advances toward the innermost frame, to higher frame numbers, to frames
-that were created more recently.  @var{n} defaults to one.
address@hidden {REPL Command} profile exp
+Profile execution.
 @end deffn
 
address@hidden {Debugger Command} frame [n]
-Select and print a stack frame.  With no argument, print the selected
-stack frame.  (See also ``info frame''.)  An argument specifies the
-frame to select; it must be a stack-frame number.
address@hidden {REPL Command} trace exp
+Trace execution.
 @end deffn
 
address@hidden Debug Commands
address@hidden Debug Commands
 
address@hidden Frame Information
address@hidden Frame Information
+These debugging commands are only available within a recursive REPL;
+they do not work at the top level.
 
-The following commands return detailed information about the currently
-selected frame.
address@hidden {REPL Command} backtrace [count] [#:width w] [#:full? f]
+Print a backtrace.
 
address@hidden {Debugger Command} {info frame}
-Display a verbose description of the selected frame.  The information
-that this command provides is equivalent to what can be deduced from the
-one line summary for the frame that appears in a backtrace, but is
-presented and explained more clearly.
+Print a backtrace of all stack frames, or innermost @var{COUNT} frames.
+If @var{count} is negative, the last @var{count} frames will be shown.
 @end deffn
 
address@hidden {Debugger Command} {info args}
-Display the argument variables of the current stack frame.  Arguments
-can also be seen in the backtrace, but are presented more clearly by
-this command.
address@hidden {REPL Command} up [count]
+Select a calling stack frame.
+
+Select and print stack frames that called this one.
+An argument says how many frames up to go.
 @end deffn
 
address@hidden {Debugger Command} position
-Display the name of the source file that the current expression comes
-from, and the line and column number of the expression's opening
-parenthesis within that file.  This information is only available when
-the @code{positions} read option is enabled (@pxref{Reader options}).
address@hidden {REPL Command} down [count]
+Select a called stack frame.
+
+Select and print stack frames called by this one.
+An argument says how many frames down to go.
 @end deffn
 
address@hidden {REPL Command} frame [idx]
+Show a frame.
+
+Show the selected frame.  With an argument, select a frame by index,
+then show it.
address@hidden deffn
 
address@hidden Frame Evaluation
address@hidden Frame Evaluation
address@hidden {REPL Command} procedure
+Print the procedure for the selected frame.
address@hidden deffn
 
-The @code{evaluate} command is most useful for querying the value of a
-variable, either global or local, in the environment of the selected
-stack frame, but it can be used more generally to evaluate any
-expression.
address@hidden {REPL Command} locals
+Show local variables.
 
address@hidden {Debugger Command} evaluate expression
-Evaluate an expression in the environment of the selected stack frame.
-The expression must appear on the same line as the command, however it
-may be continued over multiple lines.
+Show locally-bound variables in the selected frame.
 @end deffn
 
address@hidden FIXME: whenever we regain support for stepping, here are the 
docs..
+
address@hidden The commands in this subsection all apply only when the stack is
address@hidden @dfn{continuable} --- in other words when it makes sense for the 
program
address@hidden that the stack comes from to continue running.  Usually this 
means that
address@hidden the program stopped because of a trap or a breakpoint.
+
address@hidden @deffn {Debugger Command} step [n]
address@hidden Tell the debugged program to do @var{n} more steps from its 
current
address@hidden position.  One @dfn{step} means executing until the next frame 
entry or
address@hidden exit of any kind.  @var{n} defaults to 1.
address@hidden @end deffn
+
address@hidden @deffn {Debugger Command} next [n]
address@hidden Tell the debugged program to do @var{n} more steps from its 
current
address@hidden position, but only counting frame entries and exits where the
address@hidden corresponding source code comes from the same file as the 
current stack
address@hidden frame.  (See @ref{Step Traps} for the details of how this 
works.)  If
address@hidden the current stack frame has no source code, the effect of this 
command
address@hidden is the same as of @code{step}.  @var{n} defaults to 1.
address@hidden @end deffn
+
address@hidden @deffn {Debugger Command} finish
address@hidden Tell the program being debugged to continue running until the 
completion
address@hidden of the current stack frame, and at that time to print the result 
and
address@hidden reenter the command line debugger.
address@hidden @end deffn
+
address@hidden @deffn {Debugger Command} continue
address@hidden Tell the program being debugged to continue running.  (In fact 
this is
address@hidden the same as the @code{quit} command, because it exits the 
debugger
address@hidden command loop and so allows whatever code it was that invoked the
address@hidden debugger to continue.)
address@hidden @end deffn
+
address@hidden The @code{evaluate} command is most useful for querying the 
value of a
address@hidden variable, either global or local, in the environment of the 
selected
address@hidden stack frame, but it can be used more generally to evaluate any
address@hidden expression.
+
address@hidden @deffn {Debugger Command} evaluate expression
address@hidden Evaluate an expression in the environment of the selected stack 
frame.
address@hidden The expression must appear on the same line as the command, 
however it
address@hidden may be continued over multiple lines.
address@hidden @end deffn
+
address@hidden Inspect Commands
address@hidden Inspect Commands
+
address@hidden {REPL Command} inspect EXP
+Inspect the result(s) of evaluating @var{exp}.
address@hidden deffn
 
address@hidden Stepping and Continuing
address@hidden Single Stepping and Continuing Execution
address@hidden {REPL Command} pretty-print EXP
+Pretty-print the result(s) of evaluating @var{exp}.
address@hidden deffn
 
-The commands in this subsection all apply only when the stack is
address@hidden --- in other words when it makes sense for the program
-that the stack comes from to continue running.  Usually this means that
-the program stopped because of a trap or a breakpoint.
address@hidden System Commands
address@hidden System Commands
 
address@hidden {Debugger Command} step [n]
-Tell the debugged program to do @var{n} more steps from its current
-position.  One @dfn{step} means executing until the next frame entry or
-exit of any kind.  @var{n} defaults to 1.
address@hidden {REPL Command} gc
+Garbage collection.
 @end deffn
 
address@hidden {Debugger Command} next [n]
-Tell the debugged program to do @var{n} more steps from its current
-position, but only counting frame entries and exits where the
-corresponding source code comes from the same file as the current stack
-frame.  (See @ref{Step Traps} for the details of how this works.)  If
-the current stack frame has no source code, the effect of this command
-is the same as of @code{step}.  @var{n} defaults to 1.
address@hidden {REPL Command} statistics
+Display statistics.
 @end deffn
 
address@hidden {Debugger Command} finish
-Tell the program being debugged to continue running until the completion
-of the current stack frame, and at that time to print the result and
-reenter the command line debugger.
address@hidden {REPL Command} option [key value]
+List/show/set options.
 @end deffn
 
address@hidden {Debugger Command} continue
-Tell the program being debugged to continue running.  (In fact this is
-the same as the @code{quit} command, because it exits the debugger
-command loop and so allows whatever code it was that invoked the
-debugger to continue.)
address@hidden {REPL Command} quit
+Quit this session.
 @end deffn
 
 
address@hidden Error Handling
address@hidden Error Handling
+
+When code being evaluated from the REPL hits an error, Guile enters a
+new prompt, allowing you to inspect the context of the error.
+
address@hidden
+scheme@@(guile-user)> (map string-append '("a" "b") '("c" #\d))
+ERROR: In procedure string-append:
+ERROR: Wrong type (expecting string): #\d
+Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
+scheme@@(guile-user) [1]>
address@hidden lisp
+
+The new prompt runs inside the old one, in the dynamic context of the
+error.  It is a recursive REPL, augmented with a reified representation
+of the stack, ready for debugging.
+
address@hidden,backtrace} (abbreviated @code{,bt}) displays the Scheme call
+stack at the point where the error occurred:
+
address@hidden
+scheme@@(guile-user) [1]> ,bt
+           1 (map #<procedure string-append _> ("a" "b") ("c" #\d))
+           0 (string-append "b" #\d)
address@hidden lisp
+
+In the above example, the backtrace doesn't have much source
+information, as @code{map} and @code{string-append} are both
+primitives. But in the general case, the space on the left of the
+backtrace indicates the line and column in which a given procedure calls
+another.
+
+You can exit a recursive REPL in the same way that you exit any REPL:
+via @samp{(quit)}, @samp{,quit} (abbreviated @samp{,q}), or
address@hidden, among other options.
+
+
address@hidden Interactive Debugging
address@hidden Interactive Debugging
+
+A recursive debugging REPL exposes a number of other meta-commands that
+inspect the state of the computation at the time of the error. These
+commands allow you to
+
address@hidden @bullet
address@hidden
+display the Scheme call stack at the point where the error occurred;
+
address@hidden
+move up and down the call stack, to see in detail the expression being
+evaluated, or the procedure being applied, in each @dfn{frame}; and
+
address@hidden
+examine the values of variables and expressions in the context of each
+frame.
address@hidden itemize
+
address@hidden
address@hidden Commands}, for documentation of the individual
+commands. This section aims to give more of a walkthrough of a typical
+debugging session.
+
+First, we're going to need a good error. Let's try to macroexpand the
+expression @code{(unquote foo)}, outside of a @code{quasiquote} form,
+and see how the macroexpander reports this error.
+
address@hidden
+scheme@@(guile-user)> (macroexpand '(unquote foo))
+ERROR: In procedure macroexpand:
+ERROR: unquote: expression not valid outside of quasiquote in (unquote foo)
+Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
+scheme@@(guile-user) [1]>
address@hidden lisp
+
+The @code{backtrace} command, which can also be invoked as @code{bt},
+displays the call stack (aka backtrace) at the point where the debugger
+was entered:
+
address@hidden
+scheme@@(guile-user) [1]> ,bt
+In ice-9/psyntax.scm:
+  1130:21  3 (chi-top (unquote foo) () ((top)) e (eval) (hygiene #))
+  1071:30  2 (syntax-type (unquote foo) () ((top)) #f #f (# #) #f)
+  1368:28  1 (chi-macro #<procedure de9360 at ice-9/psyntax.scm...> ...)
+In unknown file:
+           0 (scm-error syntax-error macroexpand "~a: ~a in ~a" # #f)
address@hidden lisp
+
+A call stack consists of a sequence of stack @dfn{frames}, with each
+frame describing one procedure which is waiting to do something with the
+values returned by another. Here we see that there are four frames on
+the stack.
+
+Note that @code{macroexpand} is not on the stack -- it must have made a
+tail call to @code{chi-top}, as indeed we would find if we searched
address@hidden/psyntax.scm} for its definition.
+
+When you enter the debugger, the innermost frame is selected, which
+means that the commands for getting information about the ``current''
+frame, or for evaluating expressions in the context of the current
+frame, will do so by default with respect to the innermost frame.  To
+select a different frame, so that these operations will apply to it
+instead, use the @code{up}, @code{down} and @code{frame} commands like
+this:
+
address@hidden
+scheme@@(guile-user) [1]> ,up
+In ice-9/psyntax.scm:
+  1368:28  1 (chi-macro #<procedure de9360 at ice-9/psyntax.scm...> ...)
+scheme@@(guile-user) [1]> ,frame 3
+In ice-9/psyntax.scm:
+  1130:21  3 (chi-top (unquote foo) () ((top)) e (eval) (hygiene #))
+scheme@@(guile-user) [1]> ,down
+In ice-9/psyntax.scm:
+  1071:30  2 (syntax-type (unquote foo) () ((top)) #f #f (# #) #f)
address@hidden lisp
+
+Perhaps we're interested in what's going on in frame 2, so we take a
+look at its local variables:
+
address@hidden
+scheme@@(guile-user) [1]> ,locals
+  Local variables:
+  $1 = e = (unquote foo)
+  $2 = r = ()
+  $3 = w = ((top))
+  $4 = s = #f
+  $5 = rib = #f
+  $6 = mod = (hygiene guile-user)
+  $7 = for-car? = #f
+  $8 = first = unquote
+  $9 = ftype = macro
+  $10 = fval = #<procedure de9360 at ice-9/psyntax.scm:2817:2 (x)>
+  $11 = fe = unquote
+  $12 = fw = ((top))
+  $13 = fs = #f
+  $14 = fmod = (hygiene guile-user)
address@hidden lisp
+
+All of the values are accessible by their value-history names
+(@address@hidden):
+
address@hidden
+scheme@@(guile-user) [1]> $10
+$15 = #<procedure de9360 at ice-9/psyntax.scm:2817:2 (x)>
address@hidden lisp
+
+We can even invoke the procedure at the REPL directly:
+
address@hidden
+scheme@@(guile-user) [1]> ($10 'not-going-to-work)
+ERROR: In procedure macroexpand:
+ERROR: source expression failed to match any pattern in not-going-to-work
+Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
address@hidden lisp
+
+Well at this point we've caused an error within an error. Let's just
+quit back to the top level:
+
address@hidden
+scheme@@(guile-user) [2]> ,q
+scheme@@(guile-user) [1]> ,q
+scheme@@(guile-user)> 
address@hidden lisp
+
+Finally, as a word to the wise: hackers close their REPL prompts with
address@hidden
+
+
 @node Using Guile in Emacs
 @section Using Guile in Emacs
 
diff --git a/doc/ref/tour.texi b/doc/ref/tour.texi
index 3ccb4f2..0c8b7e4 100644
--- a/doc/ref/tour.texi
+++ b/doc/ref/tour.texi
@@ -34,20 +34,19 @@ In its simplest form, Guile acts as an interactive 
interpreter for the
 Scheme programming language, reading and evaluating Scheme expressions
 the user enters from the terminal.  Here is a sample interaction between
 Guile and a user; the user's input appears after the @code{$} and
address@hidden>} prompts:
address@hidden@@(guile-user)>} prompts:
 
 @example
 $ guile
-guile> (+ 1 2 3)                ; add some numbers
-6
-guile> (define (factorial n)    ; define a function
-         (if (zero? n) 1 (* n (factorial (- n 1)))))
-guile> (factorial 20)
-2432902008176640000
-guile> (getpwnam "jimb")        ; find my entry in /etc/passwd
-#("jimb" ".0krIpK2VqNbU" 4008 10 "Jim Blandy" "/u/jimb"
-  "/usr/local/bin/bash")
-guile> @kbd{C-d}
+scheme@@(guile-user)> (+ 1 2 3)                ; add some numbers
+$1 = 6
+scheme@@(guile-user)> (define (factorial n)    ; define a function
+                       (if (zero? n) 1 (* n (factorial (- n 1)))))
+scheme@@(guile-user)> (factorial 20)
+$2 = 2432902008176640000
+scheme@@(guile-user)> (getpwnam "root")        ; look in /etc/passwd
+$3 = #("root" "x" 0 0 "root" "/root" "/bin/bash")
+scheme@@(guile-user)> @kbd{C-d}
 $
 @end example
 
@@ -124,9 +123,9 @@ that you can also call the new @code{my-hostname} function.
 
 @example
 $ ./simple-guile
-guile> (+ 1 2 3)
-6
-guile> (my-hostname)
+scheme@@(guile-user)> (+ 1 2 3)
+$1 = 6
+scheme@@(guile-user)> (my-hostname)
 "burns"
 @end example
 
@@ -176,9 +175,9 @@ available:
 
 @smallexample
 $ guile
-guile> (load-extension "./libguile-bessel" "init_bessel")
-guile> (j0 2)
-0.223890779141236
+scheme@@(guile-user)> (load-extension "./libguile-bessel" "init_bessel")
+scheme@@(guile-user)> (j0 2)
+$1 = 0.223890779141236
 @end smallexample
 
 
@@ -217,13 +216,13 @@ rdelim)} module that provides the function 
@code{read-line}.
 
 @smallexample
 $ guile
-guile> (use-modules (ice-9 popen))
-guile> (use-modules (ice-9 rdelim))
-guile> (define p (open-input-pipe "ls -l"))
-guile> (read-line p)
-"total 30"
-guile> (read-line p)
-"drwxr-sr-x    2 mgrabmue mgrabmue     1024 Mar 29 19:57 CVS"
+scheme@@(guile-user)> (use-modules (ice-9 popen))
+scheme@@(guile-user)> (use-modules (ice-9 rdelim))
+scheme@@(guile-user)> (define p (open-input-pipe "ls -l"))
+scheme@@(guile-user)> (read-line p)
+$1 = "total 30"
+scheme@@(guile-user)> (read-line p)
+$2 = "drwxr-sr-x    2 mgrabmue mgrabmue     1024 Mar 29 19:57 CVS"
 @end smallexample
 
 @node Writing new Modules
@@ -246,9 +245,9 @@ $ cat /usr/local/share/guile/foo/bar.scm
 (define (frob x) (* 2 x))
 
 $ guile
-guile> (use-modules (foo bar))
-guile> (frob 12)
-24
+scheme@@(guile-user)> (use-modules (foo bar))
+scheme@@(guile-user)> (frob 12)
+$1 = 24
 @end smallexample
 
 @node Putting Extensions into Modules
@@ -271,9 +270,9 @@ $ cat /usr/local/share/guile/math/bessel.scm
 $ file /usr/local/lib/libguile-bessel.so
 @dots{} ELF 32-bit LSB shared object @dots{}
 $ guile
-guile> (use-modules (math bessel))
-guile> (j0 2)
-0.223890779141236
+scheme@@(guile-user)> (use-modules (math bessel))
+scheme@@(guile-user)> (j0 2)
+$1 = 0.223890779141236
 @end smallexample
 
 There is also a way to manipulate the module system from C but only
@@ -288,10 +287,10 @@ your modules in Scheme.
 Any problems with the installation should be reported to
 @email{bug-guile@@gnu.org}.
 
-Whenever you have found a bug in Guile you are encouraged to report it
-to the Guile developers, so they can fix it.  They may also be able to
-suggest workarounds when it is not possible for you to apply the bug-fix
-or install a new version of Guile yourself.
+If you find a bug in Guile, please report it to the Guile developers, so
+they can fix it.  They may also be able to suggest workarounds when it
+is not possible for you to apply the bug-fix or install a new version of
+Guile yourself.
 
 Before sending in bug reports, please check with the following list that
 you really have found a bug.
@@ -322,6 +321,15 @@ When some part of the documentation is not clear and does 
not make sense
 to you even after re-reading the section, it is a bug.
 @end itemize
 
+Before reporting the bug, check whether any programs you have loaded
+into Guile, including your @file{.guile} file, set any variables that
+may affect the functioning of Guile.  Also, see whether the problem
+happens in a freshly started Guile without loading your @file{.guile}
+file (start Guile with the @code{-q} switch to prevent loading the init
+file).  If the problem does @emph{not} occur then, you must report the
+precise contents of any programs that you must load into Guile in order
+to cause the problem to occur.
+
 When you write a bug report, please make sure to include as much of the
 information described below in the report.  If you can't figure out some
 of the items, it is not a problem, but the more information we get, the
@@ -329,125 +337,63 @@ more likely we can diagnose and fix the bug.
 
 @itemize @bullet
 @item
-The version number of Guile.  Without this, we won't know whether there
-is any point in looking for the bug in the current version of Guile.
-
-You can get the version number by invoking the command
-
address@hidden
-$ guile --version
-Guile 1.9.0
-Copyright (c) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004,
-2005, 2006, 2007, 2008, 2009 Free Software Foundation
-Guile may be distributed under the terms of the GNU Lesser General
-Public Licence.  For details, see the files `COPYING.LESSER' and
-`COPYING', which are included in the Guile distribution.  There is
-no warranty, to the extent permitted by law.
address@hidden example
+The version number of Guile. You can get this information from invoking
address@hidden --version} at your shell, or calling @code{(version)} from
+within Guile.
 
 @item
-The type of machine you are using, and the operating system name and
-version number.  On GNU systems, you can get it with @file{uname}.
+Your machine type, as determined by the @code{config.guess} shell
+script. If you have a Guile checkout, this file is located in
address@hidden; otherwise you can fetch the latest version from
address@hidden://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD}.
 
 @example
-$ uname -a
-Linux tortoise 2.2.17 #1 Thu Dec 21 17:29:05 CET 2000 i586 unknown
+$ build-aux/config.guess
+x86_64-unknown-linux-gnu
 @end example
 
 @item
-The operands given to the @file{configure} command when Guile was
-installed.  It's often useful to augment this with the output of the
-command @code{guile-config info}.
+If you installed Guile from a binary package, the version of that
+package. On systems that use RPM, use @code{rpm -qa | grep guile}. On systems
+that use DPKG, @code{dpkg -l | grep guile}. 
 
 @item
-A complete list of any modifications you have made to the Guile source.
-(We may not have time to investigate the bug unless it happens in an
-unmodified Guile.  But if you've made modifications and you don't tell
-us, you are sending us on a wild goose chase.)
-
-Be precise about these changes.  A description in English is not
-enough---send a context diff for them.
+If you built Guile yourself, the build configuration that you used:
 
-Adding files of your own, or porting to another machine, is a
-modification of the source.
-
address@hidden
-Details of any other deviations from the standard procedure for
-installing Guile.
address@hidden
+$ ./config.status --config
+'--enable-error-on-warning' '--disable-deprecated' '--prefix=/opt/guile' 
'--libdir=/opt/guile/lib64' 'CC=ccache gcc'
address@hidden example
 
 @item
-The complete text of any source files needed to reproduce the bug.
+A complete description of how to reproduce the bug.
 
-If you can tell us a way to cause the problem without loading any source
-files, please do so.  This makes it much easier to debug.  If you do
-need files, make sure you arrange for us to see their exact contents.
+If you have a Scheme program that produces the bug, please include it in
+the bug report. If your program is too big to include. please try to
+reduce your code to a minimal test case.
 
address@hidden
-The precise Guile invocation command line we need to type to reproduce
-the bug.
+If you can reproduce your problem at the REPL, that is best. Give a
+transcript of the expressions you typed at the REPL.
 
 @item
-A description of what behavior you observe that you believe is
-incorrect.  For example, "The Guile process gets a fatal signal," or,
-"The resulting output is as follows, which I think is wrong."
-
-Of course, if the bug is that Guile gets a fatal signal, then one can't
-miss it.  But if the bug is incorrect results, the maintainer might fail
-to notice what is wrong.  Why leave it to chance?
+A description of the incorrect behavior.  For example, "The Guile
+process gets a fatal signal," or, "The resulting output is as follows,
+which I think is wrong."
 
 If the manifestation of the bug is a Guile error message, it is
 important to report the precise text of the error message, and a
-backtrace showing how the Scheme program arrived at the error.
-
-This can be done using the @code{backtrace} command in Guile's debugger.
-
address@hidden
-Check whether any programs you have loaded into Guile, including your
address@hidden file, set any variables that may affect the functioning of
-Guile.  Also, see whether the problem happens in a freshly started Guile
-without loading your @file{.guile} file (start Guile with the @code{-q}
-switch to prevent loading the init file).  If the problem does
address@hidden occur then, you must report the precise contents of any
-programs that you must load into Guile in order to cause the problem to
-occur.
-
address@hidden
-If the problem does depend on an init file or other Scheme programs that
-are not part of the standard Guile distribution, then you should make
-sure it is not a bug in those programs by complaining to their
-maintainers first.  After they verify that they are using Guile in a way
-that is supposed to work, they should report the bug.
-
address@hidden
-If you wish to mention something in the Guile source, show the line of
-code with a few lines of context.  Don't just give a line number.
+backtrace showing how the Scheme program arrived at the error. This can
+be done using the @code{,backtrace} command in Guile's debugger.
address@hidden itemize
 
-The line numbers in the development sources might not match those in your
-sources.  It would take extra work for the maintainers to determine what
-code is in your version at a given line number, and we could not be
-certain.
+If your bug causes Guile to crash, additional information from a
+low-level debugger such as GDB might be helpful. If you have built Guile
+yourself, you can run Guile under GDB via the
address@hidden/gdb-uninstalled-guile} script. Instead of invoking Guile as
+usual, invoke the wrapper script, type @code{run} to start the process,
+then @code{backtrace} when the crash comes. Include that backtrace in
+your report.
 
address@hidden
-Additional information from a C debugger such as GDB might enable
-someone to find a problem on a machine which he does not have available.
-If you don't know how to use GDB, please read the GDB manual---it is not
-very long, and using GDB is easy.  You can find the GDB distribution,
-including the GDB manual in online form, in most of the same places you
-can find the Guile distribution.  To run Guile under GDB, you should
-switch to the @file{libguile} subdirectory in which Guile was compiled, then
-do @code{gdb guile} or @code{gdb .libs/guile} (if using GNU Libtool).
-
-However, you need to think when you collect the additional information
-if you want it to show what causes the bug.
-
-For example, many people send just a backtrace, but that is not very
-useful by itself.  A simple backtrace with arguments often conveys
-little about what is happening inside Guile, because most of the
-arguments listed in the backtrace are pointers to Scheme objects.  The
-numeric values of these pointers have no significance whatever; all that
-matters is the contents of the objects they point to (and most of the
-contents are themselves pointers).
address@hidden itemize
 
 
 @c Local Variables:
diff --git a/module/Makefile.am b/module/Makefile.am
index 87e7bbb..a2fb0f3 100644
--- a/module/Makefile.am
+++ b/module/Makefile.am
@@ -187,7 +187,6 @@ ICE_9_SOURCES = \
   ice-9/debug.scm \
   ice-9/debugger.scm \
   ice-9/documentation.scm \
-  ice-9/emacs.scm \
   ice-9/expect.scm \
   ice-9/format.scm \
   ice-9/getopt-long.scm \
@@ -311,7 +310,6 @@ OOP_SOURCES = \
 SYSTEM_SOURCES =                               \
   system/vm/inspect.scm                                \
   system/vm/coverage.scm                       \
-  system/vm/debug.scm                          \
   system/vm/frame.scm                          \
   system/vm/instruction.scm                    \
   system/vm/objcode.scm                                \
diff --git a/module/ice-9/debug.scm b/module/ice-9/debug.scm
index 2f728e7..380b045 100644
--- a/module/ice-9/debug.scm
+++ b/module/ice-9/debug.scm
@@ -19,117 +19,7 @@
 ;;;;
 
 
-(define-module (ice-9 debug)
-  #:use-module (ice-9 save-stack)
-  #:export (frame-number->index trace untrace trace-stack untrace-stack))
+(define-module (ice-9 debug))
 
-
-;;; {Misc}
-;;;
-(define (frame-number->index n . stack)
-  (let ((stack (if (null? stack)
-                  (fluid-ref the-last-stack)
-                  (car stack))))
-    (if (memq 'backwards (debug-options))
-       n
-       (- (stack-length stack) n 1))))
-
-
-;;; {Trace}
-;;;
-;;; This code is just an experimental prototype (e. g., it is not
-;;; thread safe), but since it's at the same time useful, it's
-;;; included anyway.
-;;;
-(define traced-procedures '())
-
-(define (trace . args)
-  (if (null? args)
-      (nameify traced-procedures)
-      (begin
-       (for-each (lambda (proc)
-                   (if (not (procedure? proc))
-                       (error "trace: Wrong type argument:" proc))
-                   (set-procedure-property! proc 'trace #t)
-                   (if (not (memq proc traced-procedures))
-                       (set! traced-procedures
-                             (cons proc traced-procedures))))
-                 args)
-       (trap-set! apply-frame-handler trace-entry)
-       (trap-set! exit-frame-handler trace-exit)
-       ;; We used to reset `trace-level' here to 0, but this is wrong
-       ;; if `trace' itself is being traced, since `trace-exit' will
-       ;; then decrement `trace-level' to -1!  It shouldn't actually
-       ;; be necessary to set `trace-level' here at all.
-       (debug-enable 'trace)
-       (nameify args))))
-
-(define (untrace . args)
-  (if (and (null? args)
-          (not (null? traced-procedures)))
-      (apply untrace traced-procedures)
-      (begin
-       (for-each (lambda (proc)
-                   (set-procedure-property! proc 'trace #f)
-                   (set! traced-procedures (delq! proc traced-procedures)))
-                 args)
-       (if (null? traced-procedures)
-           (debug-disable 'trace))
-       (nameify args))))
-
-(define (nameify ls)
-  (map (lambda (proc)
-        (let ((name (procedure-name proc)))
-          (or name proc)))
-       ls))
-
-(define trace-level 0)
-(add-hook! abort-hook (lambda () (set! trace-level 0)))
-
-(define traced-stack-ids (list 'repl-stack))
-(define trace-all-stacks? #f)
-
-(define (trace-stack id)
-  "Add ID to the set of stack ids for which tracing is active.
-If `#t' is in this set, tracing is active regardless of stack context.
-To remove ID again, use `untrace-stack'.  If you add the same ID twice
-using `trace-stack', you will need to remove it twice."
-  (set! traced-stack-ids (cons id traced-stack-ids))
-  (set! trace-all-stacks? (memq #t traced-stack-ids)))
-
-(define (untrace-stack id)
-  "Remove ID from the set of stack ids for which tracing is active."
-  (set! traced-stack-ids (delq1! id traced-stack-ids))
-  (set! trace-all-stacks? (memq #t traced-stack-ids)))
-
-(define (trace-entry key cont tail)
-  (if (or trace-all-stacks?
-         (memq (stack-id cont) traced-stack-ids))
-      (let ((cep (current-error-port))
-           (frame (last-stack-frame cont)))
-       (if (not tail)
-           (set! trace-level (+ trace-level 1)))
-       (let indent ((n trace-level))
-         (cond ((> n 1) (display "|  " cep) (indent (- n 1)))))
-       (display-application frame cep)
-       (newline cep)))
-  ;; It's not necessary to call the continuation since
-  ;; execution will continue if the handler returns
-  ;(cont #f)
-  )
-
-(define (trace-exit key cont retval)
-  (if (or trace-all-stacks?
-         (memq (stack-id cont) traced-stack-ids))
-      (let ((cep (current-error-port)))
-       (set! trace-level (- trace-level 1))
-       (let indent ((n trace-level))
-         (cond ((> n 0) (display "|  " cep) (indent (- n 1)))))
-       (write retval cep)
-       (newline cep))))
-
-
-;;; A fix to get the error handling working together with the module system.
-;;;
-;;; XXX - Still needed?
-(module-set! the-root-module 'debug-options debug-options)
+(issue-deprecation-warning
+ "(ice-9 debug) is deprecated. Use (system vm trace) for tracing.")
diff --git a/module/ice-9/debugger/commands.scm 
b/module/ice-9/debugger/commands.scm
index 56f1662..eece990 100644
--- a/module/ice-9/debugger/commands.scm
+++ b/module/ice-9/debugger/commands.scm
@@ -17,7 +17,6 @@
 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
USA
 
 (define-module (ice-9 debugger commands)
-  #:use-module (ice-9 debug)
   #:use-module ((ice-9 scm-style-repl) #:select (bad-throw))
   #:use-module (ice-9 debugger)
   #:use-module (ice-9 debugger state)
diff --git a/module/ice-9/debugging/trace.scm b/module/ice-9/debugging/trace.scm
index 76160e1..c8d24d0 100644
--- a/module/ice-9/debugging/trace.scm
+++ b/module/ice-9/debugging/trace.scm
@@ -1,6 +1,6 @@
 ;;;; (ice-9 debugging trace) -- breakpoint trace behaviour
 
-;;; Copyright (C) 2002 Free Software Foundation, Inc.
+;;; Copyright (C) 2002, 2010 Free Software Foundation, Inc.
 ;;;
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -17,7 +17,6 @@
 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
USA
 
 (define-module (ice-9 debugging trace)
-  #:use-module (ice-9 debug)
   #:use-module (ice-9 debugger)
   #:use-module (ice-9 debugger utils)
   #:use-module (ice-9 debugging steps)
diff --git a/module/ice-9/deprecated.scm b/module/ice-9/deprecated.scm
index 8912801..d6cc3b9 100644
--- a/module/ice-9/deprecated.scm
+++ b/module/ice-9/deprecated.scm
@@ -64,7 +64,6 @@
             the-last-stack
             save-stack
             named-module-use!
-            load-emacs-interface
             top-repl)
 
   #:replace (module-ref-submodule module-define-submodule!))
@@ -684,14 +683,6 @@ it.")
    "`named-module-use!' is deprecated. Define it yourself if you need it.")
   (module-use! (resolve-module user) (resolve-interface usee)))
 
-(define (load-emacs-interface)
-  (issue-deprecation-warning
-   "`load-emacs-interface' and the old emacs interface itself are deprecated.
-Use Geiser.")
-  (and (provided? 'debug-extensions)
-       (debug-enable 'backtrace))
-  (named-module-use! '(guile-user) '(ice-9 emacs)))
-
 (define (top-repl)
   (issue-deprecation-warning
    "`top-repl' has moved to the `(ice-9 top-repl)' module.")
diff --git a/module/ice-9/emacs.scm b/module/ice-9/emacs.scm
deleted file mode 100644
index 341870a..0000000
--- a/module/ice-9/emacs.scm
+++ /dev/null
@@ -1,278 +0,0 @@
-;;;;   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2006, 2009, 2010 Free 
Software Foundation, Inc.
-;;;; 
-;;;; This library is free software; you can redistribute it and/or
-;;;; modify it under the terms of the GNU Lesser General Public
-;;;; License as published by the Free Software Foundation; either
-;;;; version 3 of the License, or (at your option) any later version.
-;;;; 
-;;;; This library is distributed in the hope that it will be useful,
-;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;;;; Lesser General Public License for more details.
-;;;; 
-;;;; You should have received a copy of the GNU Lesser General Public
-;;;; License along with this library; if not, write to the Free Software
-;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
USA
-;;;;
-;;;; The author can be reached at address@hidden
-;;;; Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN
-;;;; (I didn't write this!)
-;;;;
-
-
-;;; *********************************************************************
-;;; * This is the Guile side of the Emacs interface                     *
-;;; * Experimental hACK---the real version will be coming soon (almost) *
-;;; *********************************************************************
-
-;;; {Session support for Emacs}
-;;;
-
-(define-module (ice-9 emacs)
-  :use-module (ice-9 debug)
-  :use-module (ice-9 threads)
-  :use-module (ice-9 session)
-  :use-module (ice-9 save-stack)
-  :no-backtrace)
-
-(define emacs-escape-character #\sub)
-
-(define emacs-output-port (current-output-port))
-
-(define (make-emacs-command char)
-  (let ((cmd (list->string (list emacs-escape-character char))))
-    (lambda ()
-      (display cmd emacs-output-port))))
-
-(define enter-input-wait  (make-emacs-command #\s))
-(define exit-input-wait   (make-emacs-command #\f))
-(define enter-read-character #\r)
-(define sending-error    (make-emacs-command #\F))
-(define sending-backtrace (make-emacs-command #\B))
-(define sending-result    (make-emacs-command #\x))
-(define end-of-text      (make-emacs-command #\.))
-(define no-stack         (make-emacs-command #\S))
-(define no-source        (make-emacs-command #\R))
-
-;; {Error handling}
-;;
-
-(add-hook! before-backtrace-hook sending-backtrace)
-(add-hook! after-backtrace-hook end-of-text)
-(add-hook! before-error-hook sending-error)
-(add-hook! after-error-hook end-of-text)
-
-;; {Repl}
-;;
-
-(set-current-error-port emacs-output-port)
-
-(add-hook! before-read-hook
-          (lambda ()
-            (enter-input-wait)
-            (force-output emacs-output-port)))
-
-(add-hook! after-read-hook
-          (lambda ()
-            (exit-input-wait)
-            (force-output emacs-output-port)))
-
-;;; {Misc.}
-
-(define (make-emacs-load-port orig-port)
-  (letrec ((read-char-fn  (lambda args
-                           (let ((c (read-char orig-port)))
-                             (if (eq? c #\soh)
-                                 (throw 'end-of-chunk)
-                                 c)))))
-    
-    (make-soft-port
-     (vector #f #f #f
-            read-char-fn
-            (lambda () (close-port orig-port)))
-     "r")))
-
-(set-current-input-port (make-emacs-load-port (current-input-port)))
-
-(define (result-to-emacs exp)
-  (sending-result)
-  (write exp emacs-output-port)
-  (end-of-text)
-  (force-output emacs-output-port))
-
-(define load-acknowledge (make-emacs-command #\l))
-
-(define load-port (current-input-port))
-
-(define (flush-line port)
-  (let loop ((c (read-char port)))
-    (if (not (eq? c #\nl))
-       (loop (read-char port)))))
-
-(define whitespace-chars (list #\space #\tab #\nl #\np))
-
-(define (flush-whitespace port)
-  (catch 'end-of-chunk
-        (lambda ()
-          (let loop ((c (read-char port)))
-            (cond ((eq? c the-eof-object)
-                   (error "End of file while receiving Emacs data"))
-                  ((memq c whitespace-chars) (loop (read-char port)))
-                  ((eq? c #\;) (flush-line port) (loop (read-char port)))
-                  (else (unread-char c port))))
-          #f)
-        (lambda args
-          (read-char port) ; Read final newline
-          #t)))
-
-(define (emacs-load filename linum colnum module interactivep)
-  (define (read-and-eval! port)
-    (let ((x (read port)))
-      (if (eof-object? x)
-         (throw 'end-of-file)
-         (primitive-eval x))))
-  (set-port-filename! %%load-port filename)
-  (set-port-line! %%load-port linum)
-  (set-port-column! %%load-port colnum)
-  (lazy-catch #t
-             (lambda ()
-               (let loop ((endp (flush-whitespace %%load-port)))
-                 (if (not endp)
-                     (begin
-                       (save-module-excursion
-                        (lambda ()
-                          (if module
-                              (set-current-module (resolve-module module #f)))
-                          (let ((result
-                                 (start-stack read-and-eval!
-                                              (read-and-eval! %%load-port))))
-                            (if interactivep
-                                (result-to-emacs result)))))
-                       (loop (flush-whitespace %%load-port)))
-                     (begin
-                       (load-acknowledge)))
-                 (set-port-filename! %%load-port #f))) ;reset port filename
-             (lambda (key . args)
-               (set-port-filename! %%load-port #f)
-               (cond ((eq? key 'end-of-chunk)
-                      (fluid-set! the-last-stack #f)
-                      (set! stack-saved? #t)
-                      (scm-error 'misc-error
-                                 #f
-                                 "Incomplete expression"
-                                 '()
-                                 '()))
-                     ((eq? key 'exit))
-                     (else
-                      (save-stack 2)
-                      (catch 'end-of-chunk
-                             (lambda ()
-                               (let loop ()
-                                 (read-char %%load-port)
-                                 (loop)))
-                             (lambda args
-                               #f))
-                      (apply throw key args))))))
-
-(define (emacs-eval-request form)
-  (result-to-emacs (eval form (interaction-environment))))
-
-;;*fixme* Not necessary to use flags no-stack and no-source
-(define (get-frame-source frame)
-  (if (or (not (fluid-ref the-last-stack))
-         (>= frame (stack-length (fluid-ref the-last-stack))))
-      (begin
-       (no-stack)
-       #f)
-      (let* ((frame (stack-ref (fluid-ref the-last-stack)
-                              (frame-number->index frame)))
-            (source (frame-source frame)))
-       (or source
-           (begin (no-source)
-                  #f)))))
-
-(define (emacs-select-frame frame)
-  (let ((source (get-frame-source frame)))
-    (if source
-       (let ((fname (source-property source 'filename))
-             (line (source-property source 'line))
-             (column (source-property source 'column)))
-         (if (and fname line column)
-             (list fname line column)
-             (begin (no-source)
-                    '())))
-       '())))
-
-(define (object->string x . method)
-  (with-output-to-string
-    (lambda ()
-      ((if (null? method)
-          write
-          (car method))
-       x))))
-
-(define (format template . rest)
-  (let loop ((chars (string->list template))
-            (result '())
-            (rest rest))
-    (cond ((null? chars) (list->string (reverse result)))
-         ((char=? (car chars) #\%)
-          (loop (cddr chars)
-                (append (reverse
-                         (string->list
-                          (case (cadr chars)
-                            ((#\S) (object->string (car rest)))
-                            ((#\s) (object->string (car rest) display)))))
-                        result)
-                (cdr rest)))
-         (else (loop (cdr chars) (cons (car chars) result) rest)))))
-
-(define (error-args->string args)
-  (let ((msg (apply format (caddr args) (cadddr args))))
-    (if (symbol? (cadr args))
-       (string-append (symbol->string (cadr args))
-                      ": "
-                      msg)
-       msg)))
-
-;; FIXME: no longer working due to removal of local-eval
-(define (emacs-frame-eval frame form)
-  (let ((source (get-frame-source frame)))
-    (if source
-       (catch #t
-              (lambda ()
-                (list 'result
-                      (object->string
-                       (local-eval (with-input-from-string form read)
-                                   (memoized-environment source)))))
-              (lambda args
-                (list (car args)
-                      (error-args->string args))))
-       (begin
-         (no-source)
-         '()))))
-
-(define (emacs-symdoc symbol)
-  (if (or (not (module-bound? (current-module) symbol))
-         (not (procedure? (eval symbol (interaction-environment)))))
-      'nil
-      (procedure-documentation (eval symbol (interaction-environment)))))
-
-;;; A fix to get the emacs interface to work together with the module system.
-;;;
-(for-each (lambda (name value)
-           (module-define! the-root-module name value))
-         '(%%load-port
-           %%emacs-load
-           %%emacs-eval-request
-           %%emacs-select-frame
-           %%emacs-frame-eval
-           %%emacs-symdoc
-           %%apropos-internal)
-         (list load-port
-               emacs-load
-               emacs-eval-request
-               emacs-select-frame
-               emacs-frame-eval
-               emacs-symdoc
-               apropos-internal))
diff --git a/module/ice-9/top-repl.scm b/module/ice-9/top-repl.scm
index e41da4e..c5039f5 100644
--- a/module/ice-9/top-repl.scm
+++ b/module/ice-9/top-repl.scm
@@ -54,16 +54,13 @@
     (process-use-modules 
      (append
       '(((ice-9 r5rs))
-        ((ice-9 session))
-        ((ice-9 debug)))
+        ((ice-9 session)))
       (if (provided? 'regex)
           '(((ice-9 regex)))
           '())
       (if (provided? 'threads)
           '(((ice-9 threads)))
           '())))
-    ;; load debugger on demand
-    (module-autoload! guile-user-module '(system vm debug) '(debug))
 
     (call-with-sigint
      (lambda ()
diff --git a/module/system/repl/command.scm b/module/system/repl/command.scm
index 1beaf31..8a62a16 100644
--- a/module/system/repl/command.scm
+++ b/module/system/repl/command.scm
@@ -232,7 +232,8 @@ are displayed."
                   (display-summary usage #f header)))
               (cdr *command-table*))
      (newline)
-     (display "Type `,COMMAND -h' to show documentation of each command.")
+     (display
+      "Type `,help -c COMMAND' to show documentation of a particular command.")
      (newline))
     ((all)
      (for-each display-group *command-table*))
@@ -347,15 +348,10 @@ Import modules / List those imported."
         (for-each use args))))
 
 (define guile:load load)
-(define-meta-command (load repl file . opts)
+(define-meta-command (load repl file)
   "load FILE
-Load a file in the current module.
-
-  -f    Load source file (see `compile')"
-  (let ((file (->string file)))
-    (if (memq #:f opts)
-        (primitive-load file)
-        (guile:load file))))
+Load a file in the current module."
+  (guile:load (->string file)))
 
 (define-meta-command (binding repl)
   "binding
diff --git a/module/system/repl/debug.scm b/module/system/repl/debug.scm
index 1164c6b..01b1b4c 100644
--- a/module/system/repl/debug.scm
+++ b/module/system/repl/debug.scm
@@ -34,7 +34,29 @@
             print-locals print-frame print-frames frame->module
             stack->vector narrow-stack->vector))
 
-;;; FIXME: add more repl meta-commands: continue, inspect, etc...
+;; TODO:
+;;
+;; Update this TODO list ;)
+;; partial meta-commands  (,qui -> ,quit)
+;; eval expression in context of frame
+;; set local variable in frame
+;; step until next instruction
+;; step until next function call/return
+;; step until return from frame
+;; step until different source line
+;; step until greater source line
+;; watch expression
+;; break on a function
+;; remove breakpoints
+;; set printing width
+;; display a truncated backtrace
+;; go to a frame by index
+;; (reuse gdb commands perhaps)
+;; disassemble a function
+;; disassemble the current function
+;; inspect any object
+;; hm, trace via reassigning global vars. tricksy.
+;; (state associated with vm ?)
 
 ;;;
 ;;; Debugger
@@ -175,3 +197,13 @@
 (define (narrow-stack->vector stack . args)
   (stack->vector (apply make-stack (stack-ref stack 0) args)))
 
+;; (define (debug)
+;;   (run-debugger
+;;    (narrow-stack->vector
+;;     (make-stack #t)
+;;     ;; Narrow the `make-stack' frame and the `debug' frame
+;;     2
+;;     ;; Narrow the end of the stack to the most recent start-stack.
+;;     (and (pair? (fluid-ref %stacks))
+;;          (cdar (fluid-ref %stacks))))))
+
diff --git a/module/system/vm/debug.scm b/module/system/vm/debug.scm
deleted file mode 100644
index dfc7140..0000000
--- a/module/system/vm/debug.scm
+++ /dev/null
@@ -1,522 +0,0 @@
-;;; Guile VM debugging facilities
-
-;;; Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
-;;;
-;;; This library is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU Lesser General Public
-;;; License as published by the Free Software Foundation; either
-;;; version 3 of the License, or (at your option) any later version.
-;;;
-;;; This library is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;;; Lesser General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU Lesser General Public
-;;; License along with this library; if not, write to the Free Software
-;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
USA
-
-;;; Code:
-
-(define-module (system vm debug)
-  #:use-module (system base pmatch)
-  #:use-module (system base syntax)
-  #:use-module (system base language)
-  #:use-module (system vm vm)
-  #:use-module (system vm frame)
-  #:use-module (ice-9 rdelim)
-  #:use-module (ice-9 pretty-print)
-  #:use-module (ice-9 format)
-  #:use-module ((system vm inspect) #:select ((inspect . %inspect)))
-  #:use-module (system vm program)
-  #:export (*debug-input-port*
-            *debug-output-port*
-            debug run-debugger
-            call-with-error-handling with-error-handling))
-
-
-
-(define *debug-input-port* (make-fluid))
-(define *debug-output-port* (make-fluid))
-
-(define (debug-input-port)
-  (or (fluid-ref *debug-input-port*)
-      (current-input-port)))
-(define (debug-output-port)
-  (or (fluid-ref *debug-output-port*)
-      (current-error-port)))
-
-
-(define (reverse-hashq h)
-  (let ((ret (make-hash-table)))
-    (hash-for-each
-     (lambda (k v)
-       (hashq-set! ret v (cons k (hashq-ref ret v '()))))
-     h)
-    ret))
-
-(define (catch-bad-arguments thunk bad-args-thunk)
-  (catch 'wrong-number-of-args
-    (lambda ()
-      (catch 'keyword-argument-error
-        thunk
-        (lambda (k . args)
-          (bad-args-thunk))))
-    (lambda (k . args)
-      (bad-args-thunk))))
-
-(define (read-args prompt)
-  (define (read* reader)
-    (repl-reader prompt reader))
-  (define (next)
-    (read* read-char))
-  (define (cmd chr)
-    (cond
-     ((eof-object? chr) (list chr))
-     ((char=? chr #\newline) (cmd (next)))
-     ((char-whitespace? chr) (cmd (next)))
-     (else
-      (unread-char chr)
-      (let ((tok (read* read)))
-        (args (list tok) (next))))))
-  (define (args out chr)
-    (cond
-     ((eof-object? chr) (reverse out))
-     ((char=? chr #\newline) (reverse out))
-     ((char-whitespace? chr) (args out (next)))
-     (else
-      (unread-char chr)
-      (let ((tok (read* read)))
-        (args (cons tok out) (next))))))
-  (cmd (next)))
-
-(define* (print-locals frame #:optional (port (current-output-port))
-                       #:key (width 72) (per-line-prefix ""))
-  (let ((bindings (frame-bindings frame)))
-    (cond
-     ((null? bindings)
-      (format port "~aNo local variables.~%" per-line-prefix))
-     (else
-      (format port "~aLocal variables:~%" per-line-prefix)
-      (for-each
-       (lambda (binding)
-         (format port "~a~4d ~a~:[~; (boxed)~] = ~v:@y\n"
-                 per-line-prefix
-                 (binding:index binding)
-                 (binding:name binding)
-                 (binding:boxed? binding)
-                 width
-                 (let ((x (frame-local-ref frame (binding:index binding))))
-                   (if (binding:boxed? binding)
-                       (variable-ref x)
-                       x))))
-       (frame-bindings frame))))))
-
-(define* (print-frames frames
-                       #:optional (port (current-output-port))
-                       #:key (width 72) (full? #f) (forward? #f) count)
-  (let* ((len (vector-length frames))
-         (lower-idx (if (or (not count) (positive? count))
-                        0
-                        (max 0 (+ len count))))
-         (upper-idx (if (and count (negative? count))
-                        (1- len)
-                        (1- (if count (min count len) len))))
-         (inc (if forward? 1 -1)))
-    (let lp ((i (if forward? lower-idx upper-idx))
-             (last-file ""))
-      (if (<= lower-idx i upper-idx)
-          (let* ((frame (vector-ref frames i))
-                 (source (frame-source frame))
-                 (file (and source
-                            (or (source:file source)
-                                "current input")))
-                 (line (and=> source source:line)))
-            (if (and file (not (equal? file last-file)))
-                (format port "~&In ~a:~&" file))
-            (format port "~:[~*~6_~;~5d:~]~3d ~v:@y~%" line line
-                    i width (frame-call-representation frame))
-            (if full?
-                (print-locals frame #:width width
-                              #:per-line-prefix "     "))
-            (lp (+ i inc) (or file last-file)))))))
-
-;; Ideally here we would have something much more syntactic, in that a set! to 
a
-;; local var that is not settable would raise an error, and export etc forms
-;; would modify the module in question: but alack, this is what we have now.
-;; Patches welcome!
-(define (frame->module frame)
-  (let ((proc (frame-procedure frame)))
-    (if (program? proc)
-        (let* ((mod (or (program-module proc) (current-module)))
-               (mod* (make-module)))
-          (module-use! mod* mod)
-          (for-each
-           (lambda (binding)
-             (let* ((x (frame-local-ref frame (binding:index binding)))
-                    (var (if (binding:boxed? binding) x (make-variable x))))
-               (format (debug-output-port)
-                       "~:[Read-only~;Mutable~] local variable ~a = ~70:@y\n"
-                       (binding:boxed? binding)
-                       (binding:name binding)
-                       (if (variable-bound? var) (variable-ref var) var))
-               (module-add! mod* (binding:name binding) var)))
-           (frame-bindings frame))
-          mod*)
-        (current-module))))
-
-
-;;;
-;;; Debugger
-;;;
-
-(define-record <debugger> vm level breakpoints module)
-
-(define (make-debugger-module)
-  (let ((m (make-fresh-user-module)))
-    m))
-
-(define vm-debugger
-  (let ((prop (make-object-property)))
-    (lambda (vm)
-      (or (prop vm)
-          (let ((debugger (make-debugger vm 0 '() (make-debugger-module))))
-            (set! (prop vm) debugger)
-            debugger)))))
-
-;; FIXME: Instead of dynamically binding the input and output ports in the
-;; context of the error, the debugger should really be a kind of coroutine,
-;; having its own dynamic input and output bindings. Delimited continuations 
can
-;; do this.
-(define* (run-debugger frames #:optional (vm (the-vm)) #:key
-                       (input (debug-input-port)) (output (debug-output-port)))
-  (let* ((db (vm-debugger vm))
-         (level (debugger-level db)))
-    (dynamic-wind
-      (lambda ()
-        (set! (debugger-level db) (1+ level))
-        (set! input (set-current-input-port input)))
-      (lambda () 
-        (dynamic-wind
-          (lambda () (set! output (set-current-output-port output)))
-          (lambda () (debugger-repl db frames))
-          (lambda () (set! output (set-current-output-port output)))))
-      (lambda ()
-        (set! input (set-current-input-port input))
-        (set! (debugger-level db) level)))))
-
-(define (debugger-repl db frames)
-  (let* ((index 0)
-         (top (vector-ref frames index))
-         (cur top)
-         (level (debugger-level db))
-         (last #f))
-    (define (frame-at-index idx)
-      (and (< idx (vector-length frames))
-           (vector-ref frames idx)))
-    (define (show-frame)
-      ;;      #2  0x009600e0 in do_std_select (args=0xbfffd9e0) at 
threads.c:1668
-      ;;      1668         select (select_args->nfds,
-      (format #t "#~2a 0x~8,'0x in address@hidden"
-              index
-              (frame-instruction-pointer cur)
-              (frame-call-representation cur)))
-
-    (define-syntax define-command
-      (syntax-rules ()
-        ((_ ((mod cname alias ...) . args) body ...)
-         (define cname
-           (let ((c (lambda* args body ...)))
-             (set-procedure-property! c 'name 'cname)
-             (module-define! mod 'cname c)
-             (module-add! mod 'alias (module-local-variable mod 'cname))
-             ...
-             c)))))
-
-    (let ((commands (make-module)))
-      (define (prompt)
-        (format #f "~a~a debug> "
-                (if (= level 1)
-                    ""
-                    (format #f "~a:" level))
-                index))
-      
-      (define (print* . vals)
-        (define (print x)
-          (run-hook before-print-hook x)
-          (set! last x)
-          (pretty-print x))
-        (if (and (pair? vals)
-                 (not (and (null? (cdr vals))
-                           (unspecified? (car vals)))))
-            (for-each print vals)))
-
-      (define-command ((commands backtrace bt) #:optional count
-                       #:key (width 72) full?)
-        "Print a backtrace of all stack frames, or innermost COUNT frames.
-If COUNT is negative, the last COUNT frames will be shown."
-        (print-frames frames 
-                      #:count count
-                      #:width width
-                      #:full? full?))
-      
-      (define-command ((commands up) #:optional (count 1))
-        "Select and print stack frames that called this one.
-An argument says how many frames up to go"
-        (cond
-         ((or (not (integer? count)) (<= count 0))
-          (format #t "Invalid argument to `up': expected a positive integer 
for COUNT.~%"))
-         ((>= (+ count index) (vector-length frames))
-          (cond
-           ((= index (1- (vector-length frames)))
-            (format #t "Already at outermost frame.\n"))
-           (else
-            (set! index (1- (vector-length frames)))
-            (set! cur (vector-ref frames index))
-            (show-frame))))
-         (else
-          (set! index (+ count index))
-          (set! cur (vector-ref frames index))
-          (show-frame))))
-
-      (define-command ((commands down) #:optional (count 1))
-        "Select and print stack frames called by this one.
-An argument says how many frames down to go"
-        (cond
-         ((or (not (integer? count)) (<= count 0))
-          (format #t "Invalid argument to `down': expected a positive integer 
for COUNT.~%"))
-         ((< (- index count) 0)
-          (cond
-           ((zero? index)
-            (format #t "Already at innermost frame.\n"))
-           (else
-            (set! index 0)
-            (set! cur (vector-ref frames index))
-            (show-frame))))
-         (else
-          (set! index (- index count))
-          (set! cur (vector-ref frames index))
-          (show-frame))))
-
-      (define-command ((commands frame f) #:optional idx)
-        "Show the selected frame.
-With an argument, select a frame by index, then show it."
-        (cond
-         (idx
-          (cond
-           ((or (not (integer? idx)) (< idx 0))
-            (format #t "Invalid argument to `frame': expected a non-negative 
integer for IDX.~%"))
-           ((frame-at-index idx)
-            => (lambda (f)
-                 (set! cur f)
-                 (set! index idx)
-                 (show-frame)))
-           (else
-            (format #t "No such frame.~%"))))
-         (else (show-frame))))
-
-      (define-command ((commands repl r))
-        "Run a new REPL in the context of the current frame."
-        (save-module-excursion
-         (lambda ()
-           (set-current-module (frame->module cur))
-           ((@ (system repl repl) start-repl)))))
-
-      (define-command ((commands procedure proc))
-        "Print the procedure for the selected frame."
-        (print* (frame-procedure cur)))
-      
-      (define-command ((commands inspect i))
-        "Launch the inspector on the last-printed object."
-        (%inspect last))
-      
-      (define-command ((commands locals))
-        "Show locally-bound variables in the selected frame."
-        (print-locals cur))
-      
-      (define-command ((commands quit q continue cont c))
-        "Quit the debugger and let the program continue executing."
-        (throw 'quit))
-      
-      (define-command ((commands help h ?) #:optional cmd)
-        "Show this help message."
-        (let ((rhash (reverse-hashq (module-obarray commands))))
-          (define (help-cmd cmd)
-            (let* ((v (module-local-variable commands cmd))
-                   (p (variable-ref v))
-                   (canonical-name (procedure-name p)))
-              ;; la la la
-              (format #t "~a~{ ~:@(~a~)~}~?~%~a~&~%"
-                      canonical-name (program-lambda-list p)
-                      "~#[~:;~40t(aliases: address@hidden, ~})~]"
-                      (delq canonical-name (hashq-ref rhash v))
-                      (procedure-documentation p))))
-          (cond
-           (cmd
-            (cond
-             ((and (symbol? cmd) (module-local-variable commands cmd))
-              (help-cmd cmd))
-             (else
-              (format #t "Invalid command ~s.~%" cmd)
-              (format #t "Try `help' for a list of commands~%"))))
-           (else
-            (let ((names (sort
-                           (hash-map->list
-                            (lambda (k v)
-                              (procedure-name (variable-ref k)))
-                            rhash)
-                           (lambda (x y)
-                             (string<? (symbol->string x)
-                                       (symbol->string y))))))
-              (format #t "Available commands:~%~%")
-              (for-each help-cmd names))))))
-
-      (define (handle cmd . args)
-        (cond
-         ((and (symbol? cmd)
-               (module-local-variable commands cmd))
-          => (lambda (var)
-               (let ((proc (variable-ref var)))
-                 (catch-bad-arguments
-                  (lambda ()
-                    (apply (variable-ref var) args))
-                  (lambda ()
-                    (format (current-error-port)
-                            "Invalid arguments to ~a. Try `help ~a'.~%"
-                            (procedure-name proc) (procedure-name proc)))))))
-         ((and (integer? cmd) (exact? cmd))
-          (frame cmd))
-         ((eof-object? cmd)
-          (newline)
-          (throw 'quit))
-         (else
-          (format (current-error-port)
-                  "~&Unknown command: ~a. Try `help'.~%" cmd)
-          *unspecified*)))
-
-      (catch 'quit
-        (lambda ()
-          (let loop ()
-            (let ((args (call-with-error-handling
-                         (lambda ()
-                           (save-module-excursion
-                            (lambda ()
-                              (set-current-module commands)
-                              (read-args prompt))))
-                         #:on-error 'pass)))
-              ;; args will be unspecified if there was a read error.
-              (if (not (unspecified? args))
-                  (apply handle args))
-              (loop))))
-        (lambda (k . args)
-          (apply values args))))))
-
-
-;; TODO:
-;;
-;; eval expression in context of frame
-;; set local variable in frame
-;; step until next instruction
-;; step until next function call/return
-;; step until return from frame
-;; step until different source line
-;; step until greater source line
-;; watch expression
-;; break on a function
-;; remove breakpoints
-;; set printing width
-;; display a truncated backtrace
-;; go to a frame by index
-;; (reuse gdb commands perhaps)
-;; disassemble a function
-;; disassemble the current function
-;; inspect any object
-;; hm, trace via reassigning global vars. tricksy.
-;; (state associated with vm ?)
-
-(define (stack->vector stack)
-  (let* ((len (stack-length stack))
-         (v (make-vector len)))
-    (if (positive? len)
-        (let lp ((i 0) (frame (stack-ref stack 0)))
-          (if (< i len)
-              (begin
-                (vector-set! v i frame)
-                (lp (1+ i) (frame-previous frame))))))
-    v))
-
-(define (debug)
-  (run-debugger
-   (narrow-stack->vector
-    (make-stack #t)
-    ;; Narrow the `make-stack' frame and the `debug' frame
-    2
-    ;; Narrow the end of the stack to the most recent start-stack.
-    (and (pair? (fluid-ref %stacks))
-         (cdar (fluid-ref %stacks))))))
-
-(define (narrow-stack->vector stack . args)
-  (stack->vector (apply make-stack (stack-ref stack 0) args)))
-
-(define* (call-with-error-handling thunk #:key
-                                   (on-error 'debug) (post-error 'catch)
-                                   (pass-keys '(quit)))
-  (catch #t
-    (lambda () (%start-stack #t thunk))
-
-    (case post-error
-      ((catch)
-       (lambda (key . args)
-         (if (memq key pass-keys)
-             (apply throw key args)
-             (let ((cep (current-error-port)))
-               (pmatch args
-                 ((,subr ,msg ,args . ,rest)
-                  (run-hook before-error-hook)
-                  (display-error #f cep subr msg args rest)
-                  (run-hook after-error-hook)
-                  (force-output cep))
-                 (else
-                  (format cep "\nERROR: uncaught throw to `~a', args: ~a\n"
-                          key args)))
-               (if #f #f)))))
-      (else
-       (if (procedure? post-error)
-           post-error
-           (error "Unknown post-error strategy" post-error))))
-    
-    (case on-error
-      ((debug)
-       (lambda (key . args)
-         (let ((stack (make-stack #t))
-               (dep (debug-output-port)))
-           (pmatch args
-             ((,subr ,msg ,args . ,rest)
-              (format dep "Throw to key `~a':\n" key)
-              (display-error stack dep subr msg args rest))
-             (else
-              (format dep "Throw to key `~a' with args `~s'." key args)))
-           (format dep "Entering the debugger. Type `bt' for a backtrace")
-           (format dep " or `c' to continue.\n")
-           (run-debugger
-            (narrow-stack->vector
-             stack
-             ;; Cut three frames from the top of the stack: make-stack, this
-             ;; one, and the throw handler.
-             3 
-             ;; Narrow the end of the stack to the most recent start-stack.
-             (and (pair? (fluid-ref %stacks))
-                  (cdar (fluid-ref %stacks))))))))
-      ((pass)
-       (lambda (key . args)
-         ;; fall through to rethrow
-         #t))
-      (else
-       (if (procedure? on-error)
-           on-error
-           (error "Unknown on-error strategy" on-error))))))
-
-(define-syntax with-error-handling
-  (syntax-rules ()
-    ((_ form)
-     (call-with-error-handling (lambda () form)))))


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]