GNU bug report logs - #74422
Wrong expected column number while backtracing?

Previous Next

Package: guile;

Reported by: Olivier Dion <odion <at> efficios.com>

Date: Mon, 18 Nov 2024 19:02:02 UTC

Severity: normal

To reply to this bug, email your comments to 74422 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#74422; Package guile. (Mon, 18 Nov 2024 19:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Olivier Dion <odion <at> efficios.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Mon, 18 Nov 2024 19:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Olivier Dion <odion <at> efficios.com>
To: bug-guile <at> gnu.org
Subject: Wrong expected column number while backtracing?
Date: Mon, 18 Nov 2024 14:00:59 -0500
Hi,

Sometime, the printed backtrace from Guile gives wrong column numbers.
This seems to happen when referencing free variables.

Here is a dummy example that represents the problem:
--8<---------------cut here---------------start------------->8---
;; test.scm
(use-modules
 (foo))

(define (main _)
  (foo))

;; foo.scm
(define-module (foo)
  #:use-module (system vm debug)
  #:use-module (system vm frame)
  #:use-module (system vm program)
  #:export (foo))

(define (bar)
  (lambda () (throw 'bar)))

(define (foo)
  (catch #t
    (bar)
    (const #f)
    (lambda _
      (let ((stack (make-stack #t)))
        (let lp ((frame (stack-ref stack 0)))
          (when frame
            (let ((source (frame-source frame)))
              (pk
               (and=> source source:file)
               (and=> source source:line-for-user)
               (and=> source source:column)))
            (lp (frame-previous frame))))))))
--8<---------------cut here---------------end--------------->8---

Then `guile -L . -e main -s test.scm:

;;; note: source file ./foo.scm
;;;       newer than compiled /home/old/.cache/guile/ccache/3.0-LE-8-4.6/home/old/foo.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling ./foo.scm
;;; compiled /home/old/.cache/guile/ccache/3.0-LE-8-4.6/home/old/foo.scm.go

;;; (#f #f #f)

;;; ("foo.scm" 15 20)

;;; ("ice-9/boot-9.scm" 1780 13)

;;; ("ice-9/boot-9.scm" 1685 16)

;;; ("foo.scm" 8 13)

;;; ("ice-9/boot-9.scm" 1752 10)

;;; ("ice-9/boot-9.scm" 1747 15)

;;; ("ice-9/eval.scm" 619 8)

;;; ("ice-9/boot-9.scm" 724 2)

;;; (#f #f #f)

;;; ("ice-9/boot-9.scm" 1752 10)

See how the columns for foo.scm are weird:

foo.scm:15:20:
      (let ((stack (make-stack #t)))
                    ^

foo.scm:8:13:
  (lambda () (throw 'bar)))
             ^

When I would have expected the following:

foo.scm:15:20:
      (let ((stack (make-stack #t)))
                   ^

foo.scm:8:13:
  (lambda () (throw 'bar)))
        ^

Thanks,
Olivier
-- 
Olivier Dion
EfficiOS Inc.
https://www.efficios.com





This bug report was last modified 209 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.