Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Clojure with IntelliJ Idea 10 and La Closure Plugin version 0.3.15

I'm using IntelliJ Idea 10 with the La Closure plugin version 0.3.15 and Java 6 I've added Clojure 1.2 to a project.

The breakpoints I put on Java code get hit, but the ones I put on Clojure do not. in fact, if the debugger is stopped on a Java breakpoint, the breakpoints on Clojure code have an x in them and they have a warning that says, for example, No executable code found at line 4 in class at debugland$eval3.

I've tried putting breakpoints in Clojure core functions like println, but I still get the red x's. Would really, really appreciate any help on this. I've tried Idea 9 with both Clojure 1.1 and 1.2 with similar results.

like image 699
hiheelhottie Avatar asked Dec 06 '10 23:12

hiheelhottie


People also ask

What is the last update for the Clojure plugin for IntelliJ?

The last update is available for IntelliJ IDEA 15 (as soon as Cursive Clojure will be available from JetBrains plugin manager, it won't be updated anymore). Clojure plugin for IntelliJ IDEA.

What happened to the La Clojure project?

The project is closed because of Cursive Clojure, which is more stable and feature-rich and it was originally based on La Clojure sources. The last update is available for IntelliJ IDEA 15 (as soon as Cursive Clojure will be available from JetBrains plugin manager, it won't be updated anymore). Clojure plugin for IntelliJ IDEA.

What's new in IntelliJ IDEA 15?

The last update is available for IntelliJ IDEA 15 (as soon as Cursive Clojure will be available from JetBrains plugin manager, it won't be updated anymore). Clojure plugin for IntelliJ IDEA. Provides Clojure language support: syntax and error highlighting, completion, navigation and refactorings.

How do I start a Clojure project in Eclipse?

Press the Restart IDE button when it appears. Download and extract the Clojure SDK files . In the welcome screen select the Create New Project option. From the New Project window, select the Clojure option from the left panel, then select Bare project from the middle panel, and finally press the Next button.


2 Answers

I'm using Clojure 1.3 (built from github sources), LaClojure 0.3.74, and Sun Java 6u24 running on IDEA 10.0.3. My breakpoints seem to work as advertised (getting checkmarks in red dots), although you will get x's on breakpoints at non-evaluative code such as [] vs. function_name[]. For example:

(ns clojure.examples.hello (:gen-class))  (defn hello          <---- Get check breakpoints here.   []                 <---- Get x breakpoints here, can't eval [] but hello[] is okay!!!   (let [a 12         b (/ a 2)    <---- Get check breakpoints here.         c (* b 3)]     (if (< b a)       (println (str b "<" a))      <---- Get check breakpoints here.       (println (str a "<" b))))) 

You might want to upgrade to the latest version of IDEA/LaClojure (Java 6uX and Clojure 1.2 should work fine), make sure IDEA knows where to find your clojure jars and which jdk to use (sounds like you know how to config a usable IDEA setup, so you're good there), and make sure you have bp's only in expressions that can be evaluated.

like image 106
Marc Avatar answered Oct 22 '22 11:10

Marc


I believe what is happening is that Clojure is creating jvm primitives that Idea's debugger does not understand. This coud mean the the primitives are not the size or type that Idea normally recognizes. See here and here.

This likely can be fixed by making a catalog of the structures/primitives that Clojure uses when writing it's virtual machine code and switching to that when debugging Clojure. Unfortunately, this also means that you may have to wait for IntelliJ to fix the problem.

I've posted the question to Jetbrains Tech Support.

like image 27
Albert Perrien Avatar answered Oct 22 '22 09:10

Albert Perrien