You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Ivan Popov <iv...@gmail.com> on 2007/04/20 12:05:26 UTC

[jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

I'd like to start discussion about JPDA (Java Platform Debug
Architecture [1]) support in Harmony. JPDA is de-facto standard for
Java debug interface and is used by most Java debuggers. JPDA
specification [2] is included into J2SE docs (but not in the core API
spec) and is implemented in all commercial JDKs.

Harmony already implements two underlying JPDA layers - JVMTI and
JDWP, but it misses implementation of the high layer - JDI (Java Debug
Interface [2]), which is used directly by Java debuggers. Currently,
Harmony works well with Eclipse debugger, because Eclipse uses its own
JDI implementation. But other Java debuggers (e.g., in Netbeans,
JBuilder, and Idea IDEs) won't work with Harmony, because it lacks
JDI. Netbeans 5.5 started on Harmony JDK produces several complains
about missed JDI and disables all modules related to debugging. I'm
not sure if Java TCK checks for JDI API, as it looks like optional
component, but having JDI implementation may also facilitate passing
TCK.

The easiest way to implement JDI in Harmony is to adapt existing JDI
implementation from Eclipse, as was already done for Eclipse Java
compiler. I don't think there are any legal issues here and this looks
easy from technical perspective.

JDI implementation is included into Eclipse JDT runtime bundle,
available on Eclipse download page [3]. JDI-related jars can be
extracted and used separately from other Eclipse stuff. Adding them to
Harmony JDK will provide Harmony with JDI implementation and enable
Java debuggers other than Eclipse.

If nobody objects to this approach I volunteer to work on technical
details and provide required patches.

Thanks.
Ivan Popov
Intel Enterprise Solutions Software Division

[1] http://java.sun.com/javase/technologies/core/toolsapis/jpda/
[2] http://java.sun.com/j2se/1.5.0/docs/guide/jpda/index.html
[3] http://download.eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Ivan Popov <iv...@gmail.com>.
I've attached patches for adapting JDI implementation to HARMONY-3210.
Can anybody apply them?

This JDI implementation supports running NetBeans debugger and JDB
demo. There are a few remaining problems with JDI implementation, I'll
fix them separately. Also, I'm going to create a couple of unit tests
for JDI implementation to verify integration and monitor regressions.

Thanks.
Ivan

On 4/26/07, Ivan Popov <iv...@gmail.com> wrote:
> For (4) I've submitted bug to Eclipse and attached patch:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=184211
>
> Thanks.
> Ivan
>
> On 4/24/07, Ivan Popov <iv...@gmail.com> wrote:
> > I've run several experiments with JDI implementation from Eclipse and
> > was able to use it for running JDB debugger demo and Netbeans
> > debugger. However, there are several issues that should be solved.
> >
> > 1. Eclipse 3.0 provides quite independent JDI implementation, one can
> > use two separate jars from JDT runtime bundle:
> >
> >   jdi.jar - JDI API interfaces
> >   jdimodel.jar - JDI implementation
> >
> > But it corresponds to 1.4 and works not stable with Netbeans debugger,
> > so it is not the case.
> >
> > 2. In the newer Eclipse 3.2 and 3.3 JDI implementation corresponds to
> > 1.5 and works well with both JDB and Netbeans (except of a few issues
> > mentioned below). Unfortunately, it introduces dependencies on two
> > additional jars (for formatting error messages and NLS support):
> >
> >   com.ibm.icu.base_3.6.0.20061215.jar - from com.ibm.icu.base bundle
> >   org.eclipse.osgi_3.3.0.v20070321.jar - from RCP Runtime Binary bundle
> >
> > The first one is quite small and independent bundle available from
> > Eclipse download site and I think it's OK to add it to Harmony
> > together with JDI jars. For the second one an easy stub can be
> > implemented to eliminate this dependency.
> >
> > 3. All Java debuggers expect that JDI API is located in
> > JDK/lib/tools.jar and implicitly add it to classpath when debugger is
> > started. This means we need to repackage all classes from Eclipse's
> > jdi.jar to Harmony's tools.jar. I don't like this solution, but it
> > seems the only possible one. I hope there are no legal issues with
> > such repackage. All other jars can be added separately and loaded with
> > special class loader, similar to what is already implemented for
> > Eclipse compiler jar.
> >
> > 4. There are a few bugs in implementation of JDI connectors which
> > throw NPE when are used in JDB and Netbeans debuggers. I fixed this in
> > my experiments and fix is rather simple. I can submit bug to Eclipse
> > and attach this fix. I hope Eclipse folks can apply it quickly.
> >
> > If nobody objects I will proceed with items 2-4.
> >
> > Thanks.
> > Ivan
> >
>

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Ivan Popov <iv...@gmail.com>.
For (4) I've submitted bug to Eclipse and attached patch:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=184211

