[Pydev-cvs] org.python.pydev.debug/pysrc pydevd_vars.py,1.1,1.2 pydevd.py,1.4,1.5
Brought to you by:
fabioz
From: Aleksandar T. <at...@us...> - 2004-05-07 21:51:40
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465/pysrc Modified Files: pydevd_vars.py pydevd.py Log Message: Final touches. Debugger is ready to go Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pydevd.py 7 May 2004 02:03:07 -0000 1.4 --- pydevd.py 7 May 2004 21:51:00 -0000 1.5 *************** *** 77,81 **** __all__ = (); ! _trace = 2 def log(level, s): --- 77,81 ---- __all__ = (); ! _trace = -1 def log(level, s): *************** *** 86,90 **** """ if (level <= _trace): ! print s --- 86,90 ---- """ if (level <= _trace): ! print sys.stderr, s *************** *** 108,112 **** while (buffer.find('\n') != -1): [command, buffer] = buffer.split('\n', 1) ! log(2, "received command " + command) args = command.split('\t', 2) # print "the args are", args[0], " 2 ", args[1], " 3 ", args[2] --- 108,112 ---- while (buffer.find('\n') != -1): [command, buffer] = buffer.split('\n', 1) ! log(1, "received command " + command) args = command.split('\t', 2) # print "the args are", args[0], " 2 ", args[1], " 3 ", args[2] *************** *** 136,140 **** while(True): cmd = self.cmdQueue.get(1) ! log(2, "sending cmd " + cmd.getOutgoing()) self.sock.sendall(cmd.getOutgoing()) except: --- 136,140 ---- while(True): cmd = self.cmdQueue.get(1) ! log(1, "sending cmd " + cmd.getOutgoing()) self.sock.sendall(cmd.getOutgoing()) except: *************** *** 285,289 **** def doIt(self, dbg): ! print "killing " + str(self.thread_id) cmd = dbg.cmdFactory.makeThreadKilledMessage(self.thread_id) dbg.writer.addCommand(cmd) --- 285,289 ---- def doIt(self, dbg): ! log(1, "killing " + str(self.thread_id)) cmd = dbg.cmdFactory.makeThreadKilledMessage(self.thread_id) dbg.writer.addCommand(cmd) *************** *** 303,310 **** """ Converts request into python variable """ try: - print >>sys.stderr, "getVar::doIt" xml = "<xml>" valDict = pydevd_vars.resolveCompoundVariable(self.thread, self.frame_id, self.scope, self.attributes) - print >>sys.stderr, "resolved variable" keys = valDict.keys() keys.sort() --- 303,308 ---- *************** *** 312,322 **** xml += pydevd_vars.varToXML(valDict[k], str(k)) xml += "</xml>" ! print >>sys.stderr, "done to xml" cmd = dbg.cmdFactory.makeGetVariableMessage(self.sequence, xml) ! print >>sys.stderr, "sending command" dbg.writer.addCommand(cmd) except Exception, e: ! print >>sys.stderr, "ERROR RESOLVING", str(e) ! cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "Error resolving variables" + str(e)) dbg.writer.addCommand(cmd) --- 310,319 ---- xml += pydevd_vars.varToXML(valDict[k], str(k)) xml += "</xml>" ! # print >>sys.stderr, "done to xml" cmd = dbg.cmdFactory.makeGetVariableMessage(self.sequence, xml) ! # print >>sys.stderr, "sending command" dbg.writer.addCommand(cmd) except Exception, e: ! cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "Error resolving variables " + str(e)) dbg.writer.addCommand(cmd) *************** *** 362,365 **** --- 359,363 ---- self.cmdQueue = {} # the hash of Queues. Key is thread id, value is thread self.breakpoints = {} + self.readyToRun = False def initializeNetwork(self, sock): *************** *** 424,428 **** def postInternalCommand(self, int_cmd, thread_id): """ if thread_id is *, post to all """ ! print "Posting internal command for ", str(thread_id) if (thread_id == "*"): for k in self.cmdQueue.keys(): self.cmdQueue[k].put(int_cmd) --- 422,426 ---- def postInternalCommand(self, int_cmd, thread_id): """ if thread_id is *, post to all """ ! # print "Posting internal command for ", str(thread_id) if (thread_id == "*"): for k in self.cmdQueue.keys(): self.cmdQueue[k].put(int_cmd) *************** *** 444,449 **** try: cmd = None ! # print >>sys.stderr, "processing command", id ! if (id == CMD_VERSION): # response is version number cmd = self.cmdFactory.makeVersionMessage(seq) elif (id == CMD_LIST_THREADS): # response is a list of threads --- 442,448 ---- try: cmd = None ! if (id == CMD_RUN): ! self.readyToRun = True ! elif (id == CMD_VERSION): # response is version number cmd = self.cmdFactory.makeVersionMessage(seq) elif (id == CMD_LIST_THREADS): # response is a list of threads *************** *** 453,460 **** self.postInternalCommand(int_cmd, text) elif (id == CMD_THREAD_SUSPEND): ! print >>sys.stderr, "About to suspend ", text t = findThreadById(text) if t: self.setSuspend(t, CMD_THREAD_SUSPEND) ! else: print >>sys.stderr, "Could not find thread ", t elif (id == CMD_THREAD_RUN): t = findThreadById(text) --- 452,459 ---- self.postInternalCommand(int_cmd, text) elif (id == CMD_THREAD_SUSPEND): ! # print >>sys.stderr, "About to suspend ", text t = findThreadById(text) if t: self.setSuspend(t, CMD_THREAD_SUSPEND) ! # else: print >>sys.stderr, "Could not find thread ", t elif (id == CMD_THREAD_RUN): t = findThreadById(text) *************** *** 483,488 **** # text is file\tline. Add to breakpoints dictionary (file, line) = text.split('\t', 1) - print "line is ", line - print "file is ", file if self.breakpoints.has_key(file): breakDict = self.breakpoints[file] --- 482,485 ---- *************** *** 491,495 **** breakDict[int(line)] = True self.breakpoints[file] = breakDict ! print >>sys.stderr, "Set breakpoint at ", file, line elif (id == CMD_REMOVE_BREAK): # text is file\tline. Remove from breakpoints dictionary --- 488,492 ---- breakDict[int(line)] = True self.breakpoints[file] = breakDict ! log(1, "Set breakpoint at " + file + " " + line) elif (id == CMD_REMOVE_BREAK): # text is file\tline. Remove from breakpoints dictionary *************** *** 506,510 **** else: cmd = self.cmdFactory.makeErrorMessage(seq, "unexpected command " + str(id)) ! print >>sys.stderr, "processed command", id if cmd: self.writer.addCommand(cmd) --- 503,507 ---- else: cmd = self.cmdFactory.makeErrorMessage(seq, "unexpected command " + str(id)) ! log( 1, "processed command " + str (id)) if cmd: self.writer.addCommand(cmd) *************** *** 523,527 **** thread.pydev_notify_kill = False if not wasNotified: ! log(0, "leaving stopped thread " + str(id(thread))) cmd = self.cmdFactory.makeThreadKilledMessage(id(thread)) self.writer.addCommand(cmd) --- 520,524 ---- thread.pydev_notify_kill = False if not wasNotified: ! log(1, "leaving stopped thread " + str(id(thread))) cmd = self.cmdFactory.makeThreadKilledMessage(id(thread)) self.writer.addCommand(cmd) *************** *** 561,565 **** pass ! print >>sys.stderr, "thread resumed", thread.getName() cmd = self.cmdFactory.makeThreadRunMessage(id(thread), thread.pydev_step_cmd) self.writer.addCommand(cmd) --- 558,562 ---- pass ! log(1, "thread resumed " + thread.getName()) cmd = self.cmdFactory.makeThreadRunMessage(id(thread), thread.pydev_step_cmd) self.writer.addCommand(cmd) *************** *** 590,594 **** return self.trace_dispatch except AttributeError: ! print "Attribute ERROR" t.pydev_state = PyDB.STATE_RUN # assign it to avoid future exceptions except: --- 587,591 ---- return self.trace_dispatch except AttributeError: ! # print "Attribute ERROR" t.pydev_state = PyDB.STATE_RUN # assign it to avoid future exceptions except: *************** *** 664,677 **** threading.settrace(self.trace_dispatch) # for all future threads sys.settrace(self.trace_dispatch) # for this thread try: try: - print "exec start" exec cmd in globals, locals - print >>sys.stderr, "Debugger done" except: print >>sys.stderr, "Debugger exiting with exception" raise finally: - print "Quitting now" self.quitting = 1 --- 661,672 ---- threading.settrace(self.trace_dispatch) # for all future threads sys.settrace(self.trace_dispatch) # for this thread + while not self.readyToRun: time.sleep(0.1) # busy wait until we receive run command try: try: exec cmd in globals, locals except: print >>sys.stderr, "Debugger exiting with exception" raise finally: self.quitting = 1 *************** *** 714,721 **** def quittingNow(): ! log(1, "Exit function called. Bye") if __name__ == '__main__': ! print sys.stderr, "pydev debugger" # parse the command line. --file is our last argument that is required try: --- 709,716 ---- def quittingNow(): ! log(1, "Debugger exiting. Over & out....\n") if __name__ == '__main__': ! print >>sys.stderr, "pydev debugger" # parse the command line. --file is our last argument that is required try: Index: pydevd_vars.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd_vars.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pydevd_vars.py 7 May 2004 02:03:07 -0000 1.1 --- pydevd_vars.py 7 May 2004 21:51:00 -0000 1.2 *************** *** 115,126 **** # print "Calling frameVarsToXML" xml = "" ! try: ! keys = frame.f_locals.keys() ! keys.sort() ! for k in keys: ! v = frame.f_locals[k] ! xml += varToXML(v, str(k)) ! except: ! traceback.print_exc() return xml --- 115,123 ---- # print "Calling frameVarsToXML" xml = "" ! keys = frame.f_locals.keys() ! keys.sort() ! for k in keys: ! v = frame.f_locals[k] ! xml += varToXML(v, str(k)) return xml *************** *** 148,157 **** var = frame.f_locals for k in attrList: ! print >>sys.stderr, "resolving ", k ! print >>sys.stderr, "attribute is ", k (type, typeName, resolver) = getType(var) var = resolver.resolve(var, k) ! print >>sys.stderr, "Got variable", var (type, typeName, resolver) = getType(var) return resolver.getDictionary(var) --- 145,154 ---- var = frame.f_locals for k in attrList: ! # print >>sys.stderr, "resolving ", k ! # print >>sys.stderr, "attribute is ", k (type, typeName, resolver) = getType(var) var = resolver.resolve(var, k) ! # print >>sys.stderr, "Got variable", var (type, typeName, resolver) = getType(var) return resolver.getDictionary(var) |