예제 #1
0
 private void dumpFailedLaunchInfo(Process process) {
   try {
     dumpStream(process.getErrorStream());
     dumpStream(process.getInputStream());
   } catch (IOException e) {
     MessageOutput.println("Unable to display process output:", e.getMessage());
   }
 }
예제 #2
0
 /* attach to running target vm */
 private VirtualMachine attachTarget() {
   AttachingConnector attacher = (AttachingConnector) connector;
   try {
     return attacher.attach(connectorArgs);
   } 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
 }
예제 #3
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
 }
예제 #4
0
 private void dumpStream(InputStream stream) throws IOException {
   BufferedReader in = new BufferedReader(new InputStreamReader(stream));
   int i;
   try {
     while ((i = in.read()) != -1) {
       MessageOutput.printDirect((char) i); // Special case: use
       //   printDirect()
     }
   } catch (IOException ex) {
     String s = ex.getMessage();
     if (!s.startsWith("Bad file number")) {
       throw ex;
     }
     // else we got a Bad file number IOException which just means
     // that the debuggee has gone away.  We'll just treat it the
     // same as if we got an EOF.
   }
 }
예제 #5
0
 /* 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
 }