Friday, May 11, 2007

An approach I want to try

After I had read the presentation from presenting a way to debug JNI application in Eclipse (see last post for the link), I think that an approach to provide Seamless debugging between JDT and CDT could be the following :
  • Step 0 : the user sets its breakpoints in Java Code and in C code
  • Step 1 : we launch app for remote java code debugging
  • Step 2 : we attach gdb to the application's Java VM with process ID and resume ("release" the JVM) and set " C user breakpoints"
  • Step 3 : we set "default breakpoints" in C/C++ code on each native method called by java code
  • Step 4: we attach jdb
  • Step 5: ready to go !
  • Step 6 : Java breakpoint is hit first. The user steps over until the native call :
- he decides to step into : The default breakpoint is hit in gdb. The user then decides what to do
- he decides to step over : The default breakpoint is hit, but CDI sends a "continue" to the debugger

To proof that is a possible way, I currently a writing a prototype plugin, based on JDT and CDT plugins, which (at this time) uses the following extension :

  • org.eclipse.debug.core.lauchConfigurationTypes
  • org.eclipse.debug.ui.lauchConfigurationTabGroups
  • org.eclipse.debug.ui.lauchConfigurationTypeImages

The main difficulty seems to be the retrieval of the JVM process ID, but I got (Thanks to Mattew) this useful link http://net3x.blogspot.com/2007/03/how-java-application-can-discover-its.html with differents ways to get the PID.

Feel free to comment this approach.

No comments: