Search in sources :

Example 6 with VirtualMachineManager

use of com.sun.jdi.VirtualMachineManager in project ceylon-compiler by ceylon.

the class TracerImpl method start.

public void start() throws Exception {
    VirtualMachineManager vmm = com.sun.jdi.Bootstrap.virtualMachineManager();
    LaunchingConnector conn = vmm.defaultConnector();
    Map<String, Argument> defaultArguments = conn.defaultArguments();
    defaultArguments.get("main").setValue(mainClass);
    defaultArguments.get("options").setValue("-cp " + classPath);
    System.out.println(defaultArguments);
    vm = conn.launch(defaultArguments);
    err = vm.process().getErrorStream();
    out = vm.process().getInputStream();
    eq = vm.eventQueue();
    rm = vm.eventRequestManager();
    outer: while (true) {
        echo(err, System.err);
        echo(out, System.out);
        events = eq.remove();
        for (Event event : events) {
            if (event instanceof VMStartEvent) {
                System.out.println(event);
                break outer;
            } else if (event instanceof VMDisconnectEvent || event instanceof VMDeathEvent) {
                System.out.println(event);
                vm = null;
                rm = null;
                eq = null;
                break outer;
            }
        }
        events.resume();
    }
    echo(err, System.err);
    echo(out, System.out);
}
Also used : VMDisconnectEvent(com.sun.jdi.event.VMDisconnectEvent) Argument(com.sun.jdi.connect.Connector.Argument) VMDeathEvent(com.sun.jdi.event.VMDeathEvent) LaunchingConnector(com.sun.jdi.connect.LaunchingConnector) VMStartEvent(com.sun.jdi.event.VMStartEvent) MethodEntryEvent(com.sun.jdi.event.MethodEntryEvent) Event(com.sun.jdi.event.Event) VMDisconnectEvent(com.sun.jdi.event.VMDisconnectEvent) VMDeathEvent(com.sun.jdi.event.VMDeathEvent) StepEvent(com.sun.jdi.event.StepEvent) VMStartEvent(com.sun.jdi.event.VMStartEvent) MethodExitEvent(com.sun.jdi.event.MethodExitEvent) VirtualMachineManager(com.sun.jdi.VirtualMachineManager)

Aggregations

VirtualMachineManager (com.sun.jdi.VirtualMachineManager)6 LaunchingConnector (com.sun.jdi.connect.LaunchingConnector)4 AttachingConnector (com.sun.jdi.connect.AttachingConnector)3 Argument (com.sun.jdi.connect.Connector.Argument)3 VirtualMachine (com.sun.jdi.VirtualMachine)2 Connector (com.sun.jdi.connect.Connector)2 Event (com.sun.jdi.event.Event)2 MethodEntryEvent (com.sun.jdi.event.MethodEntryEvent)2 MethodExitEvent (com.sun.jdi.event.MethodExitEvent)2 StepEvent (com.sun.jdi.event.StepEvent)2 VMDeathEvent (com.sun.jdi.event.VMDeathEvent)2 VMDisconnectEvent (com.sun.jdi.event.VMDisconnectEvent)2 VMStartEvent (com.sun.jdi.event.VMStartEvent)2 SocketAttachingConnector (com.sun.tools.jdi.SocketAttachingConnector)2 Test (org.junit.Test)2 Method (com.sun.jdi.Method)1 ReferenceType (com.sun.jdi.ReferenceType)1 VMDisconnectedException (com.sun.jdi.VMDisconnectedException)1 IllegalConnectorArgumentsException (com.sun.jdi.connect.IllegalConnectorArgumentsException)1 BreakpointRequest (com.sun.jdi.request.BreakpointRequest)1