From ae4d761f7ab0c02081a4edfb70b4199bfa077025 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 28 Jan 2014 21:31:17 +0100 Subject: [PATCH] Fix tracing * 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 | 8 ++++---- module/system/vm/traps.scm | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/module/system/vm/trace.scm b/module/system/vm/trace.scm index 30acba473..77191b7b9 100644 --- a/module/system/vm/trace.scm +++ b/module/system/vm/trace.scm @@ -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) diff --git a/module/system/vm/traps.scm b/module/system/vm/traps.scm index 114647e9e..77823e1aa 100644 --- a/module/system/vm/traps.scm +++ b/module/system/vm/traps.scm @@ -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 @@ -193,8 +193,8 @@ (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? @@ -403,7 +403,7 @@ (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)))) @@ -548,7 +548,7 @@ (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.