(frame-local-ref frame (+ (- len nvalues) i)))
(iota nvalues))))
-(define (print-application frame depth width)
- (format (current-error-port) "~a~v:@y\n"
- (make-string depth #\|)
+(define (print-application frame depth width prefix)
+ (format (current-error-port) "~a~a~v:@y\n"
+ prefix (make-string depth #\|)
(max (- width depth) 1)
(frame-call-representation frame)))
-(define (print-return frame depth width)
+(define (print-return frame depth width prefix)
(let* ((len (frame-num-locals frame))
(nvalues (frame-local-ref frame (1- len))))
(cond
((= nvalues 1)
- (format (current-error-port) "~a~v:@y\n"
- (make-string depth #\|)
+ (format (current-error-port) "~a~a~v:@y\n"
+ prefix (make-string depth #\|)
width (frame-local-ref frame (- len 2))))
(else
;; this should work, but there appears to be a bug
;; "~a~d values:~:{ ~v:@y~}\n"
- (format (current-error-port) "~a~d values:~{ ~a~}\n"
- (make-string depth #\|)
+ (format (current-error-port) "~a ~a~d values:~{ ~a~}\n"
+ prefix (make-string depth #\|)
nvalues
(map (lambda (val)
(format #f "~v:@y" width val))
(frame-return-values frame)))))))
-(define* (trace-calls-to-procedure proc #:key (width 80) (vm (the-vm)))
+(define* (trace-calls-to-procedure proc #:key (width 80) (vm (the-vm))
+ (prefix "trace: "))
(define (apply-handler frame depth)
- (print-application frame depth width))
+ (print-application frame depth width prefix))
(define (return-handler frame depth)
- (print-return frame depth width))
+ (print-return frame depth width prefix))
(trap-calls-to-procedure proc apply-handler return-handler
#:vm vm))
-(define* (trace-calls-in-procedure proc #:key (width 80) (vm (the-vm)))
+(define* (trace-calls-in-procedure proc #:key (width 80) (vm (the-vm))
+ (prefix "trace: "))
(define (apply-handler frame depth)
- (print-application frame depth width))
+ (print-application frame depth width prefix))
(define (return-handler frame depth)
- (print-return frame depth width))
+ (print-return frame depth width prefix))
(trap-calls-in-dynamic-extent proc apply-handler return-handler
#:vm vm))