Jump to: navigation, search

Difference between revisions of "Support seamless debugging between JDT and CDT"

(FAQ)
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Student: Mariot Chauvin (IRC: moksha_anderson)
+
Student: Mariot Chauvin (IRC: mchv)
  
 
Mentors: Philippe Ombredanne (IRC: pombreda), Francois Granade (IRC: farialima)
 
Mentors: Philippe Ombredanne (IRC: pombreda), Francois Granade (IRC: farialima)
Line 8: Line 8:
 
==Introduction==
 
==Introduction==
  
Eclipse is an extensible framework to build modular applications, which relies on OSGi component architecture. Originally developed to provide an IDE extensible in terms of functionalities and supported languages with plugins, Eclipse can now be used as a Rich Client Platform ([[RCP]]). The success of the Java Development Toolkit ([[JDT]]) plugin has leaded the development of numerous plugins. For instance the C/C++ Development Toolkit ([[CDT]]) plugin allows developers to use it as IDE for project in C or C++ language. The use of Eclipse as a generic IDE is possible due to the notion of perspective (a perspective corresponds to a certain disposition of the graphical elements) which adapts the user interface to the kind of project.
+
Eclipse is an extensible framework to build modular applications, which relies on OSGi component architecture. Originally developed to provide an IDE extensible in terms of functionalities and supported languages with plugins, Eclipse can now be used as a Rich Client Platform ([[RCP]]). The success of the Java Development Toolkit ([[JDT]]) plugin has lead to the development of numerous plugins. For instance the C/C++ Development Toolkit ([[CDT]]) plugin allows developers to use it as IDE for project in C or C++ language. The use of Eclipse as a generic IDE is possible due to the notion of perspective (a perspective corresponds to a certain disposition of the graphical elements) which adapts the user interface to the kind of project.
  
 
Java Native Interface (JNI) is a programming interface to call native methods or to embed java virtual machine in native applications. JNI is often used to interact with existing native application, to add platform-specific functions, or to improve time-performance (by supposing native methods faster than java code).  
 
Java Native Interface (JNI) is a programming interface to call native methods or to embed java virtual machine in native applications. JNI is often used to interact with existing native application, to add platform-specific functions, or to improve time-performance (by supposing native methods faster than java code).  
Line 21: Line 21:
 
== Work done ==  
 
== Work done ==  
  
