agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java

Print this page

        

@@ -99,10 +99,13 @@
 import sun.jvm.hotspot.utilities.soql.JSJavaFactory;
 import sun.jvm.hotspot.utilities.soql.JSJavaFactoryImpl;
 import sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine;
 
 public class CommandProcessor {
+
+    volatile boolean quit;
+
     public abstract static class DebuggerInterface {
         public abstract HotSpotAgent getAgent();
         public abstract boolean isAttached();
         public abstract void attach(String pid);
         public abstract void attach(String java, String core);

@@ -1133,11 +1136,11 @@
             public void doit(Tokens t) {
                 if (t.countTokens() != 0) {
                     usage();
                 } else {
                     debugger.detach();
-                    System.exit(0);
+                    quit = true;
                 }
             }
         },
         new Command("echo", "echo [ true | false ]", true) {
             public void doit(Tokens t) {

@@ -1712,11 +1715,11 @@
                         public JSJavaFactory getJSJavaFactory() {
                             return factory;
                         }
                         protected void quit() {
                             debugger.detach();
-                            System.exit(0);
+                            quit = true;
                         }
                         protected BufferedReader getInputReader() {
                             return in;
                         }
                         protected PrintStream getOutputStream() {

@@ -1779,11 +1782,11 @@
     }
 
 
     public void run(boolean prompt) {
         // Process interactive commands.
-        while (true) {
+        while (!quit) {
             if (prompt) printPrompt();
             String ln = null;
             try {
                 ln = in.readLine();
             } catch (IOException e) {