Thanks.
Ivan

On 4/24/07, Ivan Popov <iv...@gmail.com> wrote:
> I've run several experiments with JDI implementation from Eclipse and
> was able to use it for running JDB debugger demo and Netbeans
> debugger. However, there are several issues that should be solved.
>
> 1. Eclipse 3.0 provides quite independent JDI implementation, one can
> use two separate jars from JDT runtime bundle:
>
>   jdi.jar - JDI API interfaces
>   jdimodel.jar - JDI implementation
>
> But it corresponds to 1.4 and works not stable with Netbeans debugger,
> so it is not the case.
>
> 2. In the newer Eclipse 3.2 and 3.3 JDI implementation corresponds to
> 1.5 and works well with both JDB and Netbeans (except of a few issues
> mentioned below). Unfortunately, it introduces dependencies on two
> additional jars (for formatting error messages and NLS support):
>
>   com.ibm.icu.base_3.6.0.20061215.jar - from com.ibm.icu.base bundle
>   org.eclipse.osgi_3.3.0.v20070321.jar - from RCP Runtime Binary bundle
>
> The first one is quite small and independent bundle available from
> Eclipse download site and I think it's OK to add it to Harmony
> together with JDI jars. For the second one an easy stub can be
> implemented to eliminate this dependency.
>
> 3. All Java debuggers expect that JDI API is located in
> JDK/lib/tools.jar and implicitly add it to classpath when debugger is
> started. This means we need to repackage all classes from Eclipse's
> jdi.jar to Harmony's tools.jar. I don't like this solution, but it
> seems the only possible one. I hope there are no legal issues with
> such repackage. All other jars can be added separately and loaded with
> special class loader, similar to what is already implemented for
> Eclipse compiler jar.
>
> 4. There are a few bugs in implementation of JDI connectors which
> throw NPE when are used in JDB and Netbeans debuggers. I fixed this in
> my experiments and fix is rather simple. I can submit bug to Eclipse
> and attach this fix. I hope Eclipse folks can apply it quickly.
>
> If nobody objects I will proceed with items 2-4.
>
> Thanks.
> Ivan
>

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Ivan Popov <iv...@gmail.com>.
> What if we provide dummy tools.jar with other jars referenced via
> Class-Path attribute of manifest?

I'm not sure this will help, but I'll try it.

Thanks.
Ivan

