Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-debug-dev] Different usage of eclipse jdi lib and sun implementation

Thanks Darin. The problem is the EventQueue's remove() method keeps waiting after the vm started when running with JDT's JDI while it runs well with Sun's JDI

Here is part of the code:

===============================================================================
    public static void main(String[] args) throws Exception{

        LaunchingConnector launchingConnector = Bootstrap.virtualMachineManager().defaultConnector();

        Map<String, Connector.Argument> arguments = launchingConnector.defaultArguments();
        
        arguments.get("main").setValue("HelloWorld");
        arguments.get("suspend").setValue("true");
        
        targetVM = launchingConnector.launch(arguments);
        
        VMProcess = targetVM.process();
        
        // Register ClassPrepareRequest
        eventRequestManager = targetVM.eventRequestManager();
        ClassPrepareRequest classPrepareRequest = eventRequestManager.createClassPrepareRequest();
        classPrepareRequest.addClassFilter("HelloWorld");
        classPrepareRequest.addCountFilter(1);
        classPrepareRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
        classPrepareRequest.enable();
        
        // Enter event loop 
        eventLoop();
        
        VMProcess.destroy();
}

    private static void eventLoop() throws Exception {
        eventQueue = targetVM.eventQueue();
        while (true) {
            if (vmExit == true) {
                break;
            }
            eventSet = eventQueue.remove();
            
            EventIterator eventIterator = eventSet.eventIterator();
            
            while (eventIterator.hasNext()) {
                Event event = (Event) eventIterator.next();
                execute(event);
            }
        }
    }
===============================================================================

Here the execute method is to handle the coming events. When each event is done, the resume() method of the corresponding eventset is called.

Before I started this project, I thought there should be no difference as well. Can you help me with the problem? Thanks!

Best wishes
Daniel Gong


On Fri, Jun 18, 2010 at 12:53 AM, Darin Wright <Darin_Wright@xxxxxxxxxx> wrote:
JDT provides an implementation of the JDI specification. Theoretically,
there should be no difference - as both implementations conform to the
spec. If you're seeing differences, it might be useful to describe them
here, or file bugs with tests cases demonstrating the issues.

One notable difference is that the Eclipse JDI implementation is designed
to run on a 1.4 JRE and debug a VM running on any version of Java (i.e.
1.3 - 1.6). Where as the Sun 1.6 JDI implementation is required to
debug/utilize the features of a 1.6 VM.

Darin



From:
Daniel Gong <daniel.gong.fudan@xxxxxxxxx>
To:
jdt-debug-dev@xxxxxxxxxxx
Date:
06/17/2010 11:35 AM
Subject:
[jdt-debug-dev] Different usage of eclipse jdi lib and sun implementation
Sent by:
jdt-debug-dev-bounces@xxxxxxxxxxx



Hi all,

My name is Daniel. I'm new to this list.

Currently I'm working on a project that requires eclipse jdi
implementation. I've encountered a problem that my jdi sample works well
with sun  jdi but fails with eclipse jdi. Is there any difference? Or what
should I pay attention to when I'm coding with eclipse jdi instead of sun
jdi? Thanks!

Best wishes
Daniel Gong_______________________________________________
jdt-debug-dev mailing list
jdt-debug-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jdt-debug-dev



_______________________________________________
jdt-debug-dev mailing list
jdt-debug-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jdt-debug-dev


Back to the top