static private VirtualMachine generalGetVM(OutputListener diagnostics, LaunchingConnector connector, Map<String, Connector.Argument> arguments) { VirtualMachine vm = null; try { diagnostics.putString("Starting child."); vm = connector.launch(arguments); } catch (IOException ioe) { diagnostics.putString("Unable to start child: " + ioe.getMessage()); } catch (IllegalConnectorArgumentsException icae) { diagnostics.putString("Unable to start child: " + icae.getMessage()); } catch (VMStartException vmse) { diagnostics.putString("Unable to start child: " + vmse.getMessage() + '\n'); dumpFailedLaunchInfo(diagnostics, vmse.process()); } return vm; }
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws IOException, IllegalConnectorArgumentsException, VMStartException { String command = argument(ARG_COMMAND, arguments).value(); String address = argument(ARG_ADDRESS, arguments).value(); String quote = argument(ARG_QUOTE, arguments).value(); if (quote.length() > 1) { throw new IllegalConnectorArgumentsException("Invalid length", ARG_QUOTE); } TransportService.ListenKey listener = transportService.startListening(address); try { return launch(tokenizeCommand(command, quote.charAt(0)), address, listener, transportService); } finally { transportService.stopListening(listener); } }
/** * Launch a debuggee in suspend mode. * @see {@link #launch(VirtualMachineManager, String, String, String, String, String)} */ public static IDebugSession launch(VirtualMachineManager vmManager, String mainClass, String programArguments, String vmArguments, List<String> modulePaths, List<String> classPaths, String cwd, String[] envVars) throws IOException, IllegalConnectorArgumentsException, VMStartException { return DebugUtility.launch(vmManager, mainClass, programArguments, vmArguments, String.join(File.pathSeparator, modulePaths), String.join(File.pathSeparator, classPaths), cwd, envVars); }
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws IOException, IllegalConnectorArgumentsException, VMStartException { /* * Get the class name that we are to execute */ String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value(); if (className.length() == 0) { throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME); } /* * Listen on an emperical port; launch the debuggee; wait for * for the debuggee to connect; stop listening; */ TransportService.ListenKey key = ts.startListening(); String exe = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" + key.address() + " -classpath " + System.getProperty("test.classes") + " " + className; Process process = Runtime.getRuntime().exec(cmd); Connection conn = ts.accept(key, 30*1000, 9*1000); ts.stopListening(key); /* * Debugee is connected - return the virtual machine mirror */ return Bootstrap.virtualMachineManager().createVirtualMachine(conn); }
protected VirtualMachine launch(String[] commandArray, String address, TransportService.ListenKey listenKey, TransportService ts) throws IOException, VMStartException { Helper helper = new Helper(commandArray, address, listenKey, ts); helper.launchAndAccept(); VirtualMachineManager manager = Bootstrap.virtualMachineManager(); return manager.createVirtualMachine(helper.connection(), helper.process()); }
synchronized void launchAndAccept() throws IOException, VMStartException { process = Runtime.getRuntime().exec(commandArray); Thread acceptingThread = acceptConnection(); Thread monitoringThread = monitorTarget(); try { while ((connection == null) && (acceptException == null) && !exited) { wait(); } if (exited) { throw new VMStartException( "VM initialization failed for: " + commandString(), process); } if (acceptException != null) { // Rethrow the exception in this thread throw acceptException; } } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted during accept"); } finally { acceptingThread.interrupt(); monitoringThread.interrupt(); } }
private VirtualMachine spawn( String vmArgs, String cmdLine ) throws SessionException { VirtualMachine vm; try { VirtualMachineManager manager = Bootstrap.virtualMachineManager(); LaunchingConnector connector = manager.defaultConnector(); Map arguments = connector.defaultArguments(); DC.log(LEVEL, arguments ); ((Connector.Argument)arguments.get("options")).setValue(vmArgs); ((Connector.Argument)arguments.get("main")).setValue(cmdLine); vm = connector.launch( arguments ); return vm; } catch (IOException ioe) { throw new SessionException( ioe ); } catch (IllegalConnectorArgumentsException icae ) { throw new SessionException( icae ); } catch (VMStartException vmse ) { throw new SessionException( vmse ); } }
abstract public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws IOException, IllegalConnectorArgumentsException, VMStartException;
public F3VirtualMachine launch(Map<String, ? extends Argument> args) throws IOException, IllegalConnectorArgumentsException, VMStartException { return F3Wrapper.wrap(underlying().launch(args)); }
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws IOException, IllegalConnectorArgumentsException, VMStartException { /* * Get the class name that we are to execute */ String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value(); if (className.length() == 0) { throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME); } /* * Listen on an emperical port; launch the debuggee; wait for * for the debuggee to connect; stop listening; */ TransportService.ListenKey key = ts.startListening(); String exe = System.getProperty("java.home") + File.separator + "bin" + File.separator; String arch = System.getProperty("os.arch"); String osname = System.getProperty("os.name"); if (osname.equals("SunOS") && arch.equals("sparcv9")) { exe += "sparcv9/java"; } else if (osname.equals("SunOS") && arch.equals("amd64")) { exe += "amd64/java"; } else { exe += "java"; } String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" + key.address() + " -classpath " + System.getProperty("test.classes") + " " + className; Process process = Runtime.getRuntime().exec(cmd); Connection conn = ts.accept(key, 30*1000, 9*1000); ts.stopListening(key); /* * Debugee is connected - return the virtual machine mirror */ return Bootstrap.virtualMachineManager().createVirtualMachine(conn); }
/** * Creates a new instance of VirtualMachine for this DebuggerInfo Cookie. * * @return a new instance of VirtualMachine for this DebuggerInfo Cookie */ public VirtualMachine getVirtualMachine () throws IOException, IllegalConnectorArgumentsException, VMStartException { return launchingConnector.launch (args); }
/** * Creates a new instance of VirtualMachine for this DebuggerInfo Cookie. * * @return a new instance of VirtualMachine for this DebuggerInfo Cookie * @throws java.net.ConnectException When a connection is refused */ public abstract VirtualMachine getVirtualMachine () throws IOException, IllegalConnectorArgumentsException, VMStartException;