Can't debug groovy

Hello:

I'm using Intellij 10.0.2.  

Not able to get the debugger to stop in a groovy script that has break points.

The related property in the IDE Settings- Debugger.groovy (Do not step into specific groovy classes) is not checked.


Any ideas on how to diagnose this problem?

Lee

8 comments
Comment actions Permalink

Is the script run as it should? Is it located under a source root? Is it compiled, does a corresponding .class-file exist in the output directory? Could you please post a screenshot of the breakpoint while the script is running?

0
Comment actions Permalink
Hello Peter:


I have tried to run some simplified code to isolate the problem.


Overview.  I have a driver.java class with a main method.  The main method
calls MyGroovy.groovy class.  The MyGroovy method called sayHello prints a message and returns.



I  have tried to set a breakpoint in the sayHello method in the groovy  class. The program ignores the breakpoint and runs to successful  completion.


I have also tried to set a  breakpoint in the driver.java program.  The program stops at this break  point.  I am also able to then step into the groovy class if I start  from the java program.


Do this give you any insights into the underlying problem?


My classes are listed below.
*********************************************************

package standalone

/**
* Created by IntelliJ IDEA.
* User: ltchalupa
* Date: 3/7/11
* Time: 8:21 AM
* To change this template use File | Settings | File Templates.
*/
class MyGroovy {

    public void sayHello () {
        println("Hello. This is My Groovy saying hello");
    }
}


***************************************************************


package standalone;

/**
* Created by IntelliJ IDEA.
* User: ltchalupa
* Date: 3/7/11
* Time: 8:19 AM
* To change this template use File | Settings | File Templates.
*/
public class Driver {

    public static void main(String[] args) {
        System.out.println("Starting Driver Class");

        MyGroovy myGroovy = new MyGroovy();
        myGroovy.sayHello();
        System.out.println("Ending Driver Class");
    }
}


*************************************************************************************


Lee Chalupa,

0
Comment actions Permalink

Is the script run as it should?  I think so.

Is it located under a source root?  yes.

Is it  compiled, does a corresponding .class-file exist in the output  directory?  yes.

Could you please post a screenshot of the breakpoint while  the script is running?  print screen not working...



0
Comment actions Permalink

Your example works for me. Could you please at least describe how the Groovy breakpoint icon looks during the program run (better when standing on another breakpoint, at the "Ending Driver Class" line). Is it crossed, marked as OK, does it have a tooltip?

Which Groovy version are you using?

0
Comment actions Permalink

I had the screen shots ready to go to you but then I decided to try one other test.

I found the problem.

I switched from the jrockit jvm to the sun jvm.

jrockit-jdk1.5.0-24-28
Java/jdk1.5.0_22

I was then able to debug the MyGroovy script.

We have reproduced the solution using Groovy 1.7.8
or Groovy 1.6.9.  Problem doesn't seem to be related to the
version of groovy we are using.  The problem is related to the JVM
we are using.  The problem has something to do with how intellij is working with
JRockit.

I'd like to know what if anything you can do with these findings so I can
update our development team on what to expect going forward.  For now, as a workaround, we can run
the Sun jdk but this is only an interim solution because we are using JRockit in
production.

Thank you for your help.


Lee Chalupa

0
Comment actions Permalink

Could you please add the following line to bin/idea.properties:

enable.groovy.hotswap=false

After that restart IDEA and see if it helps

0
Comment actions Permalink

Hello, I think I'm having the same problem.
1. breakpoint in groovy code is not hit
2. I could step into groovy code from a breakpoint in java code
3. my team is using jrockit

but the last suggestion on enable.groovy.hotswap=false does not seem to work.

are there other possible solutions?

0
Comment actions Permalink

I reproduced the problem. Unfortunately it seems that it's either a problem of the way groovyc generates code, or JRockit VM itself. IDEA interoperates with the VM as per spec, but the VM just doesn't notify us that breakpoints have been hit. And the best workaround I can suggest is to use HotSpot VM for debugging, or put breakpoints in Java code. You may also want to file a bug to Groovy developers.

0

Please sign in to leave a comment.