===First step===
+
===First step : documentation of existing work===
* documentation :
+
* Approaches for debugging Java and native code in Eclipse and new debug interface proposal (XDI)
**http://developers.sun.com/learning/javaoneonline/2006/tools/TS-1011.pdf
+
**[http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/cdt-home/presentations/spring2006/debugger_for_eclipse.ppt?cvsroot=Tools_Project Mixed mode debugger, JDT/CDT projects (Vitaly Provodin - Intel)]
**http://www.kineteksystems.com/white-papers/mixedjavaandc.html
+
**[http://www.eclipsecon.org/2007/index.php?page=sub/&id=4129 Mixed mode debugger prototype presentation]
**http://www-128.ibm.com/developerworks/java/library/j-jnidebug/index.html?dwzone=java
+
* Debugging Java and C/C++ code
 +
**[http://www-128.ibm.com/developerworks/java/library/j-jnidebug/index.html?dwzone=java Debugging integrated Java and C/C++ code]
 +
**[http://developers.sun.com/learning/javaoneonline/2006/tools/TS-1011.pdf Debugging integrated in Eclipse]
 +
**[http://www.kineteksystems.com/white-papers/mixedjavaandc.html Java and C/C++ JNI Application Debugging with GUI]
 +
 
 +
===Second step : prototype===
 +
* work on a prototype which
 +
** launch a Java Debugger
 +
** attach a C debugger to the JVM
 +
** allow you to debug C/C++ code and Java code debugging in the same view
 +
 
 +
* code is available on svn
 +
** svn co https://eclipse-incub.svn.sourceforge.net/svnroot/eclipse-incub/org.eclipse.soc.jni org.eclipse.soc.jni
 +
 
 +
===Third step : tests and debugging===
 +
* a first version is available to download (see below):
 +
** creation of JUnit tests
 +
** bugs hunt
 +
** advertisement and feedback from community
 +
 
  
 
==Roadmap==
 
==Roadmap==
* until May 28 : Announce the project and check the existing work (see [http://cdtdoug.blogspot.com/2006/09/jdtcdt-cant-we-just-get-along.html]). Get feedback from [[CDT]] and [[JDT]] community and discuss with them about the project  
+
 
* until beginning or mid of August : Implement the work on perspectives first and then the native method calls follow-up
+
* 0.0.4 - not yet planned
* Integration and tests with the help of the Eclipse community
+
** jvm started in native code debugging
 +
** see how to integrate in eclipse CDT ?
 +
 
 +
* EclipseCon 2008
 +
 
 +
http://www.eclipsecon.org/2008/index.php?page=sub/&id=105
 +
 
 +
==Documentation==
 +
 
 +
===How to install the plug-in ?===
 +
 
 +
The most simple is to use the update manager of Eclipse.
 +
Simply add this site as "new remote site" :
 +
 
 +
http://eclipse-incub.svn.sourceforge.net/viewvc/*checkout*/eclipse-incub/org.eclipse.soc.jni/update-site/site.xml
 +
 
 +
The sources are included in the Jar, but you can get them on the subversion repository:
 +
 
 +
https://eclipse-incub.svn.sourceforge.net/svnroot/eclipse-incub/org.eclipse.soc.jni
 +
 
 +
( You may have to install the subclipe plug-in )
 +
 
 +
===How to use the plug-in ?===
 +
 
 +
You should have some java code which uses JNI and the native code associated. The plug-in should be installed.
 +
 
 +
====First step====
 +
Set a breakpoint in the Java code after the code which loads the native library.
 +
 
 +
[[Image:Soc_jni_J_breakpoint.png|frame|center]]
 +
 
 +
====Second step====
 +
Open the debug dialog and create a new configuration of "Java JNI Application" kind.
 +
 
 +
[[Image:Soc_jni_Config_group.png|frame|center]]
 +
 
 +
====Third step====
 +
Set the correct settings for each tab.
 +
 
 +
*C/C++ project tab
 +
*: Set the C/C++ project and specify the javaw path as C/C++ application.
 +
[[Image:Soc_jni_Config_tab_c_main.png|frame|center]]
 +
 
 +
* Java project tab
 +
*:Set the Java project and the main class.
 +
[[Image:Soc_jni_Config_tab_j_main.png|frame|center]]
 +
 
 +
*Environment tab
 +
*:On linux machines you could have to add the current directory to the library path environment variable.
 +
[[Image:Soc_jni_Config_tab_environment.png|frame|center]]
 +
 
 +
 
 +
====Fourth step====
 +
The debug perspective will be launched with the 2 debuggers. Ready to debug !
 +
[[Image:Soc_jni_Debug_perspective.png|frame|center]]
 +
 
 +
===How to report a bug/ask for an enhancement ?===
 +
 
 +
On the eclipse bugzilla there is a "org.eclipse.soc.jni" component for the "SOC" product in the "Technology" category. Please include the version of the plug-in and the maximum infos you can obtain.
 +
 
 +
==FAQ==
 +
 
 +
* What is the supported eclipse version ?
 +
 
 +
only eclipse 3.3 is supported for the moment.
 +
 
 +
* Is the project still maintained ?
 +
 
 +
No, I have currently no time to maintain it. All code and documentation are available on svn, wiki and blog.
 +
Do not hesitate to contact me if you need further information.
 +
 
 +
* What is the current version of the plug-in ?
 +
 
 +
0.0.3
 +
 
 +
* What are the known bugs of the plug-in ?
 +
 
 +
[https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&classification=Technology&product=SOC&component=org.eclipse.soc.jni&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&status_whiteboard_type=allwordssubstr&status_whiteboard=&keywords_type=allwords&keywords=&op_sys=All&emailtype1=substring&email1=&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&known_name=soc.jni+bugs&query_based_on=soc.jni+bugs&field0-0-0=noop&type0-0-0=noop&value0-0-0= all bugs]
 +
[https://bugs.eclipse.org/bugs/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&classification=Technology&product=SOC&component=org.eclipse.soc.jni&long_desc_type=allwordssubstr&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&status_whiteboard_type=allwordssubstr&status_whiteboard=&keywords_type=allwords&keywords=&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=VERIFIED&op_sys=All&emailtype1=substring&email1=&emailtype2=substring&email2=&bugidtype=include&bug_id=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&known_name=soc.jni+bugs&query_based_on=soc.jni+bugs&field0-0-0=noop&type0-0-0=noop&value0-0-0= open bugs]
 +
 
 +
[[Category:SOC]]

Latest revision as of 10:43, 30 December 2008

Student: Mariot Chauvin (IRC: mchv)

Mentors: Philippe Ombredanne (IRC: pombreda), Francois Granade (IRC: farialima)

This project is part of the Google Summer of Code 2007


Introduction

Eclipse is an extensible framework to build modular applications, which relies on OSGi component architecture. Originally developed to provide an IDE extensible in terms of functionalities and supported languages with plugins, Eclipse can now be used as a Rich Client Platform (RCP). The success of the Java Development Toolkit (JDT) plugin has lead to the development of numerous plugins. For instance the C/C++ Development Toolkit (CDT) plugin allows developers to use it as IDE for project in C or C++ language. The use of Eclipse as a generic IDE is possible due to the notion of perspective (a perspective corresponds to a certain disposition of the graphical elements) which adapts the user interface to the kind of project.

Java Native Interface (JNI) is a programming interface to call native methods or to embed java virtual machine in native applications. JNI is often used to interact with existing native application, to add platform-specific functions, or to improve time-performance (by supposing native methods faster than java code).

Currently, when users work on a java project using JNI and native code, they have to switch between perspective, which is not practical. Another point to improve is the debugging of this kind of project, by allowing developers to follow native method calls into native code and go back.

Goals of the project

  • Create new or 'mixed' perspectives to manage project using C/C++ and Java
  • Add the possibility to follow native methods calls into native code

Work done

First step : documentation of existing work

Second step : prototype

  • work on a prototype which
    • launch a Java Debugger
    • attach a C debugger to the JVM
    • allow you to debug C/C++ code and Java code debugging in the same view

Third step : tests and debugging

  • a first version is available to download (see below):
    • creation of JUnit tests
    • bugs hunt
    • advertisement and feedback from community


Roadmap

  • 0.0.4 - not yet planned
    • jvm started in native code debugging
    • see how to integrate in eclipse CDT ?
  • EclipseCon 2008

http://www.eclipsecon.org/2008/index.php?page=sub/&id=105

Documentation

How to install the plug-in ?

The most simple is to use the update manager of Eclipse. Simply add this site as "new remote site" :

http://eclipse-incub.svn.sourceforge.net/viewvc/*checkout*/eclipse-incub/org.eclipse.soc.jni/update-site/site.xml

The sources are included in the Jar, but you can get them on the subversion repository:

https://eclipse-incub.svn.sourceforge.net/svnroot/eclipse-incub/org.eclipse.soc.jni

( You may have to install the subclipe plug-in )

How to use the plug-in ?

You should have some java code which uses JNI and the native code associated. The plug-in should be installed.

First step

Set a breakpoint in the Java code after the code which loads the native library.

Soc jni J breakpoint.png

Second step

Open the debug dialog and create a new configuration of "Java JNI Application" kind.

Soc jni Config group.png

Third step

Set the correct settings for each tab.

  • C/C++ project tab
    Set the C/C++ project and specify the javaw path as C/C++ application.
  • Java project tab
    Set the Java project and the main class.
Soc jni Config tab j main.png
  • Environment tab
    On linux machines you could have to add the current directory to the library path environment variable.


Fourth step

The debug perspective will be launched with the 2 debuggers. Ready to debug !

Soc jni Debug perspective.png

How to report a bug/ask for an enhancement ?

On the eclipse bugzilla there is a "org.eclipse.soc.jni" component for the "SOC" product in the "Technology" category. Please include the version of the plug-in and the maximum infos you can obtain.

FAQ

  • What is the supported eclipse version ?

only eclipse 3.3 is supported for the moment.

  • Is the project still maintained ?

No, I have currently no time to maintain it. All code and documentation are available on svn, wiki and blog. Do not hesitate to contact me if you need further information.

  • What is the current version of the plug-in ?

0.0.3

  • What are the known bugs of the plug-in ?

all bugs open bugs