GNU bug report logs - #11215
[feature request] better backtraces

Previous Next

Package: guile;

Reported by: Ian Price <ianprice90 <at> googlemail.com>

Date: Tue, 10 Apr 2012 23:14:02 UTC

Severity: wishlist

Full log


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

From: Ian Price <ianprice90 <at> googlemail.com>
To: bug-guile <at> gnu.org
Subject: [feature request] better backtraces
Date: Wed, 11 Apr 2012 00:11:31 +0100
This is more of a feature request/reminder, than a bug report, but we
don't have a wish list so,....


Tail calls, we all love them, but sometimes they conflict with error
handling, and is often used as the scapegoat for why $language doesn't
support them.

shizzy0 posted the following example and output to the #guile IRC channel

(define (g)
  (error "This is broken because ~a" 1))
(g)

;; $ guile -q --debug test-error.scm 
;; Backtrace:
;; In ice-9/boot-9.scm:
;;  149: 10 [catch #t #<catch-closure 101303d80> ...]
;;  157: 9 [#<procedure 10129e190 ()>]
;; In unknown file:
;;    ?: 8 [catch-closure]
;; In ice-9/boot-9.scm:
;;   63: 7 [call-with-prompt prompt0 ...]
;; In ice-9/eval.scm:
;;  407: 6 [eval # #]
;; In ice-9/boot-9.scm:
;; 2111: 5 [save-module-excursion #<procedure 1012a2100 at ice-9/boot-9.scm:3646:3 ()>]
;; 3653: 4 [#<procedure 1012a2100 at ice-9/boot-9.scm:3646:3 ()>]
;; 1380: 3 [%start-stack load-stack ...]
;; 1385: 2 [#<procedure 10133cc90 ()>]
;; In unknown file:
;;    ?: 1 [primitive-load "/Users/shane/School/uvm/CSYS-395-evolutionary-robotics/bullet-2.79/Demos/GuileDemo/test-error.scm"]
;;    ?: 0 [scm-error misc-error #f "~A ~S" ("This is broken because ~a" 1) #f]
;;
;; ERROR: In procedure scm-error:
;; ERROR: This is broken because ~a 1

One issue was that he wasn't auto compiling guile code, but there are
two tail calls here. One is the obvious one, in g. And the other, which
surprised me, was with respect to the main program itself. Thus we get
the limited backtrace in an unknown file.

It is possible to provide full backtraces, and source location for error
messages with tail calls, though it's usually more work and requires
overhead, but it's something to think about for the --debug engine at
least.

It would also be nice as a specific counterexample of an implementation
in practice for all the tail call naysayers. :)

-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"





This bug report was last modified 12 years and 347 days ago.

Previous Next


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