use of com.sun.jdi.connect.LaunchingConnector in project jdk8u_jdk by JetBrains.
the class ChildSession method getVM.
private static VirtualMachine getVM(OutputListener diagnostics, String userVMArgs, String cmdLine) {
VirtualMachineManager manager = Bootstrap.virtualMachineManager();
LaunchingConnector connector = manager.defaultConnector();
Map<String, Connector.Argument> arguments = connector.defaultArguments();
arguments.get("options").setValue(userVMArgs);
arguments.get("main").setValue(cmdLine);
return generalGetVM(diagnostics, connector, arguments);
}
use of com.sun.jdi.connect.LaunchingConnector 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.connect.LaunchingConnector in project warn-report by saaavsaaa.
the class debugger method test.
@Test
public void test() throws VMStartException, IllegalConnectorArgumentsException, IOException {
// Debugger 通过 Bootstrap 获取唯一的虚拟机管理器
VirtualMachineManager virtualMachineManager = Bootstrap.virtualMachineManager();
// 虚拟机管理器将在第一次被调用时初始化可用的链接器
LaunchingConnector defaultConnector = virtualMachineManager.defaultConnector();
// 启动目标程序,连接调试器(Debugger)与目标虚拟机(VirtualMachine)
Map<String, Connector.Argument> arguments = defaultConnector.defaultArguments();
Connector.Argument arg = arguments.get("main");
arg.setValue("cn.tellwhy.DailyTest");
VirtualMachine targetVM = defaultConnector.launch(arguments);
// 获取 Mirror 对象实例的虚拟机
VirtualMachine virtualMachine = targetVM.virtualMachine();
virtualMachine.allClasses().forEach(a -> System.out.println("===============:" + a.name()));
}
use of com.sun.jdi.connect.LaunchingConnector in project warn-report by saaavsaaa.
the class debugger method main.
public static void main(String[] args) throws Exception {
LaunchingConnector launchingConnector = Bootstrap.virtualMachineManager().defaultConnector();
// Get arguments of the launching connector
Map<String, Connector.Argument> defaultArguments = launchingConnector.defaultArguments();
Connector.Argument mainArg = defaultArguments.get("main");
Connector.Argument suspendArg = defaultArguments.get("suspend");
// Set class of main method
mainArg.setValue("cn.tellwhy.DailyTest");
suspendArg.setValue("true");
vm = launchingConnector.launch(defaultArguments);
process = vm.process();
// Register ClassPrepareRequest
eventRequestManager = vm.eventRequestManager();
ClassPrepareRequest classPrepareRequest = eventRequestManager.createClassPrepareRequest();
// classPrepareRequest.addClassFilter("cn.tellwhy.DailyTest");
// classPrepareRequest.addCountFilter(1);
// classPrepareRequest.setSuspendPolicy(EventRequest.SUSPEND_ALL);
classPrepareRequest.enable();
// Enter event loop
eventLoop();
process.destroy();
}
use of com.sun.jdi.connect.LaunchingConnector 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