Beispiel #1
0
	def read_until_prompt(self):
		lines = []
		while(True):
			line = self.proc.stdout.readline()
			if not line or line == GDB_PROMPT:
				return lines
			if self.verbose >= 3:
				sys.stdout.write(line)
			lines.append(str(mi_parser.process(line)))
		return lines
Beispiel #2
0
	def send_mi_command(self,command):
		self.send_to_gdb('g',command)
		print "mi-command:",command
		time.sleep(0.3)
		gdb_output = self.read_gdb_output(self.p).replace(GDB_PROMPT,'')
		print "mi-output:",gdb_output
		try:
			output = mi_parser.process(gdb_output+'\n').__dict__
		except:
			# give up if we can't parse the output
			return None
		return output
Beispiel #3
0
	def __run_loop(self):
		while(True):
			lines = self.__console.read_until_prompt()
			if not lines: break
			for line in lines:
				try:
					output = mi_parser.process(line)
				except Exception:
					class GdbUnknownEvent:
						def __init__(self, line):
							self.type = 'unknown'
							self.record_type = 'stream'
							self.value = line
						def __repr__(self): return self.value
					output = GdbUnknownEvent(line)
				try:
					self.__dispatcher.post_event(output)
				except Exception:
					import traceback
					traceback.print_exc()
Beispiel #4
0
    def __run_loop(self):
        while (True):
            lines = self.__console.read_until_prompt()
            if not lines: break
            for line in lines:
                try:
                    output = mi_parser.process(line)
                except Exception:

                    class GdbUnknownEvent:
                        def __init__(self, line):
                            self.type = 'unknown'
                            self.record_type = 'stream'
                            self.value = line

                        def __repr__(self):
                            return self.value

                    output = GdbUnknownEvent(line)
                try:
                    self.__dispatcher.post_event(output)
                except Exception:
                    import traceback
                    traceback.print_exc()