Clojure CDT up, cont, down, local-names throws arity errors after hitting breakpoint

86 views
Skip to first unread message

Sean Neilan

unread,
Feb 8, 2012, 2:11:23 PM2/8/12
to Clojure
Hi All,

I'm using Clojure 1.3.0 with CDT 1.2.6.2 on OSX Lion with Java 1.6.

I want to set a breakpoint on -main on the program to be debugged. So,
run lein repl on this program. It opens up port 8030 successfully.
(This is based off the documentation here: http://georgejahad.com/clojure/cdt.html)
seans-macaroni-book:gslisp seanneilan$ lein repl
Listening for transport dt_socket at address: 8030
REPL started; server listening on localhost port 13575

Then, I start up a new shell in a different project and do this to
attach to the program to be debugged:
seans-macaroni-book:cdt seanneilan$ lein repl
REPL started; server listening on localhost port 57048
user=> (use 'cdt.ui)
nil
user=> (cdt-attach 8030)
nil
user=> CDT ready

It attaches correctly. Then, I set the breakpoint on -main
user=> (set-bp gslisp.core/-main)
bp set on (#<LocationImpl gslisp.core$_main:240>)
nil

Then, in the other shell, I call -main
gslisp.core=> (-main)
which correctly stalls

In the debugger shell, I see
user=> Breakpoint #<BreakpointEventImpl Breakpo...@gslisp.core
$_main:240 in thread Thread-2> hit
CDT location is /Users/seanneilan/BucketsOfNantucket/research/gslisp/
src/gslisp/core.clj:240:0:

But, if I try to type any debugging commands, I get this:
user=> (locals)
ArityException Wrong number of args (0) passed to: reval$locals
clojure.lang.AFn.throwArity (AFn.java:437)
user=> (up)
ArityException Wrong number of args (0) passed to: ui$up
clojure.lang.AFn.throwArity (AFn.java:437)
user=> (down)
ArityException Wrong number of args (0) passed to: ui$down
clojure.lang.AFn.throwArity (AFn.java:437)
user=> (up 1)
ArityException Wrong number of args (1) passed to: ui$up
clojure.lang.AFn.throwArity (AFn.java:437)
user=> (up 0 0)
IllegalArgumentException No matching field found: frames for class
java.lang.Long clojure.lang.Reflector.getInstanceField
(Reflector.java:289)
user=> (print-frames)
ArityException Wrong number of args (0) passed to: ui$print-frames
clojure.lang.AFn.throwArity (AFn.java:437)
user=> (cont)
CompilerException java.lang.RuntimeException: Unable to resolve
symbol: cont in this context, compiling:(NO_SOURCE_PATH:20)

So basically the breakpoint hits but I can't run any debugging
commands.

George Jahad

unread,
Feb 9, 2012, 1:16:21 AM2/9/12
to Clojure
Sorry about that. As you noticed the doc here was out of date:

http://georgejahad.com/clojure/cdt.html

It should be fixed now.

Just for your reference however that doc only describes the command
line version of CDT. If you use Emacs and Swank-clojure, it is much
easier to use swank-cdt, as your UI:

http://georgejahad.com/clojure/swank-cdt.html
> user=> Breakpoint #<BreakpointEventImpl BreakpointEv...@gslisp.core

George Jahad

unread,
Feb 9, 2012, 1:25:03 AM2/9/12
to Clojure

forgot to mention that Hugo Duncan is also working on a debugger which
can
be found here:
https://github.com/pallet/ritz

Sean Corfield

unread,
Feb 9, 2012, 12:18:47 PM2/9/12
to clo...@googlegroups.com
On Wed, Feb 8, 2012 at 10:16 PM, George Jahad
<clo...@blackbirdsystems.net> wrote:
> If you use Emacs and Swank-clojure, it is much
> easier to use swank-cdt, as your UI:
>
> http://georgejahad.com/clojure/swank-cdt.html

I just want to chime in and say swank-clojure 1.4.0 has made this
process so much simpler and it really is a pleasure to work with! I
had a nasty bug in my code the other day and was able to track it down
and fix in "only" about an hour and a half using CDT this way - I
dread to think how long it would have taken with a less integrated
tool chain setup...
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

Sean Neilan

unread,
Feb 9, 2012, 12:34:00 PM2/9/12
to clo...@googlegroups.com
It works! Thank you so much for looking into this! I really appreciate what you have done.

I went through the rest of the documentation and found three other minor misnomers.

One, if you set a breakpoint on a function defined in the repl, you'll have problems. As long as anything you set a breakpoint on is defined in a clojure source file, one should be fine.

Two, set-catch does not appear to take clojure error objects:
user=> (set-catch clojure.lang.ArityException :all)
IllegalArgumentException No reference type found for class clojure.lang.ArityException  cdt.events/set-catch (events.clj:326)
set-catch does take java error objects though. I haven't tested this yet.

Three, locals does not appear to work.
user=> (locals (ct) (cf))
RuntimeException Unreadable form  clojure.lang.Util.runtimeException (Util.java:156)

Thank you again for writing CDT! It is a life saver.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Sean Neilan

unread,
Feb 9, 2012, 12:35:03 PM2/9/12
to clo...@googlegroups.com
I agree. I'm a Vim user currently but with Lisp/Clojure, Emacs is the way to go.

Sean Neilan

unread,
Feb 9, 2012, 12:45:31 PM2/9/12
to clo...@googlegroups.com
There's so much documentation about how to set up emacs with clojure but not a lot of sources saying which documentation works.

Should I trust the readme for swank-clojure, the dev.clojure.org site, the comments on dev.clojure.org, the blog post at technomancy.us/149 or the radically simplified setup here? Or, if I use the readme from swank-clojure, can I trust the part about how swank-clojure is available as an emacs package? (I remember somebody somewhere said it doesn't currently work.) Also, somebody somewhere else said there are issues with swank-clojure 1.4.0 and that I should use 1.3.x instead.

I hope I don't sound annoying.. I just don't know who to follow.

Phil Hagelberg

unread,
Feb 9, 2012, 8:06:19 PM2/9/12
to clo...@googlegroups.com
Sean Neilan <se...@seanneilan.com> writes:

> Should I trust the readme for swank-clojure, the dev.clojure.org
> site, the comments on dev.clojure.org, the blog post at
> technomancy.us/149 or the radically simplified setup here?

The swank-clojure readme should be the most reliable. You may find a
better explanation of how all the pieces fit together elsewhere, but for
swank-clojure itself, trust the readme.

> can I trust the part about how swank-clojure is available as an emacs
> package?

No, that's very old. Where are you seeing it?

> Also, somebody somewhere else said there are issues with swank-clojure
> 1.4.0 and that I should use 1.3.x instead.

Do you remember any details? For a time the 1.4.0-SNAPSHOT was behind on
the elisp payload stuff, but it should be fine now.

-Phil

Sean Neilan

unread,
Feb 9, 2012, 8:38:32 PM2/9/12
to clo...@googlegroups.com
On Thu, Feb 9, 2012 at 7:06 PM, Phil Hagelberg <ph...@hagelb.org> wrote:
Sean Neilan <se...@seanneilan.com> writes:

> Should I trust the readme for swank-clojure, the dev.clojure.org
> site, the comments on dev.clojure.org, the blog post at
> technomancy.us/149 or the radically simplified setup here?

The swank-clojure readme should be the most reliable. You may find a
better explanation of how all the pieces fit together elsewhere, but for
swank-clojure itself, trust the readme.

> can I trust the part about how swank-clojure is available as an emacs
> package?

No, that's very old. Where are you seeing it?
 
It's on the github page at the top.
The emacs packages are mentioned as deprecated here:
I guess I confused the marmelade repo with whatever repo was mentioned in that thread.

I'm sorry, I'm used to really bad documentation in the open source world. If someone says somewhere 
something is not working, my instinct is to take that with a grain of salt even if it's just a random person 
on the internet. I'll give swank-clojure a shot tonight.

Clearly, your software is more polished than I assumed it would be. :)
(based on too much past experience in the open source world.)
 

> Also, somebody somewhere else said there are issues with swank-clojure
> 1.4.0 and that I should use 1.3.x instead.

Do you remember any details? For a time the 1.4.0-SNAPSHOT was behind on
the elisp payload stuff, but it should be fine now.

I can't find it again :( But, it was about how the 1.4.0-SNAPSHOT was behind.

It does say to use 1.3.4 over here:
That's definitely one of the things I got confused on. As a noob, I take dev.clojure.org as g
ospel since it's part of clojure.org.
 

-Phil

Phil Hagelberg

unread,
Feb 9, 2012, 9:20:20 PM2/9/12
to clo...@googlegroups.com
Sean Neilan <se...@seanneilan.com> writes:

> It's on the github page at the top.

Forgive me if I'm slow, but I can't find it. Can you be more specific?

The canonical page for swank-clojure is
https://github.com/technomancy/swank-clojure

Are you talking about instructions for using swank-clojure.el or
something else?

> It does say to use 1.3.4 over here:
> http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
> That's definitely one of the things I got confused on. As a noob, I

> take dev.clojure.org as gospel since it's part of clojure.org.

Yes, that was a bit confusing because development on 1.4.0 was blocked
on getting a stable version of the cdt debugger released, so we went
back to working on 1.3.x for a while. But that's no longer an issue.

-Phil

Sean Neilan

unread,
Feb 9, 2012, 9:27:41 PM2/9/12
to clo...@googlegroups.com
On Thu, Feb 9, 2012 at 8:20 PM, Phil Hagelberg <ph...@hagelb.org> wrote:
Sean Neilan <se...@seanneilan.com> writes:

> It's on the github page at the top.

Forgive me if I'm slow, but I can't find it. Can you be more specific?

The canonical page for swank-clojure is
https://github.com/technomancy/swank-clojure


Sorry about that. Yes, the swank-clojure github page, on the readme under the Usage heading. It says to install.. wait.. nevermind, it says to install clojure-mode from the repo.

OK, that's my bad. I misread directions.
 
Are you talking about instructions for using swank-clojure.el or
something else?

I think I meant for using swank-clojure.el.


> It does say to use 1.3.4 over here:
> http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
> That's definitely one of the things I got confused on. As a noob, I
> take dev.clojure.org as gospel since it's part of clojure.org.

Yes, that was a bit confusing because development on 1.4.0 was blocked
on getting a stable version of the cdt debugger released, so we went
back to working on 1.3.x for a while. But that's no longer an issue.
 

I understand now. There's a lot of information out there still. All the extra info confused me. I now know that the swank-clojure github page is the canonical page.

George Jahad

unread,
Feb 11, 2012, 11:50:12 AM2/11/12
to Clojure
SeanC is referring to is the fact that swank-cdt now works seamlessly
with clojure-jack-in, thanks to the efforts @tavisrudd and the
indefatigable technomancy.


On Feb 9, 9:18 am, Sean Corfield <seancorfi...@gmail.com> wrote:
> On Wed, Feb 8, 2012 at 10:16 PM, George Jahad
>
> <cloj...@blackbirdsystems.net> wrote:
> > If you use Emacs and Swank-clojure, it is much
> > easier to use swank-cdt, as your UI:
>
> >http://georgejahad.com/clojure/swank-cdt.html
>
> I just want to chime in and say swank-clojure 1.4.0 has made this
> process so much simpler and it really is a pleasure to work with! I
> had a nasty bug in my code the other day and was able to track it down
> and fix in "only" about an hour and a half using CDT this way - I
> dread to think how long it would have taken with a less integrated
> tool chain setup...
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View --http://corfield.org/
> World Singles, LLC. --http://worldsingles.com/

Sean Neilan

unread,
Feb 11, 2012, 3:09:56 PM2/11/12
to clo...@googlegroups.com
I know. The church of emacs is becoming more compelling each day.

As a convert from Vim, I have some baggage. I hope that won't be an issue.

Reply all
Reply to author
Forward
0 new messages