Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to step through code in common lisp?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Yves S. Garret  
View profile  
 More options Sep 30 2012, 6:56 pm
Newsgroups: comp.lang.lisp
From: "Yves S. Garret" <yoursurrogate...@gmail.com>
Date: Sun, 30 Sep 2012 15:56:41 -0700 (PDT)
Local: Sun, Sep 30 2012 6:56 pm
Subject: How to step through code in common lisp?
Hello,

   I went through the following tutorial in the bottom link:
http://www.cliki.net/TutorialClispDebugger

It's all well and good, but I remember in my gdb days where I could step through the code and examine all of the variables as I went through each function.  Maybe I missed it in the above tutorial, but how could I do this?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Benjamin Kreuter  
View profile  
 More options Sep 30 2012, 9:51 pm
Newsgroups: comp.lang.lisp
From: Benjamin Kreuter <brk...@virginia.edu>
Date: Sun, 30 Sep 2012 21:50:42 -0400
Local: Sun, Sep 30 2012 9:50 pm
Subject: Re: How to step through code in common lisp?
On Sun, 30 Sep 2012 15:56:41 -0700 (PDT)
"Yves S. Garret" <yoursurrogate...@gmail.com> wrote:

> Hello,

>    I went through the following tutorial in the bottom link:
> http://www.cliki.net/TutorialClispDebugger

> It's all well and good, but I remember in my gdb days where I could
> step through the code and examine all of the variables as I went
> through each function.  Maybe I missed it in the above tutorial, but
> how could I do this?

There is "step" in the standard.  I use sbcl and not clisp, but just as
an example:

* (declaim (optimize (debug 3) (speed 0)))

* (defun fact (x) (if (= x 1) 1 (* x (fact (1- x)))))

FACT
* (step (fact 5))
; Evaluating call:
;   (FACT 5)
; With arguments:
;   5

1] step
; Evaluating call:
;   (- X 1)
; With unknown arguments

0] next
; Evaluating call:
;   (FACT (1- X))
; With arguments:
;   4

1] list-locals
X  =  5

Check the clisp documentation for information about how to do it
there...

-- Ben

--
Benjamin R Kreuter
UVA Computer Science
brk...@virginia.edu
KK4FJZ

--

"If large numbers of people are interested in freedom of speech, there
will be freedom of speech, even if the law forbids it; if public
opinion is sluggish, inconvenient minorities will be persecuted, even
if laws exist to protect them." - George Orwell


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nils M Holm  
View profile  
 More options Oct 1 2012, 1:56 am
Newsgroups: comp.lang.lisp
From: Nils M Holm <news2...@t3x.org>
Date: 1 Oct 2012 05:56:27 GMT
Local: Mon, Oct 1 2012 1:56 am
Subject: Re: How to step through code in common lisp?
Yves S. Garret <yoursurrogate...@gmail.com> wrote:

> It's all well and good, but I remember in my gdb days where I
> could step through the code and examine all of the variables as I
> went through each function.  Maybe I missed it in the above tutorial,
> but how could I do this?

Never underestimate the value of a few strategic PRINT expressions.
While a debugger is certainly useful, I rarely find myself in a
position where I actually need one.

--
Nils M Holm  < n m h @ t 3 x . o r g >  www.t3x.org


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Oct 1 2012, 6:54 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Mon, 01 Oct 2012 12:54:01 +0200
Local: Mon, Oct 1 2012 6:54 am
Subject: Re: How to step through code in common lisp?

Unfortunately, ccl doesn't implement CL:STEP.
Fortunately, there's an implementation independant  cl-stepper  in:
https://gitorious.org/com-informatimago/com-informatimago/trees/maste...

cl-user> (ql:quickload :com.informatimago.common-lisp.lisp.stepper)
To load "com.informatimago.common-lisp.lisp.stepper":
  Load 1 ASDF system:
    com.informatimago.common-lisp.lisp.stepper
