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-2-109-gc0


From: Neil Jerram
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-2-109-gc0d316c
Date: Thu, 27 Aug 2009 21:23:12 +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=c0d316cce78b317b68dc3dc590256ef832721a2b

The branch, master has been updated
       via  c0d316cce78b317b68dc3dc590256ef832721a2b (commit)
       via  ba5f8bf4b1ff19871222d832a446c5e54da64b93 (commit)
      from  248ee86a0bd9d1481dff4d76508bbc7595a04314 (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 c0d316cce78b317b68dc3dc590256ef832721a2b
Author: Neil Jerram <address@hidden>
Date:   Thu Aug 27 22:22:34 2009 +0100

    Make GDS resilient to autocompilation comments
    
    * emacs/gds-scheme.el (gds-start-utility-guile): Make the extraction
      of client number more robust; in particular when the client emits
      comments (about auto compilation) before the number.

commit ba5f8bf4b1ff19871222d832a446c5e54da64b93
Author: Neil Jerram <address@hidden>
Date:   Thu Aug 27 22:21:20 2009 +0100

    Incorporate ice-9-debugger-extensions properly
    
    i.e. put the extensions where they need to be, and delete
    ice-9-debugger-extensions.scm.
    
    * doc/ref/api-debug.texi (Single Stepping through a Procedure's Code):
      Change mentions of (ice-9 debugging ice-9-debugger-extensions)
      module to whatever is appropriate now (or just remove them).
    
    * module/Makefile.am (NOCOMP_SOURCES): Remove
      ice-9-debugger-extensions.scm.
    
    * module/ice-9/debugger.scm (debug-trap): Move here from
      ice-9-debugger-extensions.scm.
    
    * module/ice-9/debugger/command-loop.scm ("continue", "finish",
      "step", "next"): Move here from ice-9-debugger-extensions.scm.
    
    * module/ice-9/debugger/commands.scm (assert-continuable, continue,
      finish, step, next): Move here from ice-9-debugger-extensions.scm.
    
    * module/ice-9/debugging/breakpoints.scm: Don't use
      ice-9-debugger-extensions module.
    
    * module/ice-9/debugging/ice-9-debugger-extensions.scm: Removed.
    
    * module/ice-9/debugging/trace.scm, module/ice-9/debugging/traps.scm:
      Remove more old version code.
    
    * module/ice-9/debugging/traps.scm (guile-trap-features): Hardcoded as
      '(tweaking).

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

Summary of changes:
 doc/ref/api-debug.texi                             |   10 +-
 emacs/gds-scheme.el                                |    9 +-
 module/Makefile.am                                 |    1 -
 module/ice-9/debugger.scm                          |   19 +++
 module/ice-9/debugger/command-loop.scm             |   11 ++
 module/ice-9/debugger/commands.scm                 |   55 ++++++++-
 module/ice-9/debugging/breakpoints.scm             |    1 -
 .../ice-9/debugging/ice-9-debugger-extensions.scm  |  138 --------------------
 module/ice-9/debugging/trace.scm                   |    5 +-
 module/ice-9/debugging/traps.scm                   |   35 +-----
 10 files changed, 98 insertions(+), 186 deletions(-)

diff --git a/doc/ref/api-debug.texi b/doc/ref/api-debug.texi
index 42e0676..c29bfdf 100644
--- a/doc/ref/api-debug.texi
+++ b/doc/ref/api-debug.texi
@@ -1708,7 +1708,7 @@ facilities just described.
 A good way to explore in detail what a Scheme procedure does is to set
 a trap on it and then single step through what it does.  To do this,
 make and install a @code{<procedure-trap>} with the @code{debug-trap}
-behaviour from @code{(ice-9 debugging ice-9-debugger-extensions)}.
+behaviour from @code{(ice-9 debugger)}.
 
 The following sample session illustrates this.  It assumes that the
 file @file{matrix.scm} defines a procedure @code{mkmatrix}, which is
@@ -1718,7 +1718,6 @@ calls @code{mkmatrix}.
 @lisp
 $ /usr/bin/guile -q
 guile> (use-modules (ice-9 debugger)
-                    (ice-9 debugging ice-9-debugger-extensions)
                     (ice-9 debugging traps))
 guile> (load "matrix.scm")
 guile> (install-trap (make <procedure-trap>
@@ -1758,10 +1757,9 @@ guile>
 
 Or you can use Guile's Emacs interface (GDS), by using the module
 @code{(ice-9 gds-client)} instead of @code{(ice-9 debugger)} and
address@hidden(ice-9 debugging ice-9-debugger-extensions)}, and changing
address@hidden to @code{gds-debug-trap}.  Then the stack and
-corresponding source locations are displayed in Emacs instead of on
-the Guile command line.
+changing @code{debug-trap} to @code{gds-debug-trap}.  Then the stack and
+corresponding source locations are displayed in Emacs instead of on the
+Guile command line.
 
 
 @node Profiling or Tracing a Procedure's Code
diff --git a/emacs/gds-scheme.el b/emacs/gds-scheme.el
index 54c75a7..798b107 100755
--- a/emacs/gds-scheme.el
+++ b/emacs/gds-scheme.el
@@ -214,10 +214,15 @@ Emacs to display an error or trap so that the user can 
debug it."
     ;; Set up a process filter to catch the new client's number.
     (set-process-filter proc
                         (lambda (proc string)
-                          (setq client (string-to-number string))
                           (if (process-buffer proc)
                               (with-current-buffer (process-buffer proc)
-                                (insert string)))))
+                                (insert string)
+                               (or client
+                                   (save-excursion
+                                     (goto-char (point-min))
+                                     (setq client (condition-case nil
+                                                      (read (current-buffer))
+                                                    (error nil)))))))))
     ;; Accept output from the new process until we have its number.
     (while (not client)
       (accept-process-output proc))
