Search in sources :

Example 1 with VMStartEvent

use of com.sun.jdi.event.VMStartEvent 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)1 Argument (com.sun.jdi.connect.Connector.Argument)1 LaunchingConnector (com.sun.jdi.connect.LaunchingConnector)1 Event (com.sun.jdi.event.Event)1 MethodEntryEvent (com.sun.jdi.event.MethodEntryEvent)1 MethodExitEvent (com.sun.jdi.event.MethodExitEvent)1 StepEvent (com.sun.jdi.event.StepEvent)1 VMDeathEvent (com.sun.jdi.event.VMDeathEvent)1 VMDisconnectEvent (com.sun.jdi.event.VMDisconnectEvent)1 VMStartEvent (com.sun.jdi.event.VMStartEvent)1