GithubHelp home page GithubHelp logo

Comments (5)

akaroml avatar akaroml commented on May 18, 2024

This is a bug we must fix in 0.1.0

from java-debug.

Eskibear avatar Eskibear commented on May 18, 2024

I've found the root cause. It's a JDT bug.
When calling request.enable(), it constructs the command bytes, and sends to VM. The differences are as:

bytes(4100018xy)  <--- this causes error
bytes(410001800000000xy) <--- this is ok

'x' controls caught exceptions
'y' controls uncaught exceptions

In command bytes construction, look at
org.eclipse.jdi.internal.request.EventRequestImpl

@Override
public synchronized void enable() {
    ......
    writeModifiers(outData);   <--- here it construct command bytes. 
    JdwpReplyPacket replyPacket = requestVM(JdwpCommandPacket.ER_SET,
        outBytes);   <--- here it send the command.
    defaultReplyErrorHandler(replyPacket.errorCode());   <--- here it parses the error code.
    ......
}

In calling writeModifiers(outData), there a part writing JdwpID:

/**
* Writes ID.
*/
public void write(DataOutputStream outStream) throws IOException {
	int size = getSize();     <--- vm.fReferenceTypeIDSize, should be 8, but is 0.
	for (int i = size - 1; i >= 0; i--) {
		byte b = (byte) (fValue >>> 8 * i); 
		outStream.write(b);
	}
}

However, vm.fReferenceTypeIDSize is set to default value 0. vm.fGotIDSizes is false, meaning that vm.getIDSizes() has not been called yet.

from java-debug.

Eskibear avatar Eskibear commented on May 18, 2024

there're many solutions, PR #25 works well, but not easy to understand. I'm looking for a more elegant one.

from java-debug.

Eskibear avatar Eskibear commented on May 18, 2024

Since fReferenceTypeIDSize is only modified in getIDSizes(), as shown in the call hierarchy, we now can only fix it via sending another command calling requestVM.

image

from java-debug.

Eskibear avatar Eskibear commented on May 18, 2024

fixed by call vm.version() after launching the vm.

from java-debug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.