diff --git a/module/Makefile.am b/module/Makefile.am
index d1c2d95..668b8a5 100644
--- a/module/Makefile.am
+++ b/module/Makefile.am
@@ -269,7 +269,6 @@ NOCOMP_SOURCES =                            \
   ice-9/debugger/trc.scm \
   ice-9/debugger/utils.scm \
   ice-9/debugging/example-fns.scm \
-  ice-9/debugging/ice-9-debugger-extensions.scm \
   ice-9/debugging/steps.scm \
   ice-9/debugging/trace.scm \
   ice-9/debugging/traps.scm \
diff --git a/module/ice-9/debugger.scm b/module/ice-9/debugger.scm
index 06f7ed2..d6fe299 100644
--- a/module/ice-9/debugger.scm
+++ b/module/ice-9/debugger.scm
@@ -20,6 +20,7 @@
   #:use-module (ice-9 debugger command-loop)
   #:use-module (ice-9 debugger state)
   #:use-module (ice-9 debugger utils)
+  #:use-module (ice-9 debugging traps)
   #:use-module (ice-9 format)
   #:export (debug-stack
            debug
@@ -143,4 +144,22 @@ Indicates that the debugger should display an introductory 
message.
              (apply default-pre-unwind-handler key args))
            default-pre-unwind-handler)))
 
