Fix tracing
authorAndy Wingo <wingo@pobox.com>
Tue, 28 Jan 2014 20:31:17 +0000 (21:31 +0100)
committerAndy Wingo <wingo@pobox.com>
Tue, 28 Jan 2014 20:31:17 +0000 (21:31 +0100)
* module/system/vm/trace.scm (print-return): Remove frame argument.
  (trace-calls-to-procedure, trace-calls-in-procedure): Adapt callers.
* module/system/vm/traps.scm (trap-in-procedure, trap-frame-finish):
  (trap-calls-to-procedure): Since the pop continuation hook is now
  called after the continuation is popped, we need to check the right
  frame.  Fixes tail-calls in the trace root, and probably other things.

module/system/vm/trace.scm
module/system/vm/traps.scm

index 30acba4..77191b7 100644 (file)
@@ -1,6 +1,6 @@
 ;;; Guile VM tracer
 
-;; Copyright (C) 2001, 2009, 2010, 2012, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2009, 2010, 2012, 2013, 2014 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
@@ -48,7 +48,7 @@
             width
             (frame-call-representation frame))))
 
-(define* (print-return frame depth width prefix max-indent values)
+(define (print-return depth width prefix max-indent values)
   (let ((prefix (build-prefix prefix depth "|  " "~d< "max-indent)))
     (case (length values)
       ((0)
@@ -73,7 +73,7 @@
   (define (apply-handler frame depth)
     (print-application frame depth width prefix max-indent))
   (define (return-handler frame depth . values)
-    (print-return frame depth width prefix max-indent values))
+    (print-return depth width prefix max-indent values))
   (trap-calls-to-procedure proc apply-handler return-handler))
 
 (define* (trace-calls-in-procedure proc #:key (width 80)
@@ -82,7 +82,7 @@
   (define (apply-handler frame depth)
     (print-application frame depth width prefix max-indent))
   (define (return-handler frame depth . values)
-    (print-return frame depth width prefix max-indent values))
+    (print-return depth width prefix max-indent values))
   (trap-calls-in-dynamic-extent proc apply-handler return-handler))
 
 (define* (trace-instructions-in-procedure proc #:key (width 80)
index 114647e..77823e1 100644 (file)
@@ -1,6 +1,6 @@
 ;;; Traps: stepping, breakpoints, and such.
 
-;; Copyright (C)  2010, 2012, 2013 Free Software Foundation, Inc.
+;; Copyright (C)  2010, 2012, 2013, 2014 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
     (define (pop-cont-hook frame . values)
       (if in-proc?
           (exit-proc frame))
-      (if (our-frame? (frame-previous frame))
-          (enter-proc (frame-previous frame))))
+      (if (our-frame? frame)
+          (enter-proc frame)))
 
     (define (abort-hook frame . values)
       (if in-proc?
   (arg-check abort-handler procedure?)
   (let ((fp (frame-address frame)))
     (define (pop-cont-hook frame . values)
-      (if (and fp (eq? (frame-address frame) fp))
+      (if (and fp (< (frame-address frame) fp))
           (begin
             (set! fp #f)
             (apply return-handler frame values))))
 
         (apply-handler frame depth)
 
-        (if (not (eq? (frame-address frame) last-fp))
+        (if (not (eqv? (frame-address frame) last-fp))
             (let ((finish-trap #f))
               (define (frame-finished frame)
                 (finish-trap frame) ;; disables the trap.