comparison agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java @ 11054:38ea2efa32a7

8010278: SA: provide mechanism for using an alternative SA debugger back-end. Reviewed-by: sla, dsamersoff
author kevinw
date Wed, 26 Jun 2013 00:01:20 +0100
parents 686916dc0439
children 69f26e8e09f9
comparison
equal deleted inserted replaced
11035:01e10b366055 11054:38ea2efa32a7
99 import sun.jvm.hotspot.utilities.soql.JSJavaFactory; 99 import sun.jvm.hotspot.utilities.soql.JSJavaFactory;
100 import sun.jvm.hotspot.utilities.soql.JSJavaFactoryImpl; 100 import sun.jvm.hotspot.utilities.soql.JSJavaFactoryImpl;
101 import sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine; 101 import sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine;
102 102
103 public class CommandProcessor { 103 public class CommandProcessor {
104
105 volatile boolean quit;
106
104 public abstract static class DebuggerInterface { 107 public abstract static class DebuggerInterface {
105 public abstract HotSpotAgent getAgent(); 108 public abstract HotSpotAgent getAgent();
106 public abstract boolean isAttached(); 109 public abstract boolean isAttached();
107 public abstract void attach(String pid); 110 public abstract void attach(String pid);
108 public abstract void attach(String java, String core); 111 public abstract void attach(String java, String core);
1133 public void doit(Tokens t) { 1136 public void doit(Tokens t) {
1134 if (t.countTokens() != 0) { 1137 if (t.countTokens() != 0) {
1135 usage(); 1138 usage();
1136 } else { 1139 } else {
1137 debugger.detach(); 1140 debugger.detach();
1138 System.exit(0); 1141 quit = true;
1139 } 1142 }
1140 } 1143 }
1141 }, 1144 },
1142 new Command("echo", "echo [ true | false ]", true) { 1145 new Command("echo", "echo [ true | false ]", true) {
1143 public void doit(Tokens t) { 1146 public void doit(Tokens t) {
1712 public JSJavaFactory getJSJavaFactory() { 1715 public JSJavaFactory getJSJavaFactory() {
1713 return factory; 1716 return factory;
1714 } 1717 }
1715 protected void quit() { 1718 protected void quit() {
1716 debugger.detach(); 1719 debugger.detach();
1717 System.exit(0); 1720 quit = true;
1718 } 1721 }
1719 protected BufferedReader getInputReader() { 1722 protected BufferedReader getInputReader() {
1720 return in; 1723 return in;
1721 } 1724 }
1722 protected PrintStream getOutputStream() { 1725 protected PrintStream getOutputStream() {
1779 } 1782 }
1780 1783
1781 1784
1782 public void run(boolean prompt) { 1785 public void run(boolean prompt) {
1783 // Process interactive commands. 1786 // Process interactive commands.
1784 while (true) { 1787 while (!quit) {
1785 if (prompt) printPrompt(); 1788 if (prompt) printPrompt();
1786 String ln = null; 1789 String ln = null;
1787 try { 1790 try {
1788 ln = in.readLine(); 1791 ln = in.readLine();
1789 } catch (IOException e) { 1792 } catch (IOException e) {