From: ·······@ziplip.com
Subject: Debugging in CMUCL
Date: 
Message-ID: <JYGNMHMPENFSKHPUH2MEFVN2L4DQOLCPMMCAHYOC@ziplip.com>
If I have a function MAIN that looks like this:

(defun main ()
  (let ((local-variable 
     ;;;;;
     ;; body ))

and some bug happens while MAIN is somewhere on the stack, I can
not view LOCAL-VARIABLE from the CMUCL debugger (It's invalid) 
Are there Lisps that will let me do it? Does lexical scoping have
anything to do with it?

From: Mario S. Mommer
Subject: Re: Debugging in CMUCL
Date: 
Message-ID: <fzfzk4myxo.fsf@cupid.igpm.rwth-aachen.de>
········@ziplip.com" <·······@ziplip.com> writes:
> If I have a function MAIN that looks like this:
> 
> (defun main ()
>   (let ((local-variable 
>      ;;;;;
>      ;; body ))
> 
> and some bug happens while MAIN is somewhere on the stack, I can
> not view LOCAL-VARIABLE from the CMUCL debugger (It's invalid) 
> Are there Lisps that will let me do it?

cmucl can do that, but you have to put

  (declare (optimize (debug 3)))

before the let.
From: Rolf Wester
Subject: Re: Debugging in CMUCL
Date: 
Message-ID: <bhfoie$k5f$1@nets3.rz.RWTH-Aachen.DE>
Mario S. Mommer wrote:
> ········@ziplip.com" <·······@ziplip.com> writes:
> 
>>If I have a function MAIN that looks like this:
>>
>>(defun main ()
>>  (let ((local-variable 
>>     ;;;;;
>>     ;; body ))
>>
>>and some bug happens while MAIN is somewhere on the stack, I can
>>not view LOCAL-VARIABLE from the CMUCL debugger (It's invalid) 
>>Are there Lisps that will let me do it?
> 
> 
> cmucl can do that, but you have to put
> 
>   (declare (optimize (debug 3)))
> 
> before the let.
Isn't this the default value?

By the way is there any way to get information about the location within
the function where the error occured?
From: Raymond Toy
Subject: Re: Debugging in CMUCL
Date: 
Message-ID: <4n1xvo9za7.fsf@edgedsp4.rtp.ericsson.se>
>>>>> "Rolf" == Rolf Wester <······@ilt.fraunhofer.de> writes:

    Rolf> Mario S. Mommer wrote:
    >> ········@ziplip.com" <·······@ziplip.com> writes:
    >> 
    >>> If I have a function MAIN that looks like this:
    >>> 
    >>> (defun main ()
    >>> (let ((local-variable     ;;;;;
    >>> ;; body ))
    >>> 
    >>> and some bug happens while MAIN is somewhere on the stack, I can
    >>> not view LOCAL-VARIABLE from the CMUCL debugger (It's invalid) Are
    >>> there Lisps that will let me do it?
    >> cmucl can do that, but you have to put
    >> (declare (optimize (debug 3)))
    >> before the let.
    Rolf> Isn't this the default value?

    Rolf> By the way is there any way to get information about the location within
    Rolf> the function where the error occured?

If you get to the debugger, then usually SOURCE will print out the
source line where the error occurred.  But you probably already knew
that and were asking for something else?

Ray
From: Rolf Wester
Subject: Re: Debugging in CMUCL
Date: 
Message-ID: <bhg3ii$2vs$1@nets3.rz.RWTH-Aachen.DE>
Raymond Toy wrote:
> 
>     Rolf> By the way is there any way to get information about the location within
>     Rolf> the function where the error occured?
> 
> If you get to the debugger, then usually SOURCE will print out the
> source line where the error occurred.  But you probably already knew
> that and were asking for something else?
> 
I admit I should have known this but, I didn't (reading the manual more 
carefully would have helped I guess). Thank you for your answer.
From: Rob Warnock
Subject: Re: Debugging in CMUCL
Date: 
Message-ID: <ag2dnQUHZbzreaGiXTWc-g@speakeasy.net>
Raymond Toy  <···@rtp.ericsson.se> wrote:
+---------------
| >>>>> "Rolf" == Rolf Wester <······@ilt.fraunhofer.de> writes:
|     Rolf> By the way is there any way to get information about the
|     Rolf> location within the function where the error occured?
| 
| If you get to the debugger, then usually SOURCE will print out the
| source line where the error occurred.
+---------------

To my taste, CMUCL's VSO debugger command, generally with
an argument of 3 (or sometimes larger) tends to give a better
display, e.g.:

	cmu> (defun foo ()
	       (let ((local-variable 17))
	         (break)
	         (1+ local-variable)))
	cmu> (foo)

	Break

	Restarts:
	  0: [CONTINUE] Return from BREAK.
	  1: [ABORT   ] Return to Top-Level.

	Debug  (type H for help)

	(FOO)
	Source: (BREAK)
	0] l
	LOCAL-VARIABLE  =  17

	0] vso 3

	(LAMBDA ()
	  (BLOCK FOO
	    (LET ((LOCAL-VARIABLE 17))
	      (#:***HERE*** (BREAK))
	      (1+ LOCAL-VARIABLE))))
	0] (setf local-variable 43)

	43
	0] continue

	44
	cmu> 


-Rob

-----
Rob Warnock, PP-ASEL-IA		<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Thomas F. Burdick
Subject: Re: Debugging in CMUCL
Date: 
Message-ID: <xcv8ypwunct.fsf@famine.OCF.Berkeley.EDU>
Rolf Wester <······@ilt.fraunhofer.de> writes:

> Mario S. Mommer wrote:
> > ········@ziplip.com" <·······@ziplip.com> writes:
> > 
> >>If I have a function MAIN that looks like this:
> >>
> >>(defun main ()
> >>  (let ((local-variable 
> >>     ;;;;;
> >>     ;; body ))
> >>
> >>and some bug happens while MAIN is somewhere on the stack, I can
> >>not view LOCAL-VARIABLE from the CMUCL debugger (It's invalid) 
> >>Are there Lisps that will let me do it?
> > 
> > 
> > cmucl can do that, but you have to put
> > 
> >   (declare (optimize (debug 3)))
> > 
> > before the let.
>
> Isn't this the default value?

Nope, by default everything is 1, except for debug, which is 2.


-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'                               
From: Kalle Olavi Niemitalo
Subject: Re: Debugging in CMUCL
Date: 
Message-ID: <87znia7rut.fsf@Astalo.kon.iki.fi>
···@famine.OCF.Berkeley.EDU (Thomas F. Burdick) writes:

> Nope, by default everything is 1, except for debug, which is 2.

How can I check the current optimization levels (i.e. what was
last proclaimed) and the levels with which a specific function
was compiled?
From: Eric Marsden
Subject: Re: Debugging in CMUCL
Date: 
Message-ID: <wzi3cfnearr.fsf@melbourne.laas.fr>
>>>>> "kon" == Kalle Olavi Niemitalo <···@iki.fi> writes:

  kon> How can I check the current optimization levels (i.e. what was
  kon> last proclaimed) and the levels with which a specific function
  kon> was compiled?

in CMUCL, the current optimization level is stored in the variable
C::*DEFAULT-COOKIE* (which is difficult to guess using apropos).
Information regarding the optimization level that was used when a
function was compiled isn't saved anywhere, AFAIK, though you may be
able to infer some policy settings (eg speed > safety) if you're
familiar with CMUCL by reading the function's disassembly.

It would be useful to add something like ACL's function
EXPLAIN-COMPILER-SETTINGS; this might be an interesting project for
someone looking to contribute to CMUCL, since it wouldn't require a
rebuild to implement.
  

[Late reply on return from vacation]

-- 
Eric Marsden                          <URL:http://www.laas.fr/~emarsden/>
From: Janis Dzerins
Subject: Re: Debugging in CMUCL
Date: 
Message-ID: <twkptj837fj.fsf@gulbis.latnet.lv>
Mario S. Mommer <········@yahoo.com> writes:

> ········@ziplip.com" <·······@ziplip.com> writes:
> > If I have a function MAIN that looks like this:
> > 
> > (defun main ()
> >   (let ((local-variable 
> >      ;;;;;
> >      ;; body ))
> > 
> > and some bug happens while MAIN is somewhere on the stack, I can
> > not view LOCAL-VARIABLE from the CMUCL debugger (It's invalid) 
> > Are there Lisps that will let me do it?
> 
> cmucl can do that, but you have to put
> 
>   (declare (optimize (debug 3)))
> 
> before the let.

Or run the function uncompiled.

-- 
Janis Dzerins

  If million people say a stupid thing, it's still a stupid thing.