def maybe_get_input(self): if self.is_ready_for_command() and self.debugger.InputReaderIsTopReader(self.__input_reader): LldbInputDelegate.get_input(self.__window, '(lldb)') return True else: LldbInputDelegate.get_input(self.__window, '?') return True
def __input_reader_callback(self, input_reader, notification, bytes): if (notification == lldb.eInputReaderReactivate): self.ready_for_command() elif (notification == lldb.eInputReaderGotToken): # We're using a Line granularity. We don't receive the \n self.__io_channel_w_fh.write(bytes + '\n') self.__io_channel_w_fh.flush() elif (notification == lldb.eInputReaderAsynchronousOutputWritten): io_channel = self.io_channel if io_channel: pass # io_channel.refresh_prompt() elif (notification == lldb.eInputReaderInterrupt): io_channel = self.io_channel if io_channel: io_channel.out_write('^C\n', io_channel.NO_ASYNC) # io_channel.refresh_prompt() elif (notification == lldb.eInputReaderEndOfFile): io_channel = self.io_channel if io_channel: io_channel.out_write('^D\n', io_channel.NO_ASYNC) # io_channel.refresh_prompt() self.__io_channel_w_fh.write(b'quit\n') elif (notification == lldb.eInputReaderActivate): pass elif (notification == lldb.eInputReaderDeactivate): # Another input reader got pushed onto the stack # Let's open an input prompt for it. LldbInputDelegate.get_input(self.__window, '?') elif (notification == lldb.eInputReaderDone): pass def notif_str(): return [ "eInputReaderActivate, // reader is newly pushed onto the reader stack ", "eInputReaderAsynchronousOutputWritten, // an async output event occurred; the reader may want to do something", "eInputReaderReactivate, // reader is on top of the stack again after another reader was popped off ", "eInputReaderDeactivate, // another reader was pushed on the stack", "eInputReaderGotToken, // reader got one of its tokens (granularity)", "eInputReaderInterrupt, // reader received an interrupt signal (probably from a control-c)", "eInputReaderEndOfFile, // reader received an EOF char (probably from a control-d)", "eInputReaderDone // reader was just popped off the stack and is done"][notification] return len(bytes)