private void dumpFailedLaunchInfo(Process process) { try { dumpStream(process.getErrorStream()); dumpStream(process.getInputStream()); } catch (IOException e) { MessageOutput.println("Unable to display process output:", e.getMessage()); } }
static void removeThread(ThreadReference thread) { if (thread.equals(ThreadInfo.current)) { // Current thread has died. // Be careful getting the thread name. If its death happens // as part of VM termination, it may be too late to get the // information, and an exception will be thrown. String currentThreadName; try { currentThreadName = "\"" + thread.name() + "\""; } catch (Exception e) { currentThreadName = ""; } setCurrentThread(null); MessageOutput.println(); MessageOutput.println("Current thread died. Execution continuing...", currentThreadName); } threads.remove(getThreadInfo(thread)); }
/* launch child target vm */ private VirtualMachine launchTarget() { LaunchingConnector launcher = (LaunchingConnector) connector; try { VirtualMachine vm = launcher.launch(connectorArgs); process = vm.process(); displayRemoteOutput(process.getErrorStream()); displayRemoteOutput(process.getInputStream()); return vm; } catch (IOException ioe) { ioe.printStackTrace(); MessageOutput.fatalError("Unable to launch target VM."); } catch (IllegalConnectorArgumentsException icae) { icae.printStackTrace(); MessageOutput.fatalError("Internal debugger error."); } catch (VMStartException vmse) { MessageOutput.println("vmstartexception", vmse.getMessage()); MessageOutput.println(); dumpFailedLaunchInfo(vmse.process()); MessageOutput.fatalError("Target VM failed to initialize."); } return null; // Shuts up the compiler }
static void shutdown(String message) { if (connection != null) { try { connection.disposeVM(); } catch (VMDisconnectedException e) { // Shutting down after the VM has gone away. This is // not an error, and we just ignore it. } } if (message != null) { MessageOutput.lnprint(message); MessageOutput.println(); } System.exit(0); }
/* listen for connection from target vm */ private VirtualMachine listenTarget() { ListeningConnector listener = (ListeningConnector) connector; try { String retAddress = listener.startListening(connectorArgs); MessageOutput.println("Listening at address:", retAddress); vm = listener.accept(connectorArgs); listener.stopListening(connectorArgs); return vm; } catch (IOException ioe) { ioe.printStackTrace(); MessageOutput.fatalError("Unable to attach to target VM."); } catch (IllegalConnectorArgumentsException icae) { icae.printStackTrace(); MessageOutput.fatalError("Internal debugger error."); } return null; // Shuts up the compiler }
private static void usage() { MessageOutput.println("zz usage text", new Object[] {progname, File.pathSeparator}); System.exit(1); }