[Pydev-cvs] org.python.pydev.debug/pysrc pydevd.py,1.6,1.7
Brought to you by:
fabioz
From: Aleksandar T. <at...@us...> - 2004-05-26 18:57:09
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30779/pysrc Modified Files: pydevd.py Log Message: Fix for 958736: renamed functions with pydevd prefix to avoid naming conflicts in trace_dispatch Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pydevd.py 17 May 2004 20:17:16 -0000 1.6 --- pydevd.py 26 May 2004 18:56:58 -0000 1.7 *************** *** 76,89 **** __all__ = (); ! _trace = 0 ! ! def log(level, s): """ levels are: ! 0 most serious warnings/errors 1 warnings/significant events 2 informational trace """ ! if (level <= _trace): print >>sys.stderr, s --- 76,89 ---- __all__ = (); + + pydevd_trace = 0 ! def pydevd_log(level, s): """ levels are: ! 0 most serious warnings/errors 1 warnings/significant events 2 informational trace """ ! if (level <= pydevd_trace): print >>sys.stderr, s *************** *** 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] --- 108,112 ---- while (buffer.find('\n') != -1): [command, buffer] = buffer.split('\n', 1) ! pydevd_log(1, "received command " + command) args = command.split('\t', 2) # print "the args are", args[0], " 2 ", args[1], " 3 ", args[2] *************** *** 136,144 **** while(True): cmd = self.cmdQueue.get(1) ! log(1, "sending cmd " + cmd.getOutgoing()) self.sock.sendall(cmd.getOutgoing()) except: ! print >>sys.stderr, "Exception in writer thread" ! raise class NetCommand: --- 136,146 ---- while(True): cmd = self.cmdQueue.get(1) ! pydevd_log(1, "sending cmd " + cmd.getOutgoing()) self.sock.sendall(cmd.getOutgoing()) + except Exception, e: + print >>sys.stderr, "Exception in writer thread", str(e) except: ! print >>sys.stderr, "Exception in writer thread" ! raise class NetCommand: *************** *** 285,289 **** def doIt(self, dbg): ! log(1, "killing " + str(self.thread_id)) cmd = dbg.cmdFactory.makeThreadKilledMessage(self.thread_id) dbg.writer.addCommand(cmd) --- 287,291 ---- def doIt(self, dbg): ! pydevd_log(1, "killing " + str(self.thread_id)) cmd = dbg.cmdFactory.makeThreadKilledMessage(self.thread_id) dbg.writer.addCommand(cmd) *************** *** 318,322 **** dbg.writer.addCommand(cmd) ! def findThreadById(thread_id): try: int_id = int(thread_id) --- 320,324 ---- dbg.writer.addCommand(cmd) ! def pydevd_findThreadById(thread_id): try: int_id = int(thread_id) *************** *** 374,378 **** # TODO untested s = socket(AF_INET, SOCK_STREAM) ! s.bind(port) s.listen(1) newSock, addr = s.accept() --- 376,380 ---- # TODO untested s = socket(AF_INET, SOCK_STREAM) ! s.bind(('', port)) s.listen(1) newSock, addr = s.accept() *************** *** 381,390 **** def startClient(self, host, port): """ connects to a host/port """ ! log(1, "Connecting to " + host + ":" + str(port)) try: s = socket(AF_INET, SOCK_STREAM); s.settimeout(10) # seconds s.connect((host, port)) ! log(1, "Connected.") self.initializeNetwork(s) except timeout, e: --- 383,392 ---- def startClient(self, host, port): """ connects to a host/port """ ! pydevd_log(1, "Connecting to " + host + ":" + str(port)) try: s = socket(AF_INET, SOCK_STREAM); s.settimeout(10) # seconds s.connect((host, port)) ! pydevd_log(1, "Connected.") self.initializeNetwork(s) except timeout, e: *************** *** 414,421 **** cmd = self.cmdFactory.makeThreadCreatedMessage(t) if (cmd): ! log(2, "found a new thread " + str(thread_id)) self.writer.addCommand(cmd) else: ! log(0, "could not find thread by id to register") return self.cmdQueue[thread_id] --- 416,423 ---- cmd = self.cmdFactory.makeThreadCreatedMessage(t) if (cmd): ! pydevd_log(2, "found a new thread " + str(thread_id)) self.writer.addCommand(cmd) else: ! pydevd_log(0, "could not find thread by id to register") return self.cmdQueue[thread_id] *************** *** 434,438 **** while (True): int_cmd = queue.get(False) ! log(2, "processign internal command " + str(int_cmd)) int_cmd.doIt(self) except Empty: --- 436,440 ---- while (True): int_cmd = queue.get(False) ! pydevd_log(2, "processign internal command " + str(int_cmd)) int_cmd.doIt(self) except Empty: *************** *** 453,466 **** 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) if t: t.pydev_state = PyDB.STATE_RUN t.pydev_step_cmd = None elif (id == CMD_STEP_INTO or id == CMD_STEP_OVER or id == CMD_STEP_RETURN): ! t = findThreadById(text) if t: t.pydev_state = PyDB.STATE_RUN --- 455,468 ---- elif (id == CMD_THREAD_SUSPEND): # print >>sys.stderr, "About to suspend ", text ! t = pydevd_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 = pydevd_findThreadById(text) if t: t.pydev_state = PyDB.STATE_RUN t.pydev_step_cmd = None elif (id == CMD_STEP_INTO or id == CMD_STEP_OVER or id == CMD_STEP_RETURN): ! t = pydevd_findThreadById(text) if t: t.pydev_state = PyDB.STATE_RUN *************** *** 473,477 **** else: (scope, attrs) = (scopeattrs, None) ! t = findThreadById(thread_id) if t: int_cmd = InternalGetVariable(seq, t, frame_id, scope, attrs) --- 475,479 ---- else: (scope, attrs) = (scopeattrs, None) ! t = pydevd_findThreadById(thread_id) if t: int_cmd = InternalGetVariable(seq, t, frame_id, scope, attrs) *************** *** 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 --- 490,494 ---- breakDict[int(line)] = True self.breakpoints[file] = breakDict ! pydevd_log(1, "Set breakpoint at " + file + " " + line) elif (id == CMD_REMOVE_BREAK): # text is file\tline. Remove from breakpoints dictionary *************** *** 503,507 **** else: cmd = self.cmdFactory.makeErrorMessage(seq, "unexpected command " + str(id)) ! log( 1, "processed command " + str (id)) if cmd: self.writer.addCommand(cmd) --- 505,509 ---- else: cmd = self.cmdFactory.makeErrorMessage(seq, "unexpected command " + str(id)) ! pydevd_log(1, "processed command " + str (id)) if cmd: 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) --- 522,526 ---- thread.pydev_notify_kill = False if not wasNotified: ! pydevd_log(1, "leaving stopped thread " + str(id(thread))) cmd = self.cmdFactory.makeThreadKilledMessage(id(thread)) 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) --- 560,564 ---- pass ! pydevd_log(1, "thread resumed " + thread.getName()) cmd = self.cmdFactory.makeThreadRunMessage(id(thread), thread.pydev_step_cmd) self.writer.addCommand(cmd) *************** *** 709,713 **** def quittingNow(): ! log(1, "Debugger exiting. Over & out....\n") if __name__ == '__main__': --- 711,715 ---- def quittingNow(): ! pydevd_log(1, "Debugger exiting. Over & out....\n") if __name__ == '__main__': *************** *** 719,724 **** print e usage(1) ! log(2, "Executing file " + setup['file']) ! log(2, "arguments:" + str(sys.argv)) import atexit --- 721,726 ---- print e usage(1) ! pydevd_log(2, "Executing file " + setup['file']) ! pydevd_log(2, "arguments:" + str(sys.argv)) import atexit |