; Loading "com.informatimago.common-lisp.lisp.stepper"
[package com.informatimago.common-lisp.lisp.stepper.internal]
[package com.informatimago.common-lisp.lisp.stepper].
......
(:com.informatimago.common-lisp.lisp.stepper)
cl-user> (defpackage :test (:use :cl-stepper))
#<package "TEST">
cl-user> (in-package :test)
#<package "TEST">
test> (defun fact (x) (if (= x 1) 1 (* x (fact (1- x)))))
fact
test> (step (fact 5))
(Will evaluate (fact 5)
 Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (fact 5)
 (Will evaluate 5
  Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

  (--> 5))
 (Entering function fact
   (Bind x                to 5)
  Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

  (Will evaluate (if (= x 1) 1 (* x (fact #)))
   Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (if (= x 1) 1 (* x (fact #)))
   (Will evaluate (= x 1)
    Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (= x 1)
    (Will evaluate x
     Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

     (x ==> 5))
    (Will evaluate 1
     Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

     (--> 1))
    Evaluation of (= x 1) returned one result ==> nil)
   (Will evaluate (* x (fact (1- x)))
    Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (* x (fact (1- x)))
    (Will evaluate x
     Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

     (x ==> 5))
    (Will evaluate (fact (1- x))
     Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (fact (1- x))
     (Will evaluate (1- x)
      Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (1- x)
      (Will evaluate x
       Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

       (x ==> 5))
      Evaluation of (1- x) returned one result ==> 4)
     (Entering function fact
       (Bind x                to 4)
      Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

      (Will evaluate (if (= x 1) 1 (* x (fact #)))
       Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (if (= x 1) 1 (* x (fact #)))
       (Will evaluate (= x 1)
        Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (= x 1)
        (Will evaluate x
         Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

         (x ==> 4))
        (Will evaluate 1
         Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

         (--> 1))
        Evaluation of (= x 1) returned one result ==> nil)
       (Will evaluate (* x (fact (1- x)))
        Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (* x (fact (1- x)))
        (Will evaluate x
         Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

         (x ==> 4))
        (Will evaluate (fact (1- x))
         Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (fact (1- x))
         (Will evaluate (1- x)
          Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s
Will evaluate (1- x)
          (Will evaluate x
           Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

           (x ==> 4))
          Evaluation of (1- x) returned one result ==> 3)
         (Entering function fact
           (Bind x                to 3)
          Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?s

          (Will evaluate (if (= x 1) 1 (* x (fact #)))
           Step Into (s, si, RET), Step over (so), Trace (t), Function (f), Run (r), Debugger (d), Abort (a, q)?t
Will evaluate (if (= x 1) 1 (* x (fact #)))
           (Will evaluate (= x 1)
            (x ==> 3)
            Evaluation of (= x 1) returned one result ==> nil)
           (Will evaluate (* x (fact (1- x)))
            (x ==> 3)
            (Will evaluate (fact (1- x))
             (Will evaluate (1- x)
              (x ==> 3)
              Evaluation of (1- x) returned one result ==> 2)
             (Entering function fact
               (Bind x                to 2)
              (Will evaluate (if (= x 1) 1 (* x (fact #)))
               (Will evaluate (= x 1)
                (x ==> 2)
                Evaluation of (= x 1) returned one result ==> nil)
               (Will evaluate (* x (fact (1- x)))
                (x ==> 2)
                (Will evaluate (fact (1- x))
                 (Will evaluate (1- x)
                  (x ==> 2)
                  Evaluation of (1- x) returned one result ==> 1)
                 (Entering function fact
                   (Bind x                to 1)
                  (Will evaluate (if (= x 1) 1 (* x (fact #)))
                   (Will evaluate (= x 1)
                    (x ==> 1)
                    Evaluation of (= x 1) returned one result ==> t)
                   Evaluation of (if (= x 1) 1 (* x (fact #))) returned one result ==> 1)
                  Exiting  function fact returned one result ==> 1)
                 Evaluation of (fact (1- x)) returned one result ==> 1)
                Evaluation of (* x (fact (1- x))) returned one result ==> 2)
               Evaluation of (if (= x 1) 1 (* x (fact #))) returned one result ==> 2)
              Exiting  function fact returned one result ==> 2)
             Evaluation of (fact (1- x)) returned one result ==> 2)
            Evaluation of (* x (fact (1- x))) returned one result ==> 6)
           Evaluation of (if (= x 1) 1 (* x (fact #))) returned one result ==> 6)
          Exiting  function fact returned one result ==> 6)
         Evaluation of (fact (1- x)) returned one result ==> 6)
        Evaluation of (* x (fact (1- x))) returned one result ==> 24)
       Evaluation of (if (= x 1) 1 (* x (fact #))) returned one result ==> 24)
      Exiting  function fact returned one result ==> 24)
     Evaluation of (fact (1- x)) returned one result ==> 24)
    Evaluation of (* x (fact (1- x))) returned one result ==> 120)
   Evaluation of (if (= x 1) 1 (* x (fact #))) returned one result ==> 120)
  Exiting  function fact returned one result ==> 120)
 Evaluation of (fact 5) returned one result ==> 120)
120
test>

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yves S. Garret  
View profile  
 More options Oct 1 2012, 10:58 am
Newsgroups: comp.lang.lisp
From: "Yves S. Garret" <yoursurrogate...@gmail.com>
Date: Mon, 1 Oct 2012 07:58:08 -0700 (PDT)
Local: Mon, Oct 1 2012 10:58 am
Subject: Re: How to step through code in common lisp?

informatimago, how would you actually load those libraries?  I got the repository for that:

$ git clone git://gitorious.org/com-informatimago/com-informatimago.git
Cloning into 'com-informatimago'...
remote: Counting objects: 3029, done.
remote: Compressing objects: 100% (2070/2070), done.
Receiving objectsremote: Total 3029 (delta 2154), reused 1450 (delta 916)
Receiving objects: 100% (3029/3029),
...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Oct 1 2012, 11:44 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Mon, 01 Oct 2012 17:44:39 +0200
Local: Mon, Oct 1 2012 11:44 am
Subject: Re: How to step through code in common lisp?
"Yves S. Garret" <yoursurrogate...@gmail.com> writes:

> informatimago, how would you actually load those libraries?  I got the repository for that:

I told you:

>> cl-user> (ql:quickload :com.informatimago.common-lisp.lisp.stepper)
> $ git clone git://gitorious.org/com-informatimago/com-informatimago.git
> Cloning into 'com-informatimago'...
> remote: Counting objects: 3029, done.
> remote: Compressing objects: 100% (2070/2070), done.
> Receiving objectsremote: Total 3029 (delta 2154), reused 1450 (delta 916)
> Receiving objects: 100% (3029/3029), 2.87 MiB | 593 KiB/s, done.
> Resolving deltas: 100% (2154/2154), done.
> Checking out files: 100% (421/421), done.

> Now, how can I get common lisp to "see" this library so that I can use it?

Now, since I may commit new features or bug corrections at any time, and
since quicklisp only updates once a month, you may want to clone the
repository directly until next month.  In that case, do it in
~/quicklisp/local-projects and keep using the quickload form above.

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yves S. Garret  
View profile  
 More options Oct 1 2012, 2:11 pm
Newsgroups: comp.lang.lisp
From: "Yves S. Garret" <yoursurrogate...@gmail.com>
Date: Mon, 1 Oct 2012 11:11:01 -0700 (PDT)
Local: Mon, Oct 1 2012 2:11 pm
Subject: Re: How to step through code in common lisp?

Right, but how does quickload know where those libraries are located?

This is what I tried and the result that I got:

[1]> (ql:quickload :com.informatimago.common-lisp.lisp.stepper)

*** - READ from #<INPUT CONCATENATED-STREAM #<INPUT STRING-INPUT-STREAM> #<IO TERMINAL-STREAM>>: there is no package with name "QL"
The following restarts are available:
ABORT          :R1      Abort main loop
Break 1 [2]>

I don't really understand how to do this.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yves S. Garret  
View profile  
 More options Oct 1 2012, 2:21 pm
Newsgroups: comp.lang.lisp
From: "Yves S. Garret" <yoursurrogate...@gmail.com>
Date: Mon, 1 Oct 2012 11:21:06 -0700 (PDT)
Local: Mon, Oct 1 2012 2:21 pm
Subject: Re: How to step through code in common lisp?

Durr, quicklisp, just got it installed, am playing with it now.  Will get back to you on my progress.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Oct 1 2012, 2:44 pm
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Mon, 01 Oct 2012 20:44:52 +0200
Local: Mon, Oct 1 2012 2:44 pm
Subject: Re: How to step through code in common lisp?
"Yves S. Garret" <yoursurrogate...@gmail.com> writes:

> Right, but how does quickload know where those libraries are located?

Yes, it does.

> This is what I tried and the result that I got:

> [1]> (ql:quickload :com.informatimago.common-lisp.lisp.stepper)

> *** - READ from #<INPUT CONCATENATED-STREAM #<INPUT STRING-INPUT-STREAM> #<IO TERMINAL-STREAM>>: there is no package with name "QL"
> The following restarts are available:
> ABORT          :R1      Abort main loop
> Break 1 [2]>

> I don't really understand how to do this.

http://quicklisp.org

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yves S. Garret  
View profile  
 More options Oct 2 2012, 8:53 am
Newsgroups: comp.lang.lisp
From: "Yves S. Garret" <yoursurrogate...@gmail.com>
Date: Tue, 2 Oct 2012 05:53:28 -0700 (PDT)
Local: Tues, Oct 2 2012 8:53 am
Subject: Re: How to step through code in common lisp?

Hi informatimago, I tried what you showed me to do and it worked wonderfully.  There is one problem though, after I finished stepping through the program, I was stuck at this:

test>

I couldn't do (quit) or use my declared functions in .clisprc.lisp (located in my home directory), how do I get out of this state?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Oct 2 2012, 9:15 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Tue, 02 Oct 2012 15:15:11 +0200
Local: Tues, Oct 2 2012 9:15 am
Subject: Re: How to step through code in common lisp?
"Yves S. Garret" <yoursurrogate...@gmail.com> writes:

> Hi informatimago, I tried what you showed me to do and it worked
> wonderfully.  There is one problem though, after I finished stepping
> through the program, I was stuck at this:

> test>

> I couldn't do (quit) or use my declared functions in .clisprc.lisp
> (located in my home directory), how do I get out of this state?

The prompt in slime gives the name (or part of the name) of the current
package.

In clisp, the COMMON-LISP-USER package uses the EXT package which
exports a QUIT function.

So you have the choice between changing the current package to a package
where "quit" would be read as the symbol EXT:QUIT, or calling that
directly:

    test> (ext:quit)

or:

    test> (in-package :cl-user)
    cl-user> (quit)

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal J. Bourguignon  
View profile  
 More options Oct 2 2012, 9:18 am
Newsgroups: comp.lang.lisp
From: "Pascal J. Bourguignon" <p...@informatimago.com>
Date: Tue, 02 Oct 2012 15:18:40 +0200
Local: Tues, Oct 2 2012 9:18 am
Subject: Re: How to step through code in common lisp?
"Pascal J. Bourguignon" <p...@informatimago.com> writes:

or of couse, you can use the package where the wanted symbols are, or
import them:

      test> (use-package :ext)
      test> (quit)

or:
      test> (import 'ext:quit)
      test> (quit)

--
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »