[Openmcl-devel] extracting values of variables

slepstein at mindspring.com slepstein at mindspring.com
Sat Jun 27 14:49:36 PDT 2009


My problem is trying to manipulate values in the break. (Inspection is clear.) For example, how would I go about multiplying the values of the two slots during the break? And thank you for helping!

? (defclass bar () ((slot-1 :initarg :slot-1 :initform 1 :accessor slot-1) 
                    (slot-2 :initarg :slot-2 :initform 2 :accessor slot-2)))
#<STANDARD-CLASS BAR>
? (setf foo (make-instance 'bar))
#<BAR #x300041BBFE8D>
? (describe foo)
#<BAR #x300041BBFE8D>
Class: #<STANDARD-CLASS BAR>
Wrapper: #<CCL::CLASS-WRAPPER BAR #x300041B0E94D>
Instance slots
SLOT-1: 1
SLOT-2: 2
? (defun baz (x) (print (+ (slot-1 x) (slot-2 x))) (break))
BAZ
? (baz foo)

3 
> Break: 
> While executing: BAZ, in process Listener(6).
> Type :GO to continue, :POP to abort, :R for a list of available restarts.
> If continued: Return from BREAK.
> Type :? for other options.
1 > (:arg x 0)
#<BAR #x300041B154DD>

1 > (slot-1 (:arg x  0))
> Error: Unbound variable: X
> While executing: CCL::CHEAP-EVAL-IN-ENVIRONMENT, in process Listener(6).
> Type :GO to continue, :POP to abort, :R for a list of available restarts.
> If continued: Retry getting the value of X.
> Type :? for other options.

1 > (:apply-in-frame 0 slot-1)
> Error: Too few arguments in call to #<STANDARD-GENERIC-FUNCTION SLOT-1 #x300041B0DD9F>:
>        0 arguments provided, at least 1 required. 
> While executing: SLOT-1, in process Listener(6).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.

1 > (:apply-in-frame 0 slot-1 x)
> Error: Fault during read of memory address #x10
> While executing: (X), in process Listener(6).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.


-----Original Message-----
>From: Stas Boukarev <stassats at gmail.com>
>Sent: Jun 27, 2009 1:10 AM
>To: slepstein at mindspring.com
>Cc: openmcl-devel at clozure.com
>Subject: Re: [Openmcl-devel] extracting values of variables
>
>On Sat, Jun 27, 2009 at 8:30 AM, <slepstein at mindspring.com> wrote:
>> I'm still a Clozure newbie and what I need most is to debug in the breaks. Some of the interface is intuitive and great, but in MCL I could use (local #) to the Listener in a break to access and then manipulate values.  The documentation suggests that I should be able to get values of arguments and of local variables, but it doesn't work consistently. I've attached a copy of the top of a backtrace window.
>
>Here's what I get:
>? (defun foo (a) (let ((a (+ 10 a))) (break) a))
>FOO
>? (foo 10)
>> Break:
>> While executing: FOO, in process listener(1).
>> Type :GO to continue, :POP to abort, :R for a list of available restarts.
>> If continued: Return from BREAK.
>> Type :? for other options.
>1 > (:ARG A 0)
>10
>1 > (:LOCAL A 0)
>20
>1 > (:V 0 0)
>10
>1 > (:V 1 0)
>20
>
>
>-- 
>With best regards, Stas.




More information about the Openmcl-devel mailing list