Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 96558

Summary: JDWP - Error when methodID==zero
Product: [Eclipse Project] JDT Reporter: Lars Even <larseven>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Lars Even CLA 2005-05-25 02:26:08 EDT
I am debugging a simple application on a remote VM using Eclipse 3.1.0 M7. My VM
is a modified version of Sun's KVM. 

My problem is the JDWP/KDWP specified "methodID" (see definition at the end of
this message). Eclipse does not seem to agree that zero is a valid methodID.

Consider the following example
1. class Foo{
2.
3.     public Foo(){ 
4.     // Do something
5.     }
6. 
7.     public Method_1(){}
8.     public Method_2(){}
9. 
10.    public static void main(){ 
11.        new Foo();
12.    }
13. } 

I have set Eclipse to communicate with the VM through a KDWP-proxy-server. The
KDWP-proxy-server loads the Foo-class and generates the following methodsIDs:

method name: Foo.<init>    methodID: 0
method name: Method_1      methodID: 1
method name: Method_2      methodID: 2
method name: main          methodID: 3

When I set a breakpoint at line 4, Eclipse sends an EventRequest JDWP-command
containing the methodID "0". After having pressed resume, I get to the
breakpoint, and the VM sends an Event JDWP-command. The methodID is also this
time "0", but this causes an internal error in Eclipse.

Unfortunately no details on this internal error is presented.

The isObsolete() method taken from org.eclipse.jdi.internal.MethodImpl is
implemented as:

public boolean isObsolete() {
if (virtualMachineImpl().isJdwpVersionGreaterOrEqual(1, 4)) {
return fMethodID.value() == 0;
}
return false;
}

This should perhaps be changed so that zero becomes a valid methodID.



-Lars Even



*) JDWP-Specification MethodID:

Uniquely identifies a method in some class in the target VM. The methodID must
uniquely identify the method within its class/interface or any of its
subclasses/subinterfaces/implementors. A methodID is not necessarily unique on
its own; it is always paired with a referenceTypeID to uniquely identify one
method. The referenceTypeID can identify either the declaring type of the method
or a subtype.
(http://codenewbie.com/documentation/j2sdk-1_5_0/guide/jpda/jdwp-spec.html)
Comment 1 Jared Burns CLA 2005-05-25 02:57:14 EDT
In the JVMDI specification, method ID zero is reserved for obsolete methods.
Comment 2 Lars Even CLA 2005-05-25 04:58:45 EDT
(In reply to comment #1)
> In the JVMDI specification, method ID zero is reserved for obsolete methods.

Thanks Jared,

I think that the problem is that the KVM Debug Proxy (KDP) from Sun generates
method IDs that starts with index 0. (The KDP can be found in the J2ME_CLDC
package).

I modified the KDP and changed the initiation of method_index_base (line 13 in
kdp\ProxyListener.java) to start at 1 instead of 0. I also made some adjustments
in my customized KVM. These modifications solved the problem.

Perhaps there are situations where the method_index_base should start at 0? If
not; I think Sun should alter their source code.

I am now marking this bug as fixed. 


-Lars E.
Comment 3 Darin Wright CLA 2005-05-25 16:27:46 EDT
Closed