On 4/24/07, Alexey Varlamov <al...@gmail.com> wrote:
> 2007/4/24, Ivan Popov <iv...@gmail.com>:
> > I've run several experiments with JDI implementation from Eclipse and
> > was able to use it for running JDB debugger demo and Netbeans
> > debugger. However, there are several issues that should be solved.
> >
> > 1. Eclipse 3.0 provides quite independent JDI implementation, one can
> > use two separate jars from JDT runtime bundle:
> >
> >  jdi.jar - JDI API interfaces
> >  jdimodel.jar - JDI implementation
> >
> > But it corresponds to 1.4 and works not stable with Netbeans debugger,
> > so it is not the case.
> >
> > 2. In the newer Eclipse 3.2 and 3.3 JDI implementation corresponds to
> > 1.5 and works well with both JDB and Netbeans (except of a few issues
> > mentioned below). Unfortunately, it introduces dependencies on two
> > additional jars (for formatting error messages and NLS support):
> >
> >  com.ibm.icu.base_3.6.0.20061215.jar - from com.ibm.icu.base bundle
> >  org.eclipse.osgi_3.3.0.v20070321.jar - from RCP Runtime Binary bundle
> >
> > The first one is quite small and independent bundle available from
> > Eclipse download site and I think it's OK to add it to Harmony
> > together with JDI jars. For the second one an easy stub can be
> > implemented to eliminate this dependency.
> >
> > 3. All Java debuggers expect that JDI API is located in
> > JDK/lib/tools.jar and implicitly add it to classpath when debugger is
> > started. This means we need to repackage all classes from Eclipse's
> > jdi.jar to Harmony's tools.jar. I don't like this solution, but it
> > seems the only possible one. I hope there are no legal issues with
> > such repackage. All other jars can be added separately and loaded with
> > special class loader, similar to what is already implemented for
> > Eclipse compiler jar.
>
> What if we provide dummy tools.jar with other jars referenced via
> Class-Path attribute of manifest?
>
> >
> > 4. There are a few bugs in implementation of JDI connectors which
> > throw NPE when are used in JDB and Netbeans debuggers. I fixed this in
> > my experiments and fix is rather simple. I can submit bug to Eclipse
> > and attach this fix. I hope Eclipse folks can apply it quickly.
> >
> > If nobody objects I will proceed with items 2-4.
> >
> > Thanks.
> > Ivan
> >
>

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Alexey Varlamov <al...@gmail.com>.
2007/4/24, Ivan Popov <iv...@gmail.com>:
> I've run several experiments with JDI implementation from Eclipse and
> was able to use it for running JDB debugger demo and Netbeans
> debugger. However, there are several issues that should be solved.
>
> 1. Eclipse 3.0 provides quite independent JDI implementation, one can
> use two separate jars from JDT runtime bundle:
>
>  jdi.jar - JDI API interfaces
>  jdimodel.jar - JDI implementation
>
> But it corresponds to 1.4 and works not stable with Netbeans debugger,
> so it is not the case.
>
> 2. In the newer Eclipse 3.2 and 3.3 JDI implementation corresponds to
> 1.5 and works well with both JDB and Netbeans (except of a few issues
> mentioned below). Unfortunately, it introduces dependencies on two
> additional jars (for formatting error messages and NLS support):
>
>  com.ibm.icu.base_3.6.0.20061215.jar - from com.ibm.icu.base bundle
>  org.eclipse.osgi_3.3.0.v20070321.jar - from RCP Runtime Binary bundle
>
> The first one is quite small and independent bundle available from
> Eclipse download site and I think it's OK to add it to Harmony
> together with JDI jars. For the second one an easy stub can be
> implemented to eliminate this dependency.
>
> 3. All Java debuggers expect that JDI API is located in
> JDK/lib/tools.jar and implicitly add it to classpath when debugger is
> started. This means we need to repackage all classes from Eclipse's
> jdi.jar to Harmony's tools.jar. I don't like this solution, but it
> seems the only possible one. I hope there are no legal issues with
> such repackage. All other jars can be added separately and loaded with
> special class loader, similar to what is already implemented for
> Eclipse compiler jar.

What if we provide dummy tools.jar with other jars referenced via
Class-Path attribute of manifest?

>
> 4. There are a few bugs in implementation of JDI connectors which
> throw NPE when are used in JDB and Netbeans debuggers. I fixed this in
> my experiments and fix is rather simple. I can submit bug to Eclipse
> and attach this fix. I hope Eclipse folks can apply it quickly.
>
> If nobody objects I will proceed with items 2-4.
>
> Thanks.
> Ivan
>

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Alexey Varlamov <al...@gmail.com>.
2007/4/24, Ivan Popov <iv...@gmail.com>:
> I've run several experiments with JDI implementation from Eclipse and
> was able to use it for running JDB debugger demo and Netbeans
> debugger. However, there are several issues that should be solved.
>
> 1. Eclipse 3.0 provides quite independent JDI implementation, one can
> use two separate jars from JDT runtime bundle:
>
>  jdi.jar - JDI API interfaces
>  jdimodel.jar - JDI implementation
>
> But it corresponds to 1.4 and works not stable with Netbeans debugger,
> so it is not the case.
>
> 2. In the newer Eclipse 3.2 and 3.3 JDI implementation corresponds to
> 1.5 and works well with both JDB and Netbeans (except of a few issues
> mentioned below). Unfortunately, it introduces dependencies on two
> additional jars (for formatting error messages and NLS support):
>
>  com.ibm.icu.base_3.6.0.20061215.jar - from com.ibm.icu.base bundle
>  org.eclipse.osgi_3.3.0.v20070321.jar - from RCP Runtime Binary bundle
>
> The first one is quite small and independent bundle available from
> Eclipse download site and I think it's OK to add it to Harmony
> together with JDI jars. For the second one an easy stub can be
> implemented to eliminate this dependency.
>
> 3. All Java debuggers expect that JDI API is located in
> JDK/lib/tools.jar and implicitly add it to classpath when debugger is
> started. This means we need to repackage all classes from Eclipse's
> jdi.jar to Harmony's tools.jar. I don't like this solution, but it
> seems the only possible one. I hope there are no legal issues with
> such repackage. All other jars can be added separately and loaded with
> special class loader, similar to what is already implemented for
> Eclipse compiler jar.
>
> 4. There are a few bugs in implementation of JDI connectors which
> throw NPE when are used in JDB and Netbeans debuggers. I fixed this in
> my experiments and fix is rather simple. I can submit bug to Eclipse
> and attach this fix. I hope Eclipse folks can apply it quickly.
>
> If nobody objects I will proceed with items 2-4.

