⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tty.java

📁 jpda例子文件
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                    evaluator.commandUntrace(t);                } else if (cmd.equals("where")) {                    evaluator.commandWhere(t, false);                } else if (cmd.equals("wherei")) {                    evaluator.commandWhere(t, true);                } else if (cmd.equals("up")) {                    evaluator.commandUp(t);                } else if (cmd.equals("down")) {                    evaluator.commandDown(t);                } else if (cmd.equals("load")) {                    evaluator.commandLoad(t);                } else if (cmd.equals("run")) {                    evaluator.commandRun(t);                    /*                     * Fire up an event handler, if the connection was just                     * opened. Since this was done from the run command                     * we don't stop the VM on its VM start event (so                     * arg 2 is false).                     */                    if ((handler == null) && Env.connection().isOpen()) {                        handler = new EventHandler(this, false);                    }                } else if (cmd.equals("memory")) {                    evaluator.commandMemory();                } else if (cmd.equals("gc")) {                    evaluator.commandGC();                } else if (cmd.equals("stop")) {                    evaluator.commandStop(t);                } else if (cmd.equals("clear")) {                    evaluator.commandClear(t);                } else if (cmd.equals("watch")) {                    evaluator.commandWatch(t);                } else if (cmd.equals("unwatch")) {                    evaluator.commandUnwatch(t);                } else if (cmd.equals("list")) {                    evaluator.commandList(t);                } else if (cmd.equals("lines")) { // Undocumented command: useful for testing.                    evaluator.commandLines(t);                } else if (cmd.equals("classpath")) {                    evaluator.commandClasspath(t);                } else if (cmd.equals("use") || cmd.equals("sourcepath")) {                    evaluator.commandUse(t);                } else if (cmd.equals("monitor")) {                    monitorCommand(t);                } else if (cmd.equals("unmonitor")) {                    unmonitorCommand(t);                } else if (cmd.equals("lock")) {                    evaluator.commandLock(t);                    showPrompt = false;        // asynchronous command                } else if (cmd.equals("threadlocks")) {                    evaluator.commandThreadlocks(t);                } else if (cmd.equals("disablegc")) {                    evaluator.commandDisableGC(t);                    showPrompt = false;        // asynchronous command                } else if (cmd.equals("enablegc")) {                    evaluator.commandEnableGC(t);                    showPrompt = false;        // asynchronous command                } else if (cmd.equals("save")) { // Undocumented command: useful for testing.                    evaluator.commandSave(t);                    showPrompt = false;        // asynchronous command                } else if (cmd.equals("bytecodes")) { // Undocumented command: useful for testing.                    evaluator.commandBytecodes(t);                } else if (cmd.equals("redefine")) {                    evaluator.commandRedefine(t);                } else if (cmd.equals("pop")) {                    evaluator.commandPopFrames(t, false);                } else if (cmd.equals("reenter")) {                    evaluator.commandPopFrames(t, true);                } else if (cmd.equals("extension")) {                    evaluator.commandExtension(t);                } else if (cmd.equals("exclude")) {                    evaluator.commandExclude(t);                } else if (cmd.equals("read")) {                    readCommand(t);                } else if (cmd.equals("help") || cmd.equals("?")) {                    help();                } else if (cmd.equals("version")) {                    evaluator.commandVersion(progname, version);                } else if (cmd.equals("quit") || cmd.equals("exit")) {                    if (handler != null) {                        handler.shutdown();                    }                    Env.shutdown();                 } else {                    if (t.hasMoreTokens()) {                        try {                                        int repeat = Integer.parseInt(cmd);                            String subcom = t.nextToken("");                            while (repeat-- > 0) {                                executeCommand(new StringTokenizer(subcom));                            }                            return;                        } catch (NumberFormatException exc) {                        }                    }                    MessageOutput.println("Unrecognized command.  Try help...");                }            } catch (UnsupportedOperationException uoe) {                MessageOutput.println("Command is not supported on the target VM", cmd);            } catch (VMNotConnectedException vmnse) {                MessageOutput.println("Command not valid until the VM is started with the run command",                             cmd);            } catch (Exception e) {                MessageOutput.printException("Internal exception:", e);            }        }        if (showPrompt) {            MessageOutput.printPrompt();        }    }    /*     * Maintain a list of commands to execute each time the VM is suspended.     */    void monitorCommand(StringTokenizer t) {        if (t.hasMoreTokens()) {            ++monitorCount;            monitorCommands.add(monitorCount + ": " + t.nextToken(""));        } else {            Iterator it = monitorCommands.iterator();            while (it.hasNext()) {                MessageOutput.printDirectln((String)it.next());// Special case: use printDirectln()            }        }                }    void unmonitorCommand(StringTokenizer t) {        if (t.hasMoreTokens()) {            String monTok = t.nextToken();            int monNum;            try {                            monNum = Integer.parseInt(monTok);            } catch (NumberFormatException exc) {                MessageOutput.println("Not a monitor number:", monTok);                return;            }            String monStr = monTok + ":";            Iterator it = monitorCommands.iterator();            while (it.hasNext()) {                String cmd = (String)it.next();                StringTokenizer ct = new StringTokenizer(cmd);                if (ct.nextToken().equals(monStr)) {                    monitorCommands.remove(cmd);                    MessageOutput.println("Unmonitoring", cmd);                    return;                }            }            MessageOutput.println("No monitor numbered:", monTok);        } else {            MessageOutput.println("Usage: unmonitor <monitor#>");        }    }    void readCommand(StringTokenizer t) {        if (t.hasMoreTokens()) {            String cmdfname = t.nextToken();            if (!readCommandFile(cmdfname)) {                MessageOutput.println("Could not open:", cmdfname);            }        } else {            MessageOutput.println("Usage: read <command-filename>");        }    }    /**     * Read and execute a command file.  Return true if the     * file could be opened.     */    boolean readCommandFile(String filename) {        File f = new File(filename);        BufferedReader inFile = null;        try {            if (f.canRead()) {                MessageOutput.println("*** Reading commands from", f.getCanonicalPath());                // Process initial commands.                inFile = new BufferedReader(new FileReader(f));                String ln;                while ((ln = inFile.readLine()) != null) {                    StringTokenizer t = new StringTokenizer(ln);                    if (t.hasMoreTokens()) {                        executeCommand(t);                    }                }            }        } catch (IOException e) {        } finally {            if (inFile != null) {                try {                    inFile.close();                } catch (Exception exc) {                }            }        }        return inFile != null;    }    public TTY() throws Exception {        MessageOutput.println("Initializing progname", progname);               if (Env.connection().isOpen()) {            /*             * Connection opened on startup. Start event handler             * immediately, telling it (through arg 2) to stop on the              * VM start event.             */            this.handler = new EventHandler(this, true);        }        try {            BufferedReader in =                     new BufferedReader(new InputStreamReader(System.in));                String lastLine = null;                Thread.currentThread().setPriority(Thread.NORM_PRIORITY);                /*             * Try reading user's home startup file. Handle Unix and              * and Win32 conventions for the names of these files.              */            if (!readCommandFile(System.getProperty("user.home") +                                  File.separator + "jdb.ini")) {                readCommandFile(System.getProperty("user.home") +                                 File.separator + ".jdbrc");            }                // Try startup file in local directory            if (!readCommandFile(System.getProperty("user.dir") +                                  File.separator + "jdb.ini")) {                readCommandFile(System.getProperty("user.dir") +                                 File.separator + ".jdbrc");            }                // Process interactive commands.            MessageOutput.printPrompt();            while (true) {                String ln = in.readLine();                if (ln == null) {                    MessageOutput.println("Input stream closed.");                    return;                }                    if (ln.startsWith("!!") && lastLine != null) {                    ln = lastLine + ln.substring(2);                    MessageOutput.printDirectln(ln);// Special case: use printDirectln()                }                    StringTokenizer t = new StringTokenizer(ln);                if (t.hasMoreTokens()) {                    lastLine = ln;                    executeCommand(t);                } else {                    MessageOutput.printPrompt();                }            }        } catch (VMDisconnectedException e) {            handler.handleDisconnectedException();        }    }    private static void usage() {        MessageOutput.println("zz usage text", new Object [] {progname,                                                     File.pathSeparator});        System.exit(1);    }    static void usageError(String messageKey) {        MessageOutput.println(messageKey);        MessageOutput.println();        usage();    }    static void usageError(String messageKey, String argument) {        MessageOutput.println(messageKey, argument);        MessageOutput.println();        usage();    }    private static Connector findConnector(String transportName, List availableConnectors) {        Iterator iter = availableConnectors.iterator();        while (iter.hasNext()) {            Connector connector = (Connector)iter.next();            if (connector.transport().name().equals(transportName)) {                return connector;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -