This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Debugging in guile


>>>>> "Ian" == Ian Bicking <ian@bickiia.earlhall.earlham.edu> writes:

Ian> Is there a way to inspect the backtrace? 

Yes, but you will need to experiment a bit, as the debugger interface
documentataion is, ehh, suboptimal. But the debugging potential of
guile is probably one of its strongest features.

There is a section in the manual listing the usefull functions. The
node is `Stacks and Frames'. Unfortunately, they isn't much
explanation, but I have a few hints, from my own playing around with
it.

First you need a stack, which you can get with `make-stack'. This
takes a bunch of parameters that I do not understand, but doing

	(define s (make-stack #t))

works.

>From a stack, you can extract frames using `stack-ref'. 

	(stack-ref s 0)

should return the top-most fram (I think).

Having a frame, there is a bunch of functions that inspect it, such as
`frame-arguments':

	(frame-arguments f)

which could be what you are looking for.

So the strategy is to capture a stack at a relevant spot and inspect
it for the needed information. 

You could also browse through ice-9 which has some hints to how the
default REPL interfaces to the debugging system.


---------------------------+--------------------------------------------------
Christian Lynbech          | Telebit Communications A/S                       
Fax:   +45 8628 8186       | Fabrik 11, DK-8260 Viby J
Phone: +45 8628 8177 + 28  | email: chl@tbit.dk --- URL: http://www.telebit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)