Line number and source file names in stack trace, part 1

From: Michael Hohn <hohn_at_math.utah.edu>
Date: Wed, 22 Dec 1999 22:52:51 -0700 (MST)

Hello all,

I have added some extra debug information to the STk internals; here
is a short summary of my progress (and a problem)

Using the files
/tmp/td.scm :
    ;; Test debugging facilities.
    
    (set! *debug* #t)
    
    (load "/tmp/td1.scm")
    
    (define (thi n)
      (+ 2
         3
         (bar n)))
    
    
    (define (bomb x)
      (+ 1.0
         (sqrt
          (sin x))))
    
    (bomb 3.14) ; real
    (bomb 3.15) ; complex
    
    (thi 10) ; ok
    (thi 'a) ; type error
    
and
/tmp/td1.scm :
    (define (foo n)
      (+ n 2))
      
    (define (bar n)
      (* n
         n
         (foo n)))
        
with a modified version of Snow, I now get this:
    
> sh test-snow
    Welcome to the STk interpreter version 4.0.1 [Linux-2.X-ix86]
    Copyright 1993-1999 Erick Gallesio - I3S - CNRS / ESSI <eg_at_unice.fr>
    STk> (load "/tmp/td.scm")
    *** Error at line 19 of file /tmp/td.scm:
        sqrt: number is negative: -0.00840724736714862
    Current eval stack:
    Stack Line File Name Expression
    __________________________________________________
        0 15 /tmp/td.scm (sqrt (sin x))
        1 14 /tmp/td.scm (+ 1.0 (sqrt (sin x)))
        2 1 (load "/tmp/td.scm")
    STk> (thi 'a)
    *** Error:
        *: not a number: a
    Current eval stack:
    Stack Line File Name Expression
    __________________________________________________
        0 5 /tmp/td1.scm (* n n (foo n))
        1 8 /tmp/td.scm (+ 2 3 (bar n))
    STk>
        
Using STk, it is
> sh test-stk
    Welcome to the STk interpreter version 4.0.1 [Linux-2.X-ix86]
    Copyright 1993-1999 Erick Gallesio - I3S - CNRS / ESSI <eg_at_unice.fr>
    STk> (load "/tmp/td.scm")
    
    *** Error at line 19 of file /tmp/td.scm:
    sqrt: number is negative: -0.00840724736714862
    STk>
    [stk window:
    File: /tmp/td.scm Line: 15 (sqrt (sin x))
    File: /tmp/td.scm Line: 14 (+ 1.0 (sqrt (sin x)))
    File: #[unbound] Line: 1 (load "/tmp/td.scm")
    ]

So far, so good. But for the second part:
    STk> (thi 'a)
    
    *** Error:
    *: not a number: a
    STk>
    [stk window:
    File: #[unknown 19 40217838] Line: 5 (* n n (foo n))
    File: #[unknown 19 40217770] Line: 8 (+ 2 3 (bar n))
    ]

I don't have a good understanding of the STk internals; can somebody
(Erick?) point out the flaws in my added code?
Or just fix it :)

The context diffs are in my next message; they apply to the above version
of STk via
        patch -p0 < stk-dbg-patch

Since there are changes in the SCM structure, full recompilation of at
least ./Src and ./Snow is needed.

Cheers,
        Michael
Received on Thu Dec 23 1999 - 07:53:13 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST