This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: How to enable a backtrace report?
On 15 Apr 2000 19:17:36 +0200 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
wrote:
> Diego Dainese <ddainese@dsi.unive.it> writes:
>
> > I'm a newbie: I would like to enable backtrace report when running
> > non-interactive scripts (using the -s option); as far as I can tell
> >
> > (debug-enable 'backtrace)
> >
> > works only when guile is started in interactive mode.
> >
> > Thanks in advance,
>
> You're asking a very relevant question. There should of course be a
> command line option for this. I'll see if I can add such an option
> to Guile later tonight.
>
Thanks a lot.
> Meanwhile: The reason why you don't get a backtrace is that scripts
> normally run the "normal" (fast) evaluator. In order to get a
> backtrace, you should enable the debugging evalutor. You can enable
> both options, by placeing the following line in your script:
>
> (debug-enable 'debug 'backtrace)
>
It doesn't work for me; I've made a little test, here is the script:
---------------------- test.scm --------------------
(debug-enable 'debug 'backtrace)
(read-enable 'positions)
(define (f x) (x))
(define (y) z)
(f y)
---------------------- test.scm --------------------
Here is the output of guile -s:
----------------------------------------------------
$ guile -s test.scm
test.scm:4:15: In procedure y in expression (x):
test.scm:4:15: Unbound variable: z
$
----------------------------------------------------
And here is the output from the interactive mode:
----------------------------------------------------
$ guile
guile> (debug-enable 'backtrace)
(stack 20000 debug backtrace depth 20 maxdepth 1000 frames 3 indent 10 width 79 procnames cheap)
guile> (define (f x) (x))
guile> (define (y) z)
guile> (f y)
Backtrace:
0* [f #<procedure y ()>]
1 [y]
standard input:2:15: In procedure y in expression (x):
standard input:2:15: Unbound variable: z
ABORT: (misc-error)
guile> ^D
$
----------------------------------------------------
I'm running guile 1.3.4. Any clue?
Bye,
--
Diego Dainese