Tuesday, June 19, 2007

Project status

Work done

  • Creation of a new plug-in : the plug-in adds a "JNI Application" group in the "Debug Dialog"
  • When we launch a debug session :
    • The JVM is lauched and Java internal debugger of Eclipse connects to it
    • The PID of the lauched JVM is found
    • The C debugger is attached to the launched JVM process (it works with gdb, I dont know if others debuggers offer this possibility )
  • The debug perspective is open and we could see the 2 debuggers launched


versions used : eclipse SDK 3.3 RC4 and CDT 4.0 RC3
os : GNU/linux on a ppc processor
java version min: 1.5 (I think I will change to 1.4)

getting the svn code : svn co https://eclipse-incub.svn.sourceforge.net/svnroot/eclipse-incub/jni_seamless_debugging jni_seamless_debugging

  • First step : you have to install the plugin. If you are here, I am sure you know how to do it.
  • Second step : you have to create a Java Application which uses JNI.
  • Third step : set a breakpoint in the Java code after the code which loads the native library

  • Fourth step : set a breakpoint in the C code in the begin of a native method

  • Fifth step : Open the debug dialog and create a new configuration of "Java JNI Application" kind

    In the tabs you have to configure the Java and C project, and specify the javaw path as C/C++ application. On linux machines you could have to add the current directory in the library path environment variable

    Then click on debug
  • Sixth step : the debug perspective will be launched, with the 2 debuggers.

  • Seventh step : Resume the JVM process (right click on "gdb/mi") and start debugging !


It makes 3 weeks that I am working on C source files visualisation. I spend too much time on this, and don't find why it doesn't work.

To resume :

  • I have created a JMLSourceLookupDirector
  • I have added CParticipant and JavaParticipant
  • I have created a JMLSourcePathComputer which contains a JavaSourcePathComputer and a CDelegate.For the computeSourceContainers() method I only merge results obtained from JavaSourcePathComputer and CDelegate computeSourceContainers() methods. I checked with the debugger, and it works well.

When I try to debug a JNI Application with my plug-in, the JVM is launched, gdb is attached and the code stop on the first breakpoint in the Java Code. Then I debug step by step until the native call.
When I arrive to the breakpoint in the C code, it stops well, but the Editor doesn't display the file.

Of course the path is correct and the directory is in the source path.

Any idea or comment is welcome