[Top][All Lists]

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

[Guile-commits] GNU Guile branch, master, updated. release_1-9-12-121-g2

From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-12-121-g2c5fc8d
Date: Fri, 01 Oct 2010 17:05:23 +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".

The branch, master has been updated
       via  2c5fc8d03420855301993bee6d8afa28d64503d6 (commit)
       via  e867d563a56a86533f998441dc8c48dfef38d017 (commit)
       via  c005daf9239b6c2b5574d88a0ee46195ac1cb1ec (commit)
      from  3b3518e7f60750c878d430081358b2335df4a5da (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 2c5fc8d03420855301993bee6d8afa28d64503d6
Author: Andy Wingo <address@hidden>
Date:   Fri Oct 1 18:25:44 2010 +0200

    source breakpoints accept user line numbers
    * module/system/vm/trap-state.scm (add-trap-at-source-location!):
    * module/system/vm/traps.scm (trap-at-source-location): Rename "line"
      argument to "user-line", indicating that the line is one-based instead
      of zero-based. Decrement the line before handing off to
      source-closures-or-procedures and source->ip-range.

commit e867d563a56a86533f998441dc8c48dfef38d017
Author: Andy Wingo <address@hidden>
Date:   Fri Oct 1 18:15:23 2010 +0200

    add source:line-for-user, returning a 1-indexed line number
    * module/system/vm/program.scm (source:line-for-user): New exported
      procedure, returns a 1-indexed line, suitable for presentation to a
      (write-program): Use source:line-for-user when making fallback names.
    * module/system/vm/coverage.scm (coverage-data->lcov):
    * module/language/assembly/disassemble.scm (source->string):
    * module/system/repl/debug.scm (print-frame): Use source:line-for-user.

commit c005daf9239b6c2b5574d88a0ee46195ac1cb1ec
Author: Andy Wingo <address@hidden>
Date:   Fri Oct 1 17:26:41 2010 +0200

    api-debug tweak
    * doc/ref/api-debug.texi (Debug Options): Fix wording.


Summary of changes:
 doc/ref/api-debug.texi                   |    4 ++--
 module/language/assembly/disassemble.scm |    2 +-
 module/system/repl/debug.scm             |    2 +-
 module/system/vm/coverage.scm            |    6 +++---
 module/system/vm/program.scm             |    9 ++++++++-
 module/system/vm/trap-state.scm          |    6 +++---
 module/system/vm/traps.scm               |   16 ++++++++++------
 7 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/doc/ref/api-debug.texi b/doc/ref/api-debug.texi
index 5be997e..e4bde0b 100644
--- a/doc/ref/api-debug.texi
+++ b/doc/ref/api-debug.texi
@@ -583,8 +583,8 @@ A set of keys to ignore, as a list.
 @node Debug Options
 @subsubsection Debug options
-The behavior when an error is the @code{backtrace} procedure and of the
-default error handler can be parameterized via the debug options.
+The behavior of the @code{backtrace} procedure and of the default error
+handler can be parameterized via the debug options.
 @cindex options - debug
 @cindex debug options
diff --git a/module/language/assembly/disassemble.scm 
index bd1f6a1..88ea0d7 100644
--- a/module/language/assembly/disassemble.scm
+++ b/module/language/assembly/disassemble.scm
@@ -113,7 +113,7 @@
 (define (source->string src)
   (format #f "~a:~a:~a" (or (source:file src) "(unknown file)")
-          (source:line src) (source:column src)))
+          (source:line-for-user src) (source:column src)))
 (define (make-int16 byte1 byte2)
   (+ (* byte1 256) byte2))
