1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-02 23:50:47 +02:00

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.
This commit is contained in:
Andy Wingo 2014-01-28 21:31:17 +01:00
parent 02c624fc09
commit ae4d761f7a
2 changed files with 9 additions and 9 deletions

View 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)

View 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
@ -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.