1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

Avoid 'frame-local-ref' errors when printing backtrace.

Workaround for <https://bugs.gnu.org/57948>.

* module/system/vm/frame.scm (frame-call-representation): Treat a
binding as "unspecified" if its slot exceeds 'frame-num-locals'.
This commit is contained in:
Andrew Whatson 2022-09-20 17:23:58 +10:00 committed by Daniel Llorens
parent 02f69c1d84
commit c7fa78fc75

View file

@ -381,8 +381,16 @@
(frame-local-ref frame i 'scm)) (frame-local-ref frame i 'scm))
((find-slot i bindings) ((find-slot i bindings)
=> (lambda (binding) => (lambda (binding)
(let ((val (frame-local-ref frame (binding-slot binding) (let* ((slot (binding-slot binding))
(binding-representation binding)))) ;; HACK: Avoid out-of-range from frame-local-ref.
;; Some frames have bindings beyond nlocals. That
;; is probably a bug somewhere else, but at least
;; this workaround allows them to be printed.
(val (if (< slot nlocals)
(frame-local-ref frame slot
(binding-representation binding))
;; else #<unspecified>
)))
;; It could be that there's a value that isn't clobbered ;; It could be that there's a value that isn't clobbered
;; by a call but that isn't live after a call either. In ;; by a call but that isn't live after a call either. In
;; that case, if GC runs during the call, the value will ;; that case, if GC runs during the call, the value will