diff --git a/module/system/repl/debug.scm b/module/system/repl/debug.scm
index 28e7e30..0e491b5 100644
--- a/module/system/repl/debug.scm
+++ b/module/system/repl/debug.scm
@@ -109,7 +109,7 @@
         "unknown file"))
   (let* ((source (frame-source frame))
          (file (source:pretty-file source))
-         (line (and=> source source:line))
+         (line (and=> source source:line-for-user))
          (col (and=> source source:column)))
     (if (and file (not (equal? file (source:pretty-file last-source))))
         (format port "~&In ~a:~&" file))
diff --git a/module/system/vm/coverage.scm b/module/system/vm/coverage.scm
index 7554631..268d211 100644
--- a/module/system/vm/coverage.scm
+++ b/module/system/vm/coverage.scm
@@ -332,10 +332,10 @@ gathered, even if their code was not executed."
     (and (program? proc)
          (let ((sources (program-sources* data proc)))
            (and (pair? sources)
-                (let* ((line (source:line (car sources)))
+                (let* ((line (source:line-for-user (car sources)))
                        (name (or (procedure-name proc)
-                                 (format #f "anonymous-l~a" (+ 1 line)))))
-                  (format port "FN:~A,~A~%" (+ 1 line) name)
+                                 (format #f "anonymous-l~a" line))))
+                  (format port "FN:~A,~A~%" line name)
                   (and=> (procedure-execution-count data proc)
                          (lambda (count)
                            (format port "FNDA:~A,~A~%" count name))))))))
diff --git a/module/system/vm/program.scm b/module/system/vm/program.scm
index 30f8c7e..a1e3ea4 100644
--- a/module/system/vm/program.scm
+++ b/module/system/vm/program.scm
@@ -28,6 +28,7 @@
             binding:start binding:end
             source:addr source:line source:column source:file
+            source:line-for-user
             program-sources program-source
             program-bindings program-bindings-by-index program-bindings-for-ip
@@ -64,6 +65,12 @@
 (define (source:column source)
   (cdddr source))
+;; Lines are zero-indexed inside Guile, but users expect them to be
+;; one-indexed. Columns, on the other hand, are zero-indexed to both. Go
+;; figure.
+(define (source:line-for-user source)
+  (1+ (source:line source)))
 (define (collapse-locals locs)
   (let lp ((ret '()) (locs locs))
     (if (null? locs)
@@ -209,7 +216,7 @@
                                (number->string (object-address prog) 16)
                                (or (source:file s)
                                    (if s "<current input>" "<unknown port>"))
-                               (source:line s) (source:column s))))
+                               (source:line-for-user s) (source:column s))))
               (number->string (object-address prog) 16))
           (let ((arities (program-arities prog)))
             (if (or (not arities) (null? arities))
diff --git a/module/system/vm/trap-state.scm b/module/system/vm/trap-state.scm
index 42033b2..c67ea32 100644
--- a/module/system/vm/trap-state.scm
+++ b/module/system/vm/trap-state.scm
@@ -209,16 +209,16 @@
       idx #t trap
       (format #f "Tracepoint at ~a" proc)))))
-(define* (add-trap-at-source-location! file line
+(define* (add-trap-at-source-location! file user-line
                                        #:optional (trap-state 
   (let* ((idx (next-index! trap-state))
-         (trap (trap-at-source-location file line
+         (trap (trap-at-source-location file user-line
                                         (handler-for-index trap-state idx))))
       idx #t trap
-      (format #f "Breakpoint at ~a:~a" file line)))))
+      (format #f "Breakpoint at ~a:~a" file user-line)))))
 (define* (add-trap! trap name #:optional (trap-state (the-trap-state)))
   (let* ((idx (next-index! trap-state)))
diff --git a/module/system/vm/traps.scm b/module/system/vm/traps.scm
index e31df85..0e7a540 100644
--- a/module/system/vm/traps.scm
+++ b/module/system/vm/traps.scm
@@ -249,6 +249,9 @@
 (define (non-negative-integer? x)
   (and (number? x) (integer? x) (exact? x) (not (negative? x))))
+(define (positive-integer? x)
+  (and (number? x) (integer? x) (exact? x) (positive? x)))
 (define (range? x)
   (and (list? x)
        (and-map (lambda (x)
@@ -345,16 +348,17 @@
         (values (source-procedures file line) #f))))
 ;; Building on trap-on-instructions-in-procedure, we have
-;; trap-at-source-location.
+;; trap-at-source-location. The parameter `user-line' is one-indexed, as
+;; a user counts lines, instead of zero-indexed, as Guile counts lines.
-(define* (trap-at-source-location file line handler
+(define* (trap-at-source-location file user-line handler
                                   #:key current-frame (vm (the-vm)))
   (arg-check file string?)
-  (arg-check line non-negative-integer?)
+  (arg-check user-line positive-integer?)
   (arg-check handler procedure?)
   (let ((traps #f))
-        (lambda () (source-closures-or-procedures file line))
+        (lambda () (source-closures-or-procedures file (1- user-line)))
       (lambda (procs closures?)
          vm current-frame
@@ -362,14 +366,14 @@
            (set! traps
                   (lambda (proc)
-                    (let ((range (source->ip-range proc file line)))
+                    (let ((range (source->ip-range proc file (1- user-line))))
                       (trap-at-procedure-ip-in-range proc range handler
                                                      #:vm vm
                                                      #:closure? closures?)))
            (if (null? traps)
-               (error "No procedures found at ~a:~a." file line)))
+               (error "No procedures found at ~a:~a." file user-line)))
          (lambda (frame)
            (for-each (lambda (trap) (trap frame)) traps)
            (set! traps #f)))))))

GNU Guile

reply via email to

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