And yes, your effort is very much appreciated ;)


>
> Thanks.
> Ivan
>

RE: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by "Zakharov, Vasily M" <va...@intel.com>.
Ivan,

Thank you very much for your endeavour, we really need JDI to get
NetBeans working.
It's great to hear the Eclipse implementation fits this gap.

Thank you!

Vasily


-----Original Message-----
From: Ivan Popov [mailto:ivan.g.popov@gmail.com] 
Sent: Tuesday, April 24, 2007 9:56 AM
To: dev@harmony.apache.org
Subject: Re: [jdktools][jpda] Adapt Eclipse JDI implementation to
complete JPDA support in Harmony

I've run several experiments with JDI implementation from Eclipse and
was able to use it for running JDB debugger demo and Netbeans
debugger. However, there are several issues that should be solved.

1. Eclipse 3.0 provides quite independent JDI implementation, one can
use two separate jars from JDT runtime bundle:

  jdi.jar - JDI API interfaces
  jdimodel.jar - JDI implementation

But it corresponds to 1.4 and works not stable with Netbeans debugger,
so it is not the case.

2. In the newer Eclipse 3.2 and 3.3 JDI implementation corresponds to
1.5 and works well with both JDB and Netbeans (except of a few issues
mentioned below). Unfortunately, it introduces dependencies on two
additional jars (for formatting error messages and NLS support):

  com.ibm.icu.base_3.6.0.20061215.jar - from com.ibm.icu.base bundle
  org.eclipse.osgi_3.3.0.v20070321.jar - from RCP Runtime Binary bundle

The first one is quite small and independent bundle available from
Eclipse download site and I think it's OK to add it to Harmony
together with JDI jars. For the second one an easy stub can be
implemented to eliminate this dependency.

3. All Java debuggers expect that JDI API is located in
JDK/lib/tools.jar and implicitly add it to classpath when debugger is
started. This means we need to repackage all classes from Eclipse's
jdi.jar to Harmony's tools.jar. I don't like this solution, but it
seems the only possible one. I hope there are no legal issues with
such repackage. All other jars can be added separately and loaded with
special class loader, similar to what is already implemented for
Eclipse compiler jar.

4. There are a few bugs in implementation of JDI connectors which
throw NPE when are used in JDB and Netbeans debuggers. I fixed this in
my experiments and fix is rather simple. I can submit bug to Eclipse
and attach this fix. I hope Eclipse folks can apply it quickly.

If nobody objects I will proceed with items 2-4.

Thanks.
Ivan

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Ivan Popov <iv...@gmail.com>.
I've run several experiments with JDI implementation from Eclipse and
was able to use it for running JDB debugger demo and Netbeans
debugger. However, there are several issues that should be solved.

1. Eclipse 3.0 provides quite independent JDI implementation, one can
use two separate jars from JDT runtime bundle:

  jdi.jar - JDI API interfaces
  jdimodel.jar - JDI implementation

But it corresponds to 1.4 and works not stable with Netbeans debugger,
so it is not the case.

2. In the newer Eclipse 3.2 and 3.3 JDI implementation corresponds to
1.5 and works well with both JDB and Netbeans (except of a few issues
mentioned below). Unfortunately, it introduces dependencies on two
additional jars (for formatting error messages and NLS support):

  com.ibm.icu.base_3.6.0.20061215.jar - from com.ibm.icu.base bundle
  org.eclipse.osgi_3.3.0.v20070321.jar - from RCP Runtime Binary bundle

The first one is quite small and independent bundle available from
Eclipse download site and I think it's OK to add it to Harmony
together with JDI jars. For the second one an easy stub can be
implemented to eliminate this dependency.