+;;; Also provide a `debug-trap' entry point.  This maps from a
+;;; trap-context to a debug-stack call.
+
+(define-public (debug-trap trap-context)
+  "Invoke the Guile debugger to explore the stack at the specified 
@var{trap-context}."
+  (let* ((stack (tc:stack trap-context))
+        (flags1 (let ((trap-type (tc:type trap-context)))
+                  (case trap-type
+                    ((#:return #:error)
+                     (list trap-type
+                           (tc:return-value trap-context)))
+                    (else
+                     (list trap-type)))))
+        (flags (if (tc:continuation trap-context)
+                   (cons #:continuable flags1)
+                   flags1)))
+    (apply debug-stack stack flags)))
+
 ;;; (ice-9 debugger) ends here.
diff --git a/module/ice-9/debugger/command-loop.scm 
b/module/ice-9/debugger/command-loop.scm
index c662827..18ea003 100644
--- a/module/ice-9/debugger/command-loop.scm
+++ b/module/ice-9/debugger/command-loop.scm
@@ -18,6 +18,9 @@
 
 (define-module (ice-9 debugger command-loop)
   #:use-module ((ice-9 debugger commands) :prefix debugger:)
+  #:use-module (ice-9 debugger)
+  #:use-module (ice-9 debugger state)
+  #:use-module (ice-9 debugging traps)
   #:export (debugger-command-loop
            debugger-command-loop-error
            debugger-command-loop-quit)
@@ -540,3 +543,11 @@
 (define-command-alias "where" "backtrace")
 (define-command-alias "p" "evaluate")
 (define-command-alias '("info" "stack") "backtrace")
+
+(define-command "continue" '() debugger:continue)
+
+(define-command "finish" '() debugger:finish)
+
+(define-command "step" '('optional exact-integer) debugger:step)
+
+(define-command "next" '('optional exact-integer) debugger:next)
diff --git a/module/ice-9/debugger/commands.scm 
b/module/ice-9/debugger/commands.scm
index c254ce9..00cab87 100644
--- a/module/ice-9/debugger/commands.scm
+++ b/module/ice-9/debugger/commands.scm
@@ -21,6 +21,7 @@
   #:use-module (ice-9 debugger)
   #:use-module (ice-9 debugger state)
   #:use-module (ice-9 debugger utils)
+  #:use-module (ice-9 debugging steps)
   #:export (backtrace
            evaluate
            info-args
@@ -28,7 +29,11 @@
            position
            up
            down
-           frame))
+           frame
+           continue
+           finish
+           step
+           next))
 
 (define (backtrace state n-frames)
   "Print backtrace of all stack frames, or innermost COUNT frames.
@@ -151,4 +156,52 @@ An argument specifies the frame to select; it must be a 
stack-frame number."
   (if n (set-stack-index! state (frame-number->index n (state-stack state))))
   (write-state-short state))
 
+(define (assert-continuable state)
+  ;; Check that debugger is in a state where `continuing' makes sense.
+  ;; If not, signal an error.
+  (or (memq #:continuable (state-flags state))
+      (user-error "This debug session is not continuable.")))
+
+(define (continue state)
+  "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.)"
+  (assert-continuable state)
+  (throw 'exit-debugger))
+
+(define (finish state)
+  "Continue until evaluation of the current frame is complete, and
+print the result obtained."
+  (assert-continuable state)
+  (at-exit (- (stack-length (state-stack state))
+             (state-index state))
+          (list trace-trap debug-trap))
+  (continue state))
+
+(define (step state 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."
+  (assert-continuable state)
+  (at-step debug-trap (or n 1))
+  (continue state))
+
+(define (next state 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."
+  (assert-continuable state)
+  (at-step debug-trap
+          (or n 1)
+          (frame-file-name (stack-ref (state-stack state)
+                                      (state-index state)))
+          (if (memq #:return (state-flags state))
+              #f
+              (- (stack-length (state-stack state)) (state-index state))))
+  (continue state))
+
 ;;; (ice-9 debugger commands) ends here.
diff --git a/module/ice-9/debugging/breakpoints.scm 
b/module/ice-9/debugging/breakpoints.scm
index c839409..0690699 100644
--- a/module/ice-9/debugging/breakpoints.scm
+++ b/module/ice-9/debugging/breakpoints.scm
@@ -25,7 +25,6 @@
   #:use-module (ice-9 optargs)
   #:use-module (ice-9 regex)
   #:use-module (oop goops)
-  #:use-module (ice-9 debugging ice-9-debugger-extensions)
   #:use-module (ice-9 debugging traps)
   #:use-module (ice-9 debugging trc)
   #:use-module (srfi srfi-1)
diff --git a/module/ice-9/debugging/ice-9-debugger-extensions.scm 
b/module/ice-9/debugging/ice-9-debugger-extensions.scm
index 5d7bfc8..e69de29 100644
--- a/module/ice-9/debugging/ice-9-debugger-extensions.scm
+++ b/module/ice-9/debugging/ice-9-debugger-extensions.scm
@@ -1,138 +0,0 @@
-
-(define-module (ice-9 debugging ice-9-debugger-extensions)
-  #:use-module (ice-9 debugger))
-
-;;; Upgrade the debugger state object so that it can carry a flag
-;;; indicating whether the debugging session is continuable.
-
-(use-modules (ice-9 debugger state))
-(define-module (ice-9 debugger state))
-
-(set! state-rtd (make-record-type "debugger-state" '(stack index flags)))
-(set! state? (record-predicate state-rtd))
-(set! make-state
-  (let ((make-state-internal (record-constructor state-rtd
-                                                '(stack index flags))))
-    (lambda (stack index . flags)
-      (make-state-internal stack index flags))))
-(set! state-stack (record-accessor state-rtd 'stack))
-(set! state-index (record-accessor state-rtd 'index))
-
-(define state-flags (record-accessor state-rtd 'flags))
-
-;;; Add commands that (ice-9 debugger) doesn't currently have, for
-;;; continuing or single stepping program execution.
-
-(use-modules (ice-9 debugger command-loop))
-(define-module (ice-9 debugger command-loop)
-  #:use-module (ice-9 debugger)
-  #:use-module (ice-9 debugger state)
-  #:use-module (ice-9 debugging traps))
-(define new-define-command define-command)
-(set! define-command
-      (lambda (name argument-template documentation procedure)
-       (new-define-command name argument-template procedure)))
-
-(use-modules (ice-9 debugging steps))
-
-(define (assert-continuable state)
-  ;; Check that debugger is in a state where `continuing' makes sense.
-  ;; If not, signal an error.
-  (or (memq #:continuable (state-flags state))
-      (user-error "This debug session is not continuable.")))
-
-(define (debugger:continue state)
-  "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.)"
-  (assert-continuable state)
-  (throw 'exit-debugger))
-
-(define (debugger:finish state)
-  "Continue until evaluation of the current frame is complete, and
-print the result obtained."
-  (assert-continuable state)
-  (at-exit (- (stack-length (state-stack state))
-             (state-index state))
-          (list trace-trap debug-trap))
-  (debugger:continue state))
-
-(define (debugger:step state 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."
-  (assert-continuable state)
-  (at-step debug-trap (or n 1))
-  (debugger:continue state))
-
-(define (debugger:next state 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."
-  (assert-continuable state)
-  (at-step debug-trap
-          (or n 1)
-          (frame-file-name (stack-ref (state-stack state)
-                                      (state-index state)))
-          (if (memq #:return (state-flags state))
-              #f
-              (- (stack-length (state-stack state)) (state-index state))))
-  (debugger:continue state))
-
-(define-command "continue" '()
-  "Continue program execution."
-  debugger:continue)
-
-(define-command "finish" '()
-  "Continue until evaluation of the current frame is complete, and
-print the result obtained."
-  debugger:finish)
-
-(define-command "step" '('optional exact-integer)
-  "Continue until entry to @var{n}th next frame."
-  debugger:step)
-
-(define-command "next" '('optional exact-integer)
-  "Continue until entry to @var{n}th next frame in same file."
-  debugger:next)
-
-;;; Provide a `debug-trap' entry point in (ice-9 debugger).  This is
-;;; designed so that it can be called to explore the stack at a
-;;; breakpoint, and to single step from the breakpoint.
-
-(define-module (ice-9 debugger))
-
-(use-modules (ice-9 debugging traps))
-
-(define *not-yet-introduced* #t)
-
-(define-public (debug-trap trap-context)
-  "Invoke the Guile debugger to explore the stack at the specified @var{trap}."
-  (start-stack 'debugger
-              (let* ((stack (tc:stack trap-context))
-                     (flags1 (let ((trap-type (tc:type trap-context)))
-                               (case trap-type
-                                 ((#:return #:error)
-                                  (list trap-type
-                                        (tc:return-value trap-context)))
-                                 (else
-                                  (list trap-type)))))
-                     (flags (if (tc:continuation trap-context)
-                                (cons #:continuable flags1)
-                                flags1))
-                     (state (apply make-state stack 0 flags)))
-                (if *not-yet-introduced*
-                    (let ((ssize (stack-length stack)))
-                      (display "This is the Guile debugger -- for help, type 
`help'.\n")
-                      (set! *not-yet-introduced* #f)
-                      (if (= ssize 1)
-                          (display "There is 1 frame on the stack.\n\n")
-                          (format #t "There are ~A frames on the stack.\n\n" 
ssize))))
-                (write-state-short-with-source-location state)
-                (debugger-command-loop state))))
-
-(define write-state-short-with-source-location write-state-short)
diff --git a/module/ice-9/debugging/trace.scm b/module/ice-9/debugging/trace.scm
index 55b1f39..76160e1 100644
--- a/module/ice-9/debugging/trace.scm
+++ b/module/ice-9/debugging/trace.scm
@@ -19,7 +19,7 @@
 (define-module (ice-9 debugging trace)
   #:use-module (ice-9 debug)
   #:use-module (ice-9 debugger)
-  #:use-module (ice-9 debugging ice-9-debugger-extensions)
+  #:use-module (ice-9 debugger utils)
   #:use-module (ice-9 debugging steps)
   #:use-module (ice-9 debugging traps)
   #:export (trace-trap
@@ -40,9 +40,6 @@
            trace-at-exit
            trace-until-exit))
 
-(cond ((string>=? (version) "1.7")
-       (use-modules (ice-9 debugger utils))))
-
 (define trace-format-string #f)
 (define trace-arg-procs #f)
 
diff --git a/module/ice-9/debugging/traps.scm b/module/ice-9/debugging/traps.scm
index e13011e..292456d 100755
--- a/module/ice-9/debugging/traps.scm
+++ b/module/ice-9/debugging/traps.scm
@@ -25,6 +25,7 @@
 
 (define-module (ice-9 debugging traps)
   #:use-module (ice-9 regex)
+  #:use-module (ice-9 weak-vector)
   #:use-module (oop goops)
   #:use-module (oop goops describe)
   #:use-module (ice-9 debugging trc)
@@ -86,11 +87,6 @@
 ;; "(trc " to find other symbols that can be passed to trc-add.
 ;; (trc-add 'after-gc-hook)
 
-;; In Guile 1.7 onwards, weak-vector and friends are provided by the
-;; (ice-9 weak-vector) module.
-(cond ((string>=? (version) "1.7")
-       (use-modules (ice-9 weak-vector))))
-
 ;;; The current low level traps interface is as follows.
 ;;;
 ;;; All trap handlers are subject to SCM_TRAPS_P, which is controlled
@@ -1002,34 +998,7 @@ it twice."
                (trap-disable 'traps)
                (thunk))))
 
-(define guile-trap-features
-  ;; Helper procedure, to test whether a specific possible Guile
-  ;; feature is supported.
-  (let ((supported?
-         (lambda (test-feature)
-           (case test-feature
-             ((tweaking)
-              ;; Tweaking is supported if the description of the cheap
-              ;; traps option includes the word "obsolete", or if the
-              ;; option isn't there any more.
-              (and (string>=? (version) "1.7")
-                   (let ((cheap-opt-desc
-                          (assq 'cheap (debug-options-interface 'help))))
-                     (or (not cheap-opt-desc)
-                         (string-match "obsolete" (caddr cheap-opt-desc))))))
-             (else
-              (error "Unexpected feature name:" test-feature))))))
-    ;; Compile the list of actually supported features from all
-    ;; possible features.
-    (let loop ((possible-features '(tweaking))
-               (actual-features '()))
-      (if (null? possible-features)
-          (reverse! actual-features)
-          (let ((test-feature (car possible-features)))
-            (loop (cdr possible-features)
-                  (if (supported? test-feature)
-                      (cons test-feature actual-features)
-                      actual-features)))))))
+(define guile-trap-features '(tweaking))
 
 ;; Make sure that traps are enabled.
 (trap-enable 'traps)


hooks/post-receive
-- 
GNU Guile




reply via email to

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