From: Olivier Dion <odion@efficios.com>
To: 74422@debbugs.gnu.org
Subject: bug#74422: Wrong expected column number while backtracing?
Date: Mon, 18 Nov 2024 14:00:59 -0500 [thread overview]
Message-ID: <87ldxg4b9w.fsf@laura> (raw)
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
reply other threads:[~2024-11-18 19:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ldxg4b9w.fsf@laura \
--to=odion@efficios.com \
--cc=74422@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).