use of com.sun.jdi.event.VMDisconnectEvent in project ceylon by eclipse.
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);
}
use of com.sun.jdi.event.VMDisconnectEvent in project gravel by gravel-st.
the class VMRemoteTarget method eventLoop.
private void eventLoop() throws InterruptedException {
System.out.println("eventLoop started");
EventQueue eventQueue = vm.eventQueue();
boolean isRunning = true;
while (isRunning) {
EventSet eventSet = eventQueue.remove();
boolean mayResume = true;
for (Event event : eventSet) {
System.out.println(event);
if (event instanceof VMDeathEvent || event instanceof VMDisconnectEvent) {
isRunning = false;
} else if (event instanceof ExceptionEvent) {
mayResume = false;
}
}
if (mayResume)
eventSet.resume();
}
}
use of com.sun.jdi.event.VMDisconnectEvent in project warn-report by saaavsaaa.
the class debugger method execute.
private static void execute(Event event) throws Exception {
if (event instanceof VMStartEvent) {
System.out.println("VM started");
eventSet.resume();
} else if (event instanceof BreakpointEvent) {
System.out.println("Reach Method printHello of test.Test");
eventSet.resume();
} else if (event instanceof MethodEntryEvent) {
MethodEntryEvent mee = (MethodEntryEvent) event;
Method method = mee.method();
System.out.println(method.name() + " was Entered!");
eventSet.resume();
} else if (event instanceof VMDisconnectEvent) {
vmExit = true;
} else {
eventSet.resume();
}
}
use of com.sun.jdi.event.VMDisconnectEvent in project gravel by gravel-st.
the class VMTargetStarter method createJVM.
public VMRemoteTarget createJVM() throws IOException, InterruptedException, IncompatibleThreadStateException {
Process process = startSecondJVM(VMLocalTarget.class);
sleep(90);
// connect
VirtualMachine vm = new VMAcquirer().connect(debugPort);
ClassPrepareRequest createClassPrepareRequest = vm.eventRequestManager().createClassPrepareRequest();
createClassPrepareRequest.addClassFilter(VMLocalTarget.class.getName());
createClassPrepareRequest.enable();
vm.resume();
List<ThreadReference> allThreads = vm.allThreads();
for (ThreadReference threadReference : allThreads) {
System.out.println(threadReference + " isSuspended: " + threadReference.isSuspended() + " suspendCount: " + threadReference.suspendCount());
}
// process events
EventQueue eventQueue = vm.eventQueue();
while (true) {
EventSet eventSet = eventQueue.remove();
for (Event event : eventSet) {
if (event instanceof ClassPrepareEvent) {
event.request().disable();
installHaltPoint(vm);
}
if (event instanceof VMDeathEvent || event instanceof VMDisconnectEvent) {
return null;
}
if (event instanceof BreakpointEvent) {
event.request().disable();
ThreadReference thread = ((BreakpointEvent) event).thread();
return new VMRemoteTarget(process, vm, thread, debugPort);
}
}
eventSet.resume();
}
}
use of com.sun.jdi.event.VMDisconnectEvent 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);
}
Aggregations