def main(): args = jerry_client_main.arguments_parse() debugger = jerry_client_main.JerryDebugger(args.address) debugger.non_interactive = args.non_interactive logging.debug("Connected to JerryScript on %d port", debugger.port) prompt = DebuggerPrompt(debugger) prompt.prompt = "(jerry-debugger) " if args.color: debugger.set_colors() if args.display: debugger.display = args.display prompt.do_display(args.display) else: prompt.stop = False if args.exception is not None: prompt.do_exception(str(args.exception)) if args.client_source: debugger.store_client_sources(args.client_source) while True: if prompt.quit: break result = debugger.process_messages() res_type = result.get_type() if res_type == result.END: break elif res_type == result.PROMPT: prompt.cmdloop() elif res_type == result.TEXT: write(result.get_text()) continue
def main(): args = jerry_client_main.arguments_parse() channel = None protocol = None if args.protocol == "tcp": address = None if ":" not in args.address: address = (args.address, 5001) # use default port else: host, port = args.address.split(":") address = (host, int(port)) protocol = Socket(address) elif args.protocol == "serial": from jerry_client_serial import Serial protocol = Serial(args.serial_config) else: print("Unsupported transmission protocol") return -1 if args.channel == "websocket": channel = WebSocket(protocol=protocol) elif args.channel == "rawpacket": channel = RawPacket(protocol=protocol) else: print("Unsupported communication channel") return -1 debugger = jerry_client_main.JerryDebugger(channel) debugger.non_interactive = args.non_interactive logging.debug("Connected to JerryScript") prompt = DebuggerPrompt(debugger) prompt.prompt = "(jerry-debugger) " if args.color: debugger.set_colors() if args.display: debugger.display = args.display prompt.do_display(args.display) else: prompt.stop = False if args.exception is not None: prompt.do_exception(str(args.exception)) if args.client_source: debugger.store_client_sources(args.client_source) while True: if prompt.quit: break result = debugger.process_messages() res_type = result.get_type() if res_type == result.END: break elif res_type == result.PROMPT: prompt.cmdloop() elif res_type == result.TEXT: write(result.get_text()) continue