def run(self, lines): self.__socketmanager.start() try: self.__ui.start("Opera ECMAScript debugger\n") except: logger.logException() logger.logFatal("UI failure, exiting.") else: lastLine = None withCurrentSession, withCurrentRuntime = None, None while not self.__quit: if not lines: try: line = self.__ui.readLine(self.getPrompt, TabCompleter(self)) if line is None: self.__quit = True break if not line.strip(): if lastLine: line = lastLine else: continue else: lastLine = line.split(" ")[0] lines = [line] withCurrentSession, withCurrentRuntime = None, None except: logger.logException() logger.logFatal("UI failure, exiting.") break try: self.execute(lines, withCurrentSession, withCurrentRuntime) except CommandError, error: self.__ui.writeln(error[0]) except DebuggerError, error: self.__ui.writeln(error[0]) except:
def run(self, lines): self.__socketmanager.start() try: self.__ui.start("Opera ECMAScript debugger\n") except: logger.logException() logger.logFatal("UI failure, exiting.") else: lastLine = None withCurrentSession, withCurrentRuntime = None, None while not self.__quit: if not lines: try: line = self.__ui.readLine(self.getPrompt, TabCompleter(self)) if line is None: self.__quit = True break if not line.strip(): if lastLine: line = lastLine else: continue else: lastLine = line.split(" ")[0] lines = [line] withCurrentSession, withCurrentRuntime = None, None except: logger.logException() logger.logFatal("UI failure, exiting.") break try: self.execute(lines, withCurrentSession, withCurrentRuntime) except CommandError, error: self.__ui.writeln(error[0]) except DebuggerError, error: self.__ui.writeln(error[0]) except: logger.logException() self.__ui.writeln("Internal debugger error.")
listenPort = 9999 initFile = join(environ.get("HOME", ""), ".esdbinit") commandFile = None for option, value in options: if option == "-f": configuration["gud"] = True elif option == "-x": commandFile = value elif option == "-n": initFile = None elif option in ("-p", "--listen-port"): try: listenPort = int(value) if listenPort < 1 or listenPort > 65535: raise ValueError except ValueError: logger.logFatal( "%s: invalid port (must be integer between 0 and 65536)" % argv[0]) exit(1) lines = [] if initFile and isfile(initFile) and access(initFile, R_OK): lines.extend([line.strip() for line in open(initFile, "r").readlines()]) if commandFile and isfile(commandFile) and access(commandFile, R_OK): lines.extend([line.strip() for line in open(commandFile, "r").readlines()]) from debugger import Debugger, DebuggerError from commands import CommandError, loadCommandsFromDirectory debugger = Debugger()
options, arguments = gnu_getopt(argv[1:], "fnp:x:", "listen-port") listenPort = 9999 initFile = join(environ.get("HOME", ""), ".esdbinit") commandFile = None for option, value in options: if option == "-f": configuration["gud"] = True elif option == "-x": commandFile = value elif option == "-n": initFile = None elif option in ("-p", "--listen-port"): try: listenPort = int(value) if listenPort < 1 or listenPort > 65535: raise ValueError except ValueError: logger.logFatal("%s: invalid port (must be integer between 0 and 65536)" % argv[0]) exit(1) lines = [] if initFile and isfile(initFile) and access(initFile, R_OK): lines.extend([line.strip() for line in open(initFile, "r").readlines()]) if commandFile and isfile(commandFile) and access(commandFile, R_OK): lines.extend([line.strip() for line in open(commandFile, "r").readlines()]) from debugger import Debugger, DebuggerError from commands import CommandError, loadCommandsFromDirectory debugger = Debugger() try: commands = loadCommandsFromDirectory("commands") for name, command in commands: debugger.addCommand(name, command)