3. All Java debuggers expect that JDI API is located in
JDK/lib/tools.jar and implicitly add it to classpath when debugger is
started. This means we need to repackage all classes from Eclipse's
jdi.jar to Harmony's tools.jar. I don't like this solution, but it
seems the only possible one. I hope there are no legal issues with
such repackage. All other jars can be added separately and loaded with
special class loader, similar to what is already implemented for
Eclipse compiler jar.

4. There are a few bugs in implementation of JDI connectors which
throw NPE when are used in JDB and Netbeans debuggers. I fixed this in
my experiments and fix is rather simple. I can submit bug to Eclipse
and attach this fix. I hope Eclipse folks can apply it quickly.

If nobody objects I will proceed with items 2-4.

Thanks.
Ivan

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Yang Paulex <pa...@gmail.com>.
2007/4/20, Ivan Popov <iv...@gmail.com>:
>
> I'd like to start discussion about JPDA (Java Platform Debug
> Architecture [1]) support in Harmony. JPDA is de-facto standard for
> Java debug interface and is used by most Java debuggers. JPDA
> specification [2] is included into J2SE docs (but not in the core API
> spec) and is implemented in all commercial JDKs.
>
> Harmony already implements two underlying JPDA layers - JVMTI and
> JDWP, but it misses implementation of the high layer - JDI (Java Debug
> Interface [2]), which is used directly by Java debuggers. Currently,
> Harmony works well with Eclipse debugger, because Eclipse uses its own
> JDI implementation. But other Java debuggers (e.g., in Netbeans,
> JBuilder, and Idea IDEs) won't work with Harmony, because it lacks
> JDI. Netbeans 5.5 started on Harmony JDK produces several complains
> about missed JDI and disables all modules related to debugging. I'm
> not sure if Java TCK checks for JDI API, as it looks like optional
> component, but having JDI implementation may also facilitate passing
> TCK.
>
> The easiest way to implement JDI in Harmony is to adapt existing JDI
> implementation from Eclipse, as was already done for Eclipse Java
> compiler. I don't think there are any legal issues here and this looks
> easy from technical perspective.
>
> JDI implementation is included into Eclipse JDT runtime bundle,
> available on Eclipse download page [3]. JDI-related jars can be
> extracted and used separately from other Eclipse stuff. Adding them to
> Harmony JDK will provide Harmony with JDI implementation and enable
> Java debuggers other than Eclipse.
>
> If nobody objects to this approach I volunteer to work on technical
> details and provide required patches.


Great! +1 from me

Thanks.
> Ivan Popov
> Intel Enterprise Solutions Software Division
>
> [1] http://java.sun.com/javase/technologies/core/toolsapis/jpda/
> [2] http://java.sun.com/j2se/1.5.0/docs/guide/jpda/index.html
> [3]
> http://download.eclipse.org/eclipse/downloads/drops/R-3.2.2-200702121330/
>



-- 
Paulex Yang
China Software Development laboratory
IBM

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Davanum Srinivas <da...@gmail.com>.
Very nice!

On 4/20/07, Alexey Petrenko <al...@gmail.com> wrote:
> Yes, sounds really good.
>
> SY, Alexey
>
> 2007/4/20, Tim Ellison <t....@gmail.com>:
> > Ivan Popov wrote:
> > <snip>
> > > If nobody objects to this approach I volunteer to work on technical
> > > details and provide required patches.
> >
> > Sounds good.  That is well tested code we would do well to reuse.
> > Thanks Ivan.
> >
> > Regards,
> > Tim
> >
>


-- 
Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Alexey Petrenko <al...@gmail.com>.
Yes, sounds really good.

SY, Alexey

2007/4/20, Tim Ellison <t....@gmail.com>:
> Ivan Popov wrote:
> <snip>
> > If nobody objects to this approach I volunteer to work on technical
> > details and provide required patches.
>
> Sounds good.  That is well tested code we would do well to reuse.
> Thanks Ivan.
>
> Regards,
> Tim
>

Re: [jdktools][jpda] Adapt Eclipse JDI implementation to complete JPDA support in Harmony

Posted by Tim Ellison <t....@gmail.com>.
Ivan Popov wrote:
<snip>
> If nobody objects to this approach I volunteer to work on technical
> details and provide required patches.

Sounds good.  That is well tested code we would do well to reuse.
Thanks Ivan.

Regards,
Tim