pydev-cvs Mailing List for PyDev for Eclipse (Page 314)
Brought to you by:
fabioz
You can subscribe to this list here.
2004 |
Jan
|
Feb
(4) |
Mar
(48) |
Apr
(56) |
May
(64) |
Jun
(27) |
Jul
(66) |
Aug
(81) |
Sep
(148) |
Oct
(194) |
Nov
(78) |
Dec
(46) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(125) |
Feb
(126) |
Mar
(163) |
Apr
(133) |
May
(115) |
Jun
(307) |
Jul
(387) |
Aug
(417) |
Sep
(283) |
Oct
(148) |
Nov
(45) |
Dec
(53) |
2006 |
Jan
(240) |
Feb
(200) |
Mar
(267) |
Apr
(231) |
May
(245) |
Jun
(361) |
Jul
(142) |
Aug
(12) |
Sep
(210) |
Oct
(99) |
Nov
(7) |
Dec
(30) |
2007 |
Jan
(161) |
Feb
(511) |
Mar
(265) |
Apr
(74) |
May
(147) |
Jun
(151) |
Jul
(94) |
Aug
(68) |
Sep
(98) |
Oct
(144) |
Nov
(26) |
Dec
(36) |
2008 |
Jan
(98) |
Feb
(107) |
Mar
(199) |
Apr
(113) |
May
(119) |
Jun
(112) |
Jul
(92) |
Aug
(71) |
Sep
(101) |
Oct
(16) |
Nov
|
Dec
|
From: Aleksandar T. <at...@us...> - 2004-05-07 02:07:28
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/navigation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14127/src/org/python/pydev/editor/actions/navigation Removed Files: PyMethodNavigation.java PyPreviousMethod.java PyNextMethod.java package.html Log Message: Breakpoints, first cut --- PyPreviousMethod.java DELETED --- --- package.html DELETED --- --- PyNextMethod.java DELETED --- --- PyMethodNavigation.java DELETED --- |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:07:27
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14127 Modified Files: .project plugin.xml Log Message: Breakpoints, first cut Index: .project =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/.project,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .project 10 Apr 2004 02:06:27 -0000 1.2 --- .project 7 May 2004 02:07:18 -0000 1.3 *************** *** 8,11 **** --- 8,13 ---- <project>org.eclipse.core.runtime</project> <project>org.eclipse.jdt.ui</project> + <project>org.eclipse.ui</project> + <project>org.eclipse.ui.views</project> </projects> <buildSpec> Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/plugin.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** plugin.xml 27 Apr 2004 01:07:44 -0000 1.13 --- plugin.xml 7 May 2004 02:07:18 -0000 1.14 *************** *** 132,136 **** definitionId="org.python.pydev.editor.actions.navigation.nextMethod" label="Goto next method or class" ! class="org.python.pydev.editor.actions.navigation.PyNextMethod" menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" id="org.python.pydev.editor.actions.navigation.nextMethod"> --- 132,136 ---- definitionId="org.python.pydev.editor.actions.navigation.nextMethod" label="Goto next method or class" ! class="org.python.pydev.editor.actions.PyNextMethod" menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" id="org.python.pydev.editor.actions.navigation.nextMethod"> *************** *** 139,143 **** definitionId="org.python.pydev.editor.actions.navigation.previousMethod" label="Goto previous method or class" ! class="org.python.pydev.editor.actions.navigation.PyPreviousMethod" menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" id="org.python.pydev.editor.actions.navigation.previousMethod"> --- 139,143 ---- definitionId="org.python.pydev.editor.actions.navigation.previousMethod" label="Goto previous method or class" ! class="org.python.pydev.editor.actions.PyPreviousMethod" menubarPath="org.python.pydev.editor.actions.sourceMenu/addGroup" id="org.python.pydev.editor.actions.navigation.previousMethod"> *************** *** 182,186 **** <action label="Navigate to next method / class" ! class="org.python.pydev.editor.actions.navigation.PyNextMethod" menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" id="org.python.pydev.editor.actions.navigation.nextMethod"> --- 182,186 ---- <action label="Navigate to next method / class" ! class="org.python.pydev.editor.actions.PyNextMethod" menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" id="org.python.pydev.editor.actions.navigation.nextMethod"> *************** *** 188,192 **** <action label="Navigate to previous method / class" ! class="org.python.pydev.editor.actions.navigation.PyPreviousMethod" menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" id="org.python.pydev.editor.actions.navigation.previousMethod"> --- 188,192 ---- <action label="Navigate to previous method / class" ! class="org.python.pydev.editor.actions.PyPreviousMethod" menubarPath="org.python.pydev.editor.actions.editorPopup/addGroup" id="org.python.pydev.editor.actions.navigation.previousMethod"> |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:07:27
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14127/src/org/python/pydev/editor/actions Added Files: PyMethodNavigation.java PyNextMethod.java PyPreviousMethod.java Log Message: Breakpoints, first cut --- NEW FILE: PyPreviousMethod.java --- /* * @author: fabioz * Created: February 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions; import org.python.pydev.editor.model.*; /** * @author Fabio Zadrozny */ public class PyPreviousMethod extends PyMethodNavigation { // me is the last node w public AbstractNode getSelect(AbstractNode me) { AbstractNode current = ModelUtils.getPreviousNode(me); while (current != null && !(current instanceof FunctionNode) && !(current instanceof ClassNode)) current = ModelUtils.getPreviousNode(current); return current; } } --- NEW FILE: PyNextMethod.java --- /* * @author: fabioz * Created: February 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions; import org.python.pydev.editor.model.*; /** * One-trick pony, finds the next method. */ public class PyNextMethod extends PyMethodNavigation{ /** * Gets the next method/class definition */ public AbstractNode getSelect(AbstractNode me ) { AbstractNode current = ModelUtils.getNextNode(me); while (current != null && !(current instanceof FunctionNode) && !(current instanceof ClassNode)) current = ModelUtils.getNextNode(current); return current; } } --- NEW FILE: PyMethodNavigation.java --- /* * @author: fabioz * Created: February 2004 * License: Common Public License v1.0 */ package org.python.pydev.editor.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.ITextSelection; import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.model.*; /** * The trick here is getting the outline... To do that, some refactorings had * to be done to the PyOutlinePage, to get the parsed items and the ParsedItem, * so that it is now public. * * @author Fabio Zadrozny */ public abstract class PyMethodNavigation extends PyAction { /** * This method gets the parsed model, discovers where we are in the * document (through the visitor), and asks the implementing class * to where we should go... */ public void run(IAction action) { PyEdit pyEdit = getPyEdit(); IDocument doc = pyEdit.getDocumentProvider().getDocument(pyEdit.getEditorInput()); ITextSelection selection = (ITextSelection) pyEdit.getSelectionProvider().getSelection(); Location loc = Location.offsetToLocation(doc, selection.getOffset()); AbstractNode closest = ModelUtils.getLessOrEqualNode(pyEdit.getPythonModel(),loc); AbstractNode goHere = getSelect(closest); pyEdit.revealModelNode(goHere); } /** * This method should return to where we should go, depending on * the visitor passed as a parameter (it contains the node where we * are, the next node and the previous node). * * @param v * @return where we should go depending on visitor */ public abstract AbstractNode getSelect(AbstractNode v); } |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:03:47
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13484/pysrc Modified Files: pydevd.py Added Files: pydevd_vars.py Removed Files: inspector.py Log Message: Breakpoints, first cut Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pydevd.py 28 Apr 2004 02:49:48 -0000 1.3 --- pydevd.py 7 May 2004 02:03:07 -0000 1.4 *************** *** 31,35 **** 108 STEP_OVER RDB thread_id 109 STEP_RETURN RDB thread_id ! 500 series diagnostics/ok 901 VERSION either Version string (1.0) Currently just used at startup --- 31,39 ---- 108 STEP_OVER RDB thread_id 109 STEP_RETURN RDB thread_id ! 110 GET_VARIABLE RDB var_locator GET_VARIABLE with XML of var content ! see code for definition ! 111 SET_BREAK RDB file/line of the breakpoint ! 112 REMOVE_BREAK RDB file/line of the return ! 500 series diagnostics/ok 901 VERSION either Version string (1.0) Currently just used at startup *************** *** 49,52 **** --- 53,57 ---- import time import inspect + import pydevd_vars VERSION_STRING = "1.0" *************** *** 61,64 **** --- 66,72 ---- CMD_STEP_OVER = 108 CMD_STEP_RETURN = 109 + CMD_GET_VARIABLE = 110 + CMD_SET_BREAK = 111 + CMD_REMOVE_BREAK = 112 CMD_VERSION = 501 CMD_RETURN = 502 *************** *** 102,106 **** log(2, "received command " + command) args = command.split('\t', 2) ! print "the args are", args[0], " 2 ", args[1], " 3 ", args[2] PyDB.instance.processNetCommand(int(args[0]), int(args[1]), args[2]) # print >>sys.stderr, "processed input" --- 110,114 ---- log(2, "received command " + command) args = command.split('\t', 2) ! # print "the args are", args[0], " 2 ", args[1], " 3 ", args[2] PyDB.instance.processNetCommand(int(args[0]), int(args[1]), args[2]) # print >>sys.stderr, "processed input" *************** *** 178,181 **** --- 186,190 ---- def makeErrorMessage(self, seq, text): cmd = NetCommand(CMD_ERROR, seq, text) + print >>sys.stderr, "Error: ", text return cmd; *************** *** 211,220 **** """ <xml> ! <thread id="id"/> ! <frame id="id" name="functionName " file="file" line="line"> """ try: cmdText = "<xml>" ! cmdText += '<thread id="' + str(thread_id) + '" ' + 'stop_reason="' + str(stop_reason) + '"/>' curFrame = frame while (curFrame): --- 220,232 ---- """ <xml> ! <thread id="id"> ! <frame id="id" name="functionName " file="file" line="line"> ! <var variable stuffff.... ! </frame> ! </thread> """ try: cmdText = "<xml>" ! cmdText += '<thread id="' + str(thread_id) + '" ' + 'stop_reason="' + str(stop_reason) + '">' curFrame = frame while (curFrame): *************** *** 224,235 **** myName = curFrame.f_code.co_name # print "name is ", myName ! myFile = inspect.getsourcefile(curFrame) or inspect.getfile(frame) # print "file is ", myFile myLine = str(curFrame.f_lineno) # print "line is ", myLine cmdText += '<frame id="' + myId +'" name="' + myName + '" ' ! cmdText += 'file="' + myFile + '" line="' + myLine + '"/>"' curFrame = curFrame.f_back ! cmdText += "</xml>" return NetCommand(CMD_THREAD_SUSPEND, 0, cmdText) except: --- 236,251 ---- myName = curFrame.f_code.co_name # print "name is ", myName ! myFile = curFrame.f_code.co_filename ! # myFile = inspect.getsourcefile(curFrame) or inspect.getfile(frame) # print "file is ", myFile myLine = str(curFrame.f_lineno) # print "line is ", myLine cmdText += '<frame id="' + myId +'" name="' + myName + '" ' ! cmdText += 'file="' + myFile + '" line="' + myLine + '">"' ! variables = pydevd_vars.frameVarsToXML(curFrame) ! cmdText += variables ! cmdText += "</frame>" curFrame = curFrame.f_back ! cmdText += "</thread></xml>" return NetCommand(CMD_THREAD_SUSPEND, 0, cmdText) except: *************** *** 242,245 **** --- 258,267 ---- return self.makeErrorMessage(0, sys.exc_info()[0]) + def makeGetVariableMessage(self, seq, payload): + try: + return NetCommand(CMD_GET_VARIABLE, seq, payload) + except Exception, e: + return self.makeErrorMessage(seq, str(e)) + INTERNAL_TERMINATE_THREAD = 1 INTERNAL_SUSPEND_THREAD = 2 *************** *** 269,272 **** --- 291,324 ---- sys.exit() + class InternalGetVariable: + """ gets the value of a variable """ + def __init__(self, seq, thread, frame_id, scope, attrs): + self.sequence = seq + self.thread = thread + self.frame_id = frame_id + self.scope = scope + self.attributes = attrs + + def doIt(self, dbg): + """ 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() + for k in keys: + 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) + def findThreadById(thread_id): try: *************** *** 309,312 **** --- 361,365 ---- self.cmdFactory = NetCommandFactory() self.cmdQueue = {} # the hash of Queues. Key is thread id, value is thread + self.breakpoints = {} def initializeNetwork(self, sock): *************** *** 406,415 **** elif (id == CMD_THREAD_RUN): t = findThreadById(text) ! if t: t.pydev_state = PyDB.STATE_RUN 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 ! t.pydev_step_cmd = id else: cmd = self.cmdFactory.makeErrorMessage(seq, "unexpected command " + str(id)) --- 459,507 ---- 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 ! t.pydev_step_cmd = id ! elif (id == CMD_GET_VARIABLE): ! # text is: thread\tstackframe\tLOCAL|GLOBAL\tattributes* ! (thread_id, frame_id, scopeattrs) = text.split('\t', 2) ! if scopeattrs.find('\t') != -1: # there are attibutes beyond scope ! (scope, attrs) = scopeattrs.split('\t', 1) ! else: ! (scope, attrs) = (scopeattrs, None) ! t = findThreadById(thread_id) ! if t: ! int_cmd = InternalGetVariable(seq, t, frame_id, scope, attrs) ! self.postInternalCommand(int_cmd, thread_id) ! else: ! cmd = self.cmdFactory.makeErrorMessage(seq, "could not find thread for variable") ! elif (id == CMD_SET_BREAK): ! # 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] ! else: ! breakDict = {} ! 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 ! (file, line) = text.split('\t', 1) ! line = int(line) ! if self.breakpoints.has_key(file): ! if self.breakpoints[file].has_key(line): ! del self.breakpoints[file][line] ! keys = self.breakpoints[file].keys() ! if len(keys) is 0: ! del self.breakpoints[file] ! else: ! print sys.stderr, "breakpoint not found", file, str(line) else: cmd = self.cmdFactory.makeErrorMessage(seq, "unexpected command " + str(id)) *************** *** 417,423 **** if cmd: self.writer.addCommand(cmd) ! except: ! print >>sys.stderr, "Unexpected exception in processNetCommand" ! print >>sys.stderr, sys.exc_info()[0] def processThreadNotAlive(self, thread): --- 509,517 ---- if cmd: self.writer.addCommand(cmd) ! except Exception, e: ! import traceback ! traceback.print_exc(e) ! cmd = self.cmdFactory.makeErrorMessage(seq, "Unexpected exception in processNetCommand:" + str(e)) ! self.writer.addCommand(cmd) def processThreadNotAlive(self, thread): *************** *** 456,460 **** thread.pydev_step_stop = None elif (thread.pydev_step_cmd == CMD_STEP_OVER): ! thread.pydev_step_stop = frame elif (thread.pydev_step_cmd == CMD_STEP_RETURN): thread.pydev_step_stop = frame.f_back --- 550,558 ---- thread.pydev_step_stop = None elif (thread.pydev_step_cmd == CMD_STEP_OVER): ! if (event is 'return'): # if we are returning from the function, stop in parent ! print "Stepping back one" ! thread.pydev_step_stop = frame.f_back ! else: ! thread.pydev_step_stop = frame elif (thread.pydev_step_cmd == CMD_STEP_RETURN): thread.pydev_step_stop = frame.f_back *************** *** 478,482 **** --- 576,587 ---- wasSuspended = False + + try: + """ breakpoints """ + file = frame.f_code.co_filename + line = int(frame.f_lineno) + if t.pydev_state != PyDB.STATE_SUSPEND and self.breakpoints.has_key(file) and self.breakpoints[file].has_key(line): + self.setSuspend(t, CMD_SET_BREAK) """ if thread has a suspend flag, we suspend with a busy wait """ if (t.pydev_state == PyDB.STATE_SUSPEND): *************** *** 485,488 **** --- 590,594 ---- return self.trace_dispatch except AttributeError: + print "Attribute ERROR" t.pydev_state = PyDB.STATE_RUN # assign it to avoid future exceptions except: *************** *** 491,500 **** raise ! if ( not wasSuspended and event == 'line'): """ step handling. We stop when we hit the right frame""" try: if (t.pydev_step_cmd == CMD_STEP_INTO): self.setSuspend(t, CMD_STEP_INTO) ! self.doWaitSuspend(t, frame, event, arg) elif (t.pydev_step_cmd == CMD_STEP_OVER or t.pydev_step_cmd == CMD_STEP_RETURN): if (t.pydev_step_stop == frame): --- 597,606 ---- raise ! if ( not wasSuspended and (event == 'line' or event== 'return')): """ step handling. We stop when we hit the right frame""" try: if (t.pydev_step_cmd == CMD_STEP_INTO): self.setSuspend(t, CMD_STEP_INTO) ! self.doWaitSuspend(t, frame, event, arg) elif (t.pydev_step_cmd == CMD_STEP_OVER or t.pydev_step_cmd == CMD_STEP_RETURN): if (t.pydev_step_stop == frame): --- inspector.py DELETED --- --- NEW FILE: pydevd_vars.py --- """ pydevd_vars deals with variables: resolution/conversion to XML. """ from types import * import urllib import threading import sys class VariableError(Exception): def __init__(self, message): Exception.__init__(self, message) class Resolver: """ prototype resolver class. Every container type should have a resolver that converts its members into a dictionary """ def resolve(self, var, attribute): if attribute is "implement": return "me" def getDictionary(self, var): return { "implement" : "me", "volunteers" : "needed" } class DictResolver(Resolver): def resolve(self, var, attribute): return var[attribute] def getDictionary(self, var): return var class ObjectResolver(Resolver): def resolve(self, var, attribute): if attribute is "__class__": return var.__class__ return getattr(var, attribute) def getDictionary(self, var): newDict = vars(var).copy() newDict['__class__'] = var.__class__ return newDict class TupleResolver(Resolver): def resolve(self, var, attribute): return var[int(attribute)] def getDictionary(self, var): newDict = {} i = 0; for x in var: newDict[i] = x i += 1 return newDict defaultResolver = Resolver() dictResolver = DictResolver() objectResolver = ObjectResolver() tupleResolver = TupleResolver() def getType(o): """ returns a triple (typeObject, typeString, resolver resolver != None means that variable is a container, and should be displayed as a hierarchy. Use the resolver to get its attributes. All container objects should have a resolver. """ if isinstance(o, NoneType): return (NoneType, "None", None) if isinstance(o, IntType): return (IntType, "int", None) if isinstance(o, LongType): return (LongType, "long", None) if isinstance(o, FloatType): return (FloatType, "float", None) if isinstance(o, BooleanType): return (BooleanType, "boolean", None) if isinstance(o, ComplexType): return (ComplexType, "ComplexType", None) if isinstance(o, StringType): return (StringType, "string", None) if isinstance(o, UnicodeType): return (UnicodeType, "UnicodeType", None) if isinstance(o, BufferType): return (BufferType, "BufferType", None) if isinstance(o, TupleType): return (TupleType, "tuple", tupleResolver) if isinstance(o, ListType): return (ListType, "list", tupleResolver) if isinstance(o, DictType): return (DictType, "dict", dictResolver) if isinstance(o, FunctionType): return (FunctionType, "FunctionType", defaultResolver) if isinstance(o, LambdaType): return (LambdaType, "LambdaType", defaultResolver) if isinstance(o, GeneratorType): return (GeneratorType, "GeneratorType", None) if isinstance(o, ClassType): return (ClassType, "ClassType", defaultResolver) if isinstance(o, UnboundMethodType): return (UnboundMethodType, "UnboundMethodType", defaultResolver) if isinstance(o, InstanceType): return (InstanceType, "InstanceType", defaultResolver) if isinstance(o, BuiltinFunctionType): return (BuiltinFunctionType, "built-in function", None) if isinstance(o, BuiltinMethodType): return (BuiltinMethodType, "built-in method", None) if isinstance(o, ModuleType): return (ModuleType, "ModuleType", defaultResolver) if isinstance(o, FileType): return (FileType, "FileType", defaultResolver) if isinstance(o, XRangeType): return (XRangeType, "XRangeType", defaultResolver) if isinstance(o, TracebackType): return (TracebackType, "TracebackType", defaultResolver) if isinstance(o, FrameType): return (FrameType, "FrameType", defaultResolver) if isinstance(o, SliceType): return (SliceType, "SliceType", defaultResolver) if isinstance(o, EllipsisType): return (EllipsisType, "Ellipsis", defaultResolver) if isinstance(o, DictProxyType): return (DictProxyType, "DictProxyType", defaultResolver) if isinstance(o, NotImplementedType): return (NotImplementedType, "Not implemented type", None) if isinstance(o, ObjectType): return (ObjectType, "ObjectType", objectResolver) def varToXML(v, name): """ single variable or dictionary to xml representation """ xml = "" (type, typeName, resolver) = getType(v) value = str(v) xml += '<var name="' + name + '" type="' + typeName + '"' if value: xml += ' value="' + urllib.quote(value, '/>_= \t') + '"' if resolver is not None: xml += ' isContainer="True"' xml += ' />\n' return xml def frameVarsToXML(frame): """ dumps frame variables to XML <var name="var_name" scope="local" type="type" value="value"/> """ # 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 def findFrame(thread, frame_id): """ returns a frame on the thread that has a given frame_id """ # print "thread is ", str(thread) # print "current thread is", str(threading.currentThread) if thread != threading.currentThread() : raise VariableError("findFrame: must execute on same thread") curFrame = sys._getframe() if frame_id == "*": return curFrame # any frame is specified with "*" lookingFor = int(frame_id) while (curFrame != None and lookingFor != id(curFrame)): curFrame = curFrame.f_back if curFrame == None : raise VariableError("findFrame: frame not found") return curFrame def resolveCompoundVariable(thread, frame_id, scope, attrs): """ returns the value of the compound variable as a dictionary""" frame = findFrame(thread, frame_id) attrList = attrs.split('\t') if (scope == "GLOBAL"): var = frame.f_globals del attrList[0] # globals are special, and they get a single dummy unused attribute else: 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) |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:03:46
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13484/src/org/python/pydev/debug/ui/launching Modified Files: PythonRunner.java PythonLaunchConfigurationDelegate.java PythonRunnerConfig.java Log Message: Breakpoints, first cut Index: PythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunner.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PythonRunner.java 5 May 2004 02:01:58 -0000 1.5 --- PythonRunner.java 7 May 2004 02:03:06 -0000 1.6 *************** *** 14,18 **** import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; - import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.debug.core.DebugPlugin; --- 14,17 ---- *************** *** 53,57 **** Process p = DebugPlugin.exec(cmdLine, config.workingDirectory); if (p == null) ! throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "Could not execute python process. Was it cancelled?", null)); IProcess process = registerWithDebugPlugin(config, launch, p); --- 52,56 ---- Process p = DebugPlugin.exec(cmdLine, config.workingDirectory); if (p == null) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR,"Could not execute python process. Was it cancelled?", null)); IProcess process = registerWithDebugPlugin(config, launch, p); *************** *** 71,75 **** if (ex instanceof SocketTimeoutException) message = "Timed out after " + Float.toString(config.acceptTimeout/1000) + " seconds while waiting for python script to connect."; ! throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, message, ex)); } subMonitor.subTask("Done"); --- 70,74 ---- if (ex instanceof SocketTimeoutException) message = "Timed out after " + Float.toString(config.acceptTimeout/1000) + " seconds while waiting for python script to connect."; ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, message, ex)); } subMonitor.subTask("Done"); *************** *** 103,107 **** Process p = DebugPlugin.exec(cmdLine, config.workingDirectory); if (p == null) ! throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "Could not execute python process. Was it cancelled?", null)); // Register the process with the debug plugin --- 102,106 ---- Process p = DebugPlugin.exec(cmdLine, config.workingDirectory); if (p == null) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); // Register the process with the debug plugin Index: PythonRunnerConfig.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PythonRunnerConfig.java 22 Apr 2004 10:56:17 -0000 1.3 --- PythonRunnerConfig.java 7 May 2004 02:03:06 -0000 1.4 *************** *** 14,18 **** import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; - import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchManager; --- 14,17 ---- *************** *** 63,67 **** debugPort= SocketUtil.findUnusedLocalPort("", 5000, 15000); //$NON-NLS-1$ if (debugPort == -1) ! throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "Could not find a free socket for debugger", null)); } return debugPort; --- 62,66 ---- debugPort= SocketUtil.findUnusedLocalPort("", 5000, 15000); //$NON-NLS-1$ if (debugPort == -1) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not find a free socket for debugger", null)); } return debugPort; *************** *** 79,88 **** if (file == null || interpreter == null) ! throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "Invalid PythonRunnerConfig",null)); if (isDebug && ( acceptTimeout < 0 || debugPort < 0 || debugScript == null)) ! throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "Invalid PythonRunnerConfig",null)); } --- 78,87 ---- if (file == null || interpreter == null) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Invalid PythonRunnerConfig",null)); if (isDebug && ( acceptTimeout < 0 || debugPort < 0 || debugScript == null)) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Invalid PythonRunnerConfig",null)); } *************** *** 96,100 **** URL location = org.python.pydev.debug.core.PydevDebugPlugin.getDefault().find(relative); if (location == null) ! throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "Internal pydev error: Cannot find jpydaemon.py", null)); return location.getPath(); } --- 95,99 ---- URL location = org.python.pydev.debug.core.PydevDebugPlugin.getDefault().find(relative); if (location == null) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Internal pydev error: Cannot find pydevd.py", null)); return location.getPath(); } Index: PythonLaunchConfigurationDelegate.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonLaunchConfigurationDelegate.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PythonLaunchConfigurationDelegate.java 15 Apr 2004 23:24:49 -0000 1.5 --- PythonLaunchConfigurationDelegate.java 7 May 2004 02:03:06 -0000 1.6 *************** *** 12,16 **** import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; - import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; --- 12,15 ---- *************** *** 57,61 **** } catch (IOException e) { e.printStackTrace(); ! throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "Unexpected IO Exception in Pydev debugger", null)); } // ClassLoader save = cur.getContextClassLoader(); --- 56,60 ---- } catch (IOException e) { e.printStackTrace(); ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected IO Exception in Pydev debugger", null)); } // ClassLoader save = cur.getContextClassLoader(); |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:03:46
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13484/src/org/python/pydev/debug/model Modified Files: PyDebugTarget.java Added Files: PyDebugModelPresentation.java PyBreakpoint.java Log Message: Breakpoints, first cut --- NEW FILE: PyBreakpoint.java --- /* * Author: atotic * Created on Apr 28, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.model.LineBreakpoint; /** * Represents python breakpoint. * */ public class PyBreakpoint extends LineBreakpoint { static public final String PY_BREAK_MARKER = "org.python.pydev.debug.pyStopBreakpointMarker"; static public final String FUNCTION_NAME_PROP = "pydev.function_name"; public PyBreakpoint() { } public String getModelIdentifier() { return PyDebugModelPresentation.PY_DEBUG_MODEL_ID; } public String getFile() { IResource r = getMarker().getResource(); return r.getLocation().toOSString(); } public Object getLine() { try { return getMarker().getAttribute(IMarker.LINE_NUMBER); } catch (CoreException e) { return ""; } } } --- NEW FILE: PyDebugModelPresentation.java --- /* * Author: atotic * Created on May 6, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model; import java.util.Map; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IValueDetailListener; import org.eclipse.jface.util.ListenerList; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.IEditorInput; import org.python.pydev.debug.core.PydevDebugPlugin; /** * Provides decoration for model elements in the debugger interface. */ public class PyDebugModelPresentation implements IDebugModelPresentation { static public String PY_DEBUG_MODEL_ID = "org.python.pydev.debug"; protected ListenerList fListeners= new ListenerList(); public Image getImage(Object element) { if (element instanceof PyBreakpoint) { try { if (((PyBreakpoint)element).isEnabled()) return PydevDebugPlugin.getImageCache().get("icons/breakmarker.gif"); else return PydevDebugPlugin.getImageCache().get("icons/breakmarker_gray.gif"); } catch (CoreException e) { PydevDebugPlugin.log(IStatus.ERROR, "getImage error", e); } } else if (element instanceof PyDebugTarget || element instanceof PyThread || element instanceof PyStackFrame) return null; return null; } public String getText(Object element) { if (element instanceof PyBreakpoint) { IMarker marker = ((PyBreakpoint)element).getMarker(); try { Map attrs = marker.getAttributes(); // Set set = attrs.keySet(); // for (Iterator i = set.iterator(); i.hasNext();) // System.out.println(i.next().toString()); IResource resource = marker.getResource(); String file = resource.getFullPath().lastSegment(); Object lineNumber = attrs.get(IMarker.LINE_NUMBER); String functionName = (String)attrs.get(PyBreakpoint.FUNCTION_NAME_PROP); if (file == null) file = "unknown"; if (lineNumber == null) lineNumber = "unknown"; String location = file + ":" + lineNumber.toString(); if (functionName == null) return location; else return functionName + " [" + location + "]"; } catch (CoreException e) { PydevDebugPlugin.log(IStatus.ERROR, "error retreiving marker attributes", e); return "error"; } } else if (element instanceof PyDebugTarget || element instanceof PyStackFrame || element instanceof PyThread) { return null; } PydevDebugPlugin.log(IStatus.ERROR, "unknown debug type", null); return null; } /** * override * TODO comment this method */ public void computeDetail(IValue value, IValueDetailListener listener) { // TODO Auto-generated method stub System.out.println("in detail"); } /** * override * TODO comment this method */ public IEditorInput getEditorInput(Object element) { // TODO Auto-generated method stub return null; } /** * override * TODO comment this method */ public String getEditorId(IEditorInput input, Object element) { // TODO Auto-generated method stub return null; } public void setAttribute(String attribute, Object value) { // TODO Auto-generated method stub System.out.println("setattribute"); } public void addListener(ILabelProviderListener listener) { fListeners.add(listener); } public void removeListener(ILabelProviderListener listener) { fListeners.remove(listener); } public void dispose() { } public boolean isLabelProperty(Object element, String property) { // Not really sure what this does. see IBaseLabelProvider:isLabelProperty return false; } } Index: PyDebugTarget.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyDebugTarget.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyDebugTarget.java 5 May 2004 02:02:00 -0000 1.4 --- PyDebugTarget.java 7 May 2004 02:03:07 -0000 1.5 *************** *** 20,23 **** --- 20,24 ---- import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; + import org.eclipse.debug.core.IBreakpointManager; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchListener; *************** *** 34,41 **** /** ! * ! * TODO Comment this class ! * Make sure we fire the right org.eclipse.debug.core.DebugEvents ! * What happens with debug events? see LaunchViewEventHandler */ public class PyDebugTarget extends PlatformObject implements IDebugTarget, ILaunchListener { --- 35,42 ---- /** ! * Debugger class that represents a single python process. ! * ! * It deals with events from RemoteDebugger. ! * Breakpoint updating. */ public class PyDebugTarget extends PlatformObject implements IDebugTarget, ILaunchListener { *************** *** 59,62 **** --- 60,65 ---- launch.addDebugTarget(this); debugger.setTarget(this); + IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); + breakpointManager.addBreakpointListener(this); // we have to know when we get removed, so that we can shut off the debugger DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this); *************** *** 75,78 **** --- 78,83 ---- // shut down the remote debugger when parent launch if (launch == this.launch) { + IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); + breakpointManager.removeBreakpointListener(this); debugger.dispose(); debugger = null; *************** *** 90,94 **** // From IDebugElement public String getModelIdentifier() { ! return PydevDebugPlugin.getPluginID(); } // From IDebugElement --- 95,99 ---- // From IDebugElement public String getModelIdentifier() { ! return PyDebugModelPresentation.PY_DEBUG_MODEL_ID; } // From IDebugElement *************** *** 192,211 **** public boolean supportsBreakpoint(IBreakpoint breakpoint) { ! // TODO Auto-generated method stub ! return false; } public void breakpointAdded(IBreakpoint breakpoint) { ! // TODO Auto-generated method stub ! } public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { ! // TODO Auto-generated method stub ! } public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { ! // TODO Auto-generated method stub ! } --- 197,224 ---- public boolean supportsBreakpoint(IBreakpoint breakpoint) { ! return breakpoint instanceof PyBreakpoint; } + public void breakpointAdded(IBreakpoint breakpoint) { ! if (breakpoint instanceof PyBreakpoint) { ! PyBreakpoint b = (PyBreakpoint)breakpoint; ! SetBreakpointCommand cmd = new SetBreakpointCommand(debugger, b.getFile(), b.getLine()); ! debugger.postCommand(cmd); ! } } public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { ! if (breakpoint instanceof PyBreakpoint) { ! PyBreakpoint b = (PyBreakpoint)breakpoint; ! RemoveBreakpointCommand cmd = new RemoveBreakpointCommand(debugger, b.getFile(), b.getLine()); ! debugger.postCommand(cmd); ! } } public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { ! if (breakpoint instanceof PyBreakpoint) { ! breakpointRemoved(breakpoint, null); ! breakpointAdded(breakpoint); ! } } *************** *** 337,340 **** --- 350,355 ---- else if (stopReason_i == AbstractDebuggerCommand.CMD_THREAD_SUSPEND) reason = DebugEvent.CLIENT_REQUEST; + else if (stopReason_i == AbstractDebuggerCommand.CMD_SET_BREAK) + reason = DebugEvent.BREAKPOINT; else { PydevDebugPlugin.log(IStatus.ERROR, "Unexpected reason for suspension", null); |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:03:23
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13484/src/org/python/pydev/debug/model/remote Modified Files: VersionCommand.java ThreadListCommand.java GetVariableCommand.java StepCommand.java RemoteDebugger.java ThreadKillCommand.java ThreadSuspendCommand.java ThreadRunCommand.java AbstractDebuggerCommand.java Added Files: SetBreakpointCommand.java RemoveBreakpointCommand.java Log Message: Breakpoints, first cut Index: RemoteDebugger.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/RemoteDebugger.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RemoteDebugger.java 5 May 2004 02:02:01 -0000 1.1 --- RemoteDebugger.java 7 May 2004 02:03:08 -0000 1.2 *************** *** 14,18 **** import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; - import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.model.IProcess; import org.python.pydev.debug.core.PydevDebugPlugin; --- 14,17 ---- *************** *** 261,265 **** if (errorMessage.length() != 0) // not sure if this is really an error ! throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "Something got printed in the error stream", null)); } catch (IllegalThreadStateException e) { // expected while process is alive --- 260,264 ---- if (errorMessage.length() != 0) // not sure if this is really an error ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Something got printed in the error stream", null)); } catch (IllegalThreadStateException e) { // expected while process is alive Index: ThreadKillCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ThreadKillCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ThreadKillCommand.java 5 May 2004 02:02:01 -0000 1.1 --- ThreadKillCommand.java 7 May 2004 02:03:08 -0000 1.2 *************** *** 20,24 **** public String getOutgoing() { ! return makeCommand(Integer.toString(CMD_THREAD_KILL), sequence, thread_id); } --- 20,24 ---- public String getOutgoing() { ! return makeCommand(CMD_THREAD_KILL, sequence, thread_id); } Index: ThreadListCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ThreadListCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ThreadListCommand.java 5 May 2004 02:02:01 -0000 1.1 --- ThreadListCommand.java 7 May 2004 02:03:08 -0000 1.2 *************** *** 45,49 **** public String getOutgoing() { ! return makeCommand(Integer.toString(CMD_LIST_THREADS), sequence, ""); } --- 45,49 ---- public String getOutgoing() { ! return makeCommand(CMD_LIST_THREADS, sequence, ""); } Index: ThreadSuspendCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ThreadSuspendCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ThreadSuspendCommand.java 5 May 2004 02:02:01 -0000 1.1 --- ThreadSuspendCommand.java 7 May 2004 02:03:08 -0000 1.2 *************** *** 21,25 **** public String getOutgoing() { ! return makeCommand(Integer.toString(CMD_THREAD_SUSPEND), sequence, thread); } } --- 21,25 ---- public String getOutgoing() { ! return makeCommand(CMD_THREAD_SUSPEND, sequence, thread); } } Index: StepCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/StepCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StepCommand.java 5 May 2004 02:02:01 -0000 1.1 --- StepCommand.java 7 May 2004 02:03:08 -0000 1.2 *************** *** 25,29 **** public String getOutgoing() { ! return makeCommand(Integer.toString(command_id), sequence, thread_id); } --- 25,29 ---- public String getOutgoing() { ! return makeCommand(command_id, sequence, thread_id); } Index: VersionCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/VersionCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VersionCommand.java 5 May 2004 02:02:01 -0000 1.1 --- VersionCommand.java 7 May 2004 02:03:07 -0000 1.2 *************** *** 23,27 **** public String getOutgoing() { ! return makeCommand(Integer.toString(CMD_VERSION), sequence, VERSION); } --- 23,27 ---- public String getOutgoing() { ! return makeCommand(CMD_VERSION, sequence, VERSION); } Index: ThreadRunCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ThreadRunCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ThreadRunCommand.java 5 May 2004 02:02:01 -0000 1.1 --- ThreadRunCommand.java 7 May 2004 02:03:08 -0000 1.2 *************** *** 19,23 **** public String getOutgoing() { ! return makeCommand(Integer.toString(CMD_THREAD_RUN), sequence, thread); } } --- 19,23 ---- public String getOutgoing() { ! return makeCommand(CMD_THREAD_RUN, sequence, thread); } } --- NEW FILE: RemoveBreakpointCommand.java --- /* * Author: atotic * Created on May 6, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; /** * Remove breakpoint command */ public class RemoveBreakpointCommand extends AbstractDebuggerCommand { public String file; public Object line; public RemoveBreakpointCommand(RemoteDebugger debugger, String file, Object line) { super(debugger); this.file = file; this.line = line; } public String getOutgoing() { return makeCommand(CMD_REMOVE_BREAK, sequence, file + "\t" + line.toString()); } } Index: AbstractDebuggerCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/AbstractDebuggerCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractDebuggerCommand.java 5 May 2004 02:02:01 -0000 1.1 --- AbstractDebuggerCommand.java 7 May 2004 02:03:08 -0000 1.2 *************** *** 42,45 **** --- 42,47 ---- static public final int CMD_STEP_RETURN = 109; static public final int CMD_GET_VARIABLE = 110; + static public final int CMD_SET_BREAK = 111; + static public final int CMD_REMOVE_BREAK = 112; static public final int CMD_ERROR = 901; static public final int CMD_VERSION = 501; *************** *** 117,121 **** } ! public static String makeCommand(String code, int sequence, String payload) { StringBuffer s = new StringBuffer(); s.append(code); --- 119,123 ---- } ! public static String makeCommand(int code, int sequence, String payload) { StringBuffer s = new StringBuffer(); s.append(code); --- NEW FILE: SetBreakpointCommand.java --- /* * Author: atotic * Created on May 6, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; /** * Set breakpoint command. */ public class SetBreakpointCommand extends AbstractDebuggerCommand { public String file; public Object line; public SetBreakpointCommand(RemoteDebugger debugger, String file, Object line) { super(debugger); this.file = file; this.line = line; } public String getOutgoing() { return makeCommand(CMD_SET_BREAK, sequence, file + "\t" + line.toString()); } } Index: GetVariableCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/GetVariableCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GetVariableCommand.java 5 May 2004 02:02:01 -0000 1.1 --- GetVariableCommand.java 7 May 2004 02:03:08 -0000 1.2 *************** *** 8,12 **** import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; - import org.eclipse.core.runtime.Status; import org.python.pydev.debug.core.PydevDebugPlugin; --- 8,11 ---- *************** *** 30,34 **** public String getOutgoing() { ! return makeCommand(Integer.toString(CMD_GET_VARIABLE), sequence, locator); } --- 29,33 ---- public String getOutgoing() { ! return makeCommand(CMD_GET_VARIABLE, sequence, locator); } *************** *** 56,62 **** if (isError) throw new CoreException( ! new Status(IStatus.ERROR, ! PydevDebugPlugin.getPluginID(), ! 0, "pydevd error:" + payload , null)); --- 55,59 ---- if (isError) throw new CoreException( ! PydevDebugPlugin.makeStatus(IStatus.ERROR, "pydevd error:" + payload , null)); |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:03:23
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13484 Modified Files: .project Changes.txt plugin.xml Log Message: Breakpoints, first cut Index: .project =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/.project,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .project 15 Apr 2004 23:24:50 -0000 1.3 --- .project 7 May 2004 02:03:11 -0000 1.4 *************** *** 8,11 **** --- 8,14 ---- <project>org.eclipse.core.resources</project> <project>org.eclipse.core.runtime</project> + <project>org.eclipse.debug.core</project> + <project>org.eclipse.ui</project> + <project>org.eclipse.ui.views</project> <project>org.python.pydev</project> </projects> *************** *** 30,33 **** --- 33,37 ---- <nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.python.pydev.pythonNature</nature> </natures> </projectDescription> Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/Changes.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Changes.txt 15 Apr 2004 23:24:50 -0000 1.1 --- Changes.txt 7 May 2004 02:03:11 -0000 1.2 *************** *** 5,7 **** org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation is a big class implementing this ! org.eclipse.cdt.launch.internal.LocalCLaunchConfigurationDelegate launches a debugged C program \ No newline at end of file --- 5,12 ---- org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation is a big class implementing this ! org.eclipse.cdt.launch.internal.LocalCLaunchConfigurationDelegate launches a debugged C program ! ! ! Future ideas: ! - changing the values API inside PyVariable ! - better variable refresh \ No newline at end of file Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** plugin.xml 5 May 2004 02:02:50 -0000 1.8 --- plugin.xml 7 May 2004 02:03:11 -0000 1.9 *************** *** 84,88 **** icon="icons/python.gif" tooltip="Debug python script" ! class="org.python.pydev.debug.ui.launching.PythonRunActionDelegate" menubarPath="org.python.pydev.debug.WorkspaceMenu/group1" enablesFor="1" --- 84,88 ---- icon="icons/python.gif" tooltip="Debug python script" ! class="org.python.pydev.debug.ui.actions.PythonRunActionDelegate" menubarPath="org.python.pydev.debug.WorkspaceMenu/group1" enablesFor="1" *************** *** 93,97 **** icon="icons/python.gif" tooltip="Run a python script" ! class="org.python.pydev.debug.ui.launching.PythonRunActionDelegate" menubarPath="org.python.pydev.debug.WorkspaceMenu/group1" enablesFor="1" --- 93,97 ---- icon="icons/python.gif" tooltip="Run a python script" ! class="org.python.pydev.debug.ui.actions.PythonRunActionDelegate" menubarPath="org.python.pydev.debug.WorkspaceMenu/group1" enablesFor="1" *************** *** 134,193 **** <editorContribution id="org.python.pydev.debug.BreakpointRulerActions" ! targetID="org.python.pydev.editor.PyEdit"> <action id="org.python.pydev.debug.BreakpointRulerAction" actionID="RulerDoubleClick" label="Add breakpoint" ! class="org.python.pydev.debug.ui.ManageBreakpointRulerActionDelegate"> </action> ! </editorContribution> </extension> <!-- breakpoint popup menu --> ! <!-- <extension point="org.eclipse.ui.popupMenus"> <viewerContribution id="org.python.pydev.debug.PyEditPopupActions" ! targetID="#ClassFileRulerContext"> ! <action ! id="org.eclipse.jdt.ui.actions.JavaBreakpointPropertiesRulerActionDelegate" ! label="%JavaBreakpointProperties.label" menubarPath="debug" - helpContextId="breakpoint_properties_action_context" class="org.eclipse.jdt.internal.debug.ui.actions.JavaBreakpointPropertiesRulerActionDelegate"> </action> <action id="org.eclipse.jdt.ui.actions.EnableDisableBreakpointRulerActionDelegate" ! label="%EnableBreakpoint.label" menubarPath="debug" helpContextId="enable_disable_breakpoint_action_context" class="org.eclipse.jdt.internal.debug.ui.actions.EnableDisableBreakpointRulerActionDelegate"> ! </action> <action id="org.eclipse.jdt.ui.actions.ManageBreakpointRulerActionDelegate" ! label="%AddBreakpoint.label" menubarPath="debug" ! helpContextId="manage_breakpoint_action_context" ! class="org.eclipse.jdt.internal.debug.ui.actions.ManageBreakpointRulerActionDelegate"> </action> </viewerContribution> ! <extension> --> <!--- breakpoint marker --> ! <extension ! point="org.eclipse.core.resources.markers" ! id="pyStopBreakpointMarker"> ! <super type="org.eclipse.debug.core.breakpointMarker"/> ! <persistent value="true"/> ! <attribute name="org.eclipse.cdt.debug.core.condition"/> ! <attribute name="org.eclipse.cdt.debug.core.ignoreCount"/> ! <attribute name="org.eclipse.cdt.debug.core.threadId"/> ! <attribute name="org.eclipse.cdt.debug.core.installCount"/> ! </extension> ! <extension ! point="org.eclipse.debug.core.breakpoints"> ! <breakpoint id="pythonStopBreakpoint" ! markerType="pyStopBreakpointMarker" ! class="org.python.pydev.debug.core.breakpoints.PyStopBreakpoint" ! /> ! </extension> </plugin> --- 134,221 ---- <editorContribution id="org.python.pydev.debug.BreakpointRulerActions" ! targetID="org.python.pydev.editor.PythonEditor"> <action id="org.python.pydev.debug.BreakpointRulerAction" actionID="RulerDoubleClick" label="Add breakpoint" ! class="org.python.pydev.debug.ui.actions.ManageBreakpointRulerActionDelegate"> </action> ! </editorContribution> </extension> <!-- breakpoint popup menu --> ! <extension point="org.eclipse.ui.popupMenus"> <viewerContribution id="org.python.pydev.debug.PyEditPopupActions" ! targetID="#TextRulerContext"> ! <!-- <action ! id="org.python.pydev.actions.JavaBreakpointPropertiesRulerActionDelegate" ! label="Breakpoint properties" menubarPath="debug" class="org.eclipse.jdt.internal.debug.ui.actions.JavaBreakpointPropertiesRulerActionDelegate"> </action> <action id="org.eclipse.jdt.ui.actions.EnableDisableBreakpointRulerActionDelegate" ! label="Enable breakpoint" menubarPath="debug" helpContextId="enable_disable_breakpoint_action_context" class="org.eclipse.jdt.internal.debug.ui.actions.EnableDisableBreakpointRulerActionDelegate"> ! </action> --> <action id="org.eclipse.jdt.ui.actions.ManageBreakpointRulerActionDelegate" ! label="Add Breakpoint" menubarPath="debug" ! class="org.python.pydev.debug.ui.actions.ManageBreakpointRulerActionDelegate"> </action> </viewerContribution> ! </extension> ! ! <!-- breakpoints ! need a marker to mark the breakpoint ! breakpoint associated with marker for BreakpointManager ! marker image provider to provide name for the marker --> + <!-- org.eclipse.debug.core.breakpointMarker --> + <extension + point="org.eclipse.core.resources.markers" + id="pyStopBreakpointMarker"> + <super type="org.eclipse.debug.core.lineBreakpointMarker"/> + <persistent value="true"/> + <attribute name="org.eclipse.cdt.debug.core.condition"/> + </extension> + <extension + point="org.eclipse.debug.core.breakpoints"> + <breakpoint id="pythonStopBreakpoint" + markerType="org.python.pydev.debug.pyStopBreakpointMarker" + class="org.python.pydev.debug.model.PyBreakpoint" + /> + </extension> + <extension + point="org.eclipse.ui.markerImageProviders"> + <imageprovider id="pythonBreakPointImage" + markertype="org.python.pydev.debug.pyStopBreakpointMarker" + icon="icons/breakmarker.gif"/> + </extension> + <extension point = "org.eclipse.debug.ui.debugModelPresentations"> + <debugModelPresentation + class = "org.python.pydev.debug.model.PyDebugModelPresentation" + id = "org.python.pydev.debug"> + </debugModelPresentation> + </extension> <!--- breakpoint marker --> ! <!--- <extension id="breakpointMarker" point="org.eclipse.core.resources.markers"> ! <super type="org.eclipse.core.resources.marker"/> ! <persistent value="true"/> ! <attribute name="org.eclipse.debug.core.modelIdentifier"/> ! <attribute name="org.eclipse.debug.core.enabled"/> ! <attribute name="org.eclipse.debug.core.registered"/> ! <attribute name="org.eclipse.debug.core.persisted"/> ! </extension> ! <extension id="lineBreakpointMarker" point="org.eclipse.core.resources.markers"> ! <super type="org.eclipse.debug.core.breakpointMarker"/> ! <super type="org.eclipse.core.resources.textmarker"/> ! <persistent value="true"/> ! </extension> --> ! </plugin> + |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:03:19
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13484/src/org/python/pydev/debug/core Modified Files: PydevDebugPlugin.java Log Message: Breakpoints, first cut Index: PydevDebugPlugin.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core/PydevDebugPlugin.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PydevDebugPlugin.java 5 May 2004 02:02:01 -0000 1.4 --- PydevDebugPlugin.java 7 May 2004 02:03:10 -0000 1.5 *************** *** 7,10 **** --- 7,11 ---- import org.eclipse.core.resources.*; import org.eclipse.jface.dialogs.ErrorDialog; + import org.python.pydev.ui.ImageCache; /** * The main plugin for Python Debugger. *************** *** 15,22 **** //The shared instance. private static PydevDebugPlugin plugin; ! public PydevDebugPlugin(IPluginDescriptor descriptor) { super(descriptor); plugin = this; } --- 16,26 ---- //The shared instance. private static PydevDebugPlugin plugin; ! ! public ImageCache imageCache; ! public PydevDebugPlugin(IPluginDescriptor descriptor) { super(descriptor); plugin = this; + imageCache = new ImageCache(getDescriptor().getInstallURL()); } *************** *** 33,36 **** --- 37,44 ---- } + public static ImageCache getImageCache() { + return plugin.imageCache; + } + protected void initializeDefaultPluginPreferences() { PydevDebugPrefs.initializeDefaultPreferences(getPluginPreferences()); *************** *** 59,63 **** Shell shell = window == null ? null : window.getShell(); if (shell != null) { ! IStatus status= new Status(IStatus.ERROR, getPluginID(), 0, "Error logged from Pydev Debug: ", t); ErrorDialog.openError(shell, "Its an error", message, status); } --- 67,71 ---- Shell shell = window == null ? null : window.getShell(); if (shell != null) { ! IStatus status= makeStatus(IStatus.ERROR, "Error logged from Pydev Debug: ", t); ErrorDialog.openError(shell, "Its an error", message, status); } |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:03:18
|
Update of /cvsroot/pydev/org.python.pydev.debug/icons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13484/icons Added Files: breakmarker.gif breakmarker_gray.gif Log Message: Breakpoints, first cut --- NEW FILE: breakmarker.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: breakmarker_gray.gif --- (This appears to be a binary file; contents omitted.) |
From: Aleksandar T. <at...@us...> - 2004-05-07 02:03:16
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13484/src/org/python/pydev/debug/ui/actions Added Files: BreakpointRulerAction.java ManageBreakpointRulerActionDelegate.java Log Message: Breakpoints, first cut --- NEW FILE: ManageBreakpointRulerActionDelegate.java --- /* * Author: atotic * Created on Apr 30, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.ui.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.text.source.IVerticalRulerInfo; import org.eclipse.ui.texteditor.AbstractRulerActionDelegate; import org.eclipse.ui.texteditor.ITextEditor; /** * Breakpoints delegate */ public class ManageBreakpointRulerActionDelegate extends AbstractRulerActionDelegate { protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) { return new BreakpointRulerAction(editor, rulerInfo); } } --- NEW FILE: BreakpointRulerAction.java --- /* * Author: atotic * Created on Apr 30, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.ui.actions; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.core.internal.resources.MarkerAttributeMap; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.IWorkspaceRunnable; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.IBreakpointManager; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.jface.action.Action; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.IVerticalRulerInfo; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel; import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.IUpdate; import org.python.pydev.debug.core.PydevDebugPlugin; import org.python.pydev.debug.model.PyBreakpoint; import org.python.pydev.debug.model.PyDebugModelPresentation; import org.python.pydev.editor.PyEdit; import org.python.pydev.editor.model.AbstractNode; import org.python.pydev.editor.model.FunctionNode; import org.python.pydev.editor.model.Location; import org.python.pydev.editor.model.ModelUtils; /** * Setting/removing breakpoints in the ruler * * Inspired by: * @see org.eclipse.jdt.internal.debug.ui.actions.ManageBreakpointRulerAction */ public class BreakpointRulerAction extends Action implements IUpdate { private IVerticalRulerInfo fRuler; private ITextEditor fTextEditor; private List fMarkers; private String fAddLabel; private String fRemoveLabel; public BreakpointRulerAction(ITextEditor editor, IVerticalRulerInfo ruler) { fRuler= ruler; fTextEditor= editor; fAddLabel= "Add Breakpoint"; fRemoveLabel= "Remove Breakpoint"; } /** * @return the resource for which to create the marker or <code>null</code> */ protected IResource getResource() { IEditorInput input= fTextEditor.getEditorInput(); IResource resource= (IResource) input.getAdapter(IFile.class); if (resource == null) { resource= (IResource) input.getAdapter(IResource.class); } return resource; } /** * Checks whether a position includes the ruler's line of activity. * * @param position the position to be checked * @param document the document the position refers to * @return <code>true</code> if the line is included by the given position */ protected boolean includesRulerLine(Position position, IDocument document) { if (position != null) { try { int markerLine= document.getLineOfOffset(position.getOffset()); int line= fRuler.getLineOfLastMouseButtonActivity(); if (line == markerLine) { return true; } } catch (BadLocationException x) { } } return false; } /** * @return this action's vertical ruler */ protected IVerticalRulerInfo getVerticalRulerInfo() { return fRuler; } /** * @return this action's editor */ protected ITextEditor getTextEditor() { return fTextEditor; } /** * @return the marker annotation model of the editor's input. */ protected AbstractMarkerAnnotationModel getAnnotationModel() { IDocumentProvider provider= fTextEditor.getDocumentProvider(); IAnnotationModel model= provider.getAnnotationModel(fTextEditor.getEditorInput()); if (model instanceof AbstractMarkerAnnotationModel) { return (AbstractMarkerAnnotationModel) model; } return null; } /** * @return the document of the editor's input */ protected IDocument getDocument() { IDocumentProvider provider= fTextEditor.getDocumentProvider(); return provider.getDocument(fTextEditor.getEditorInput()); } /** * @see IUpdate#update() */ public void update() { fMarkers= getMarkers(); setText(fMarkers.isEmpty() ? fAddLabel : fRemoveLabel); } /** * @see Action#run() */ public void run() { if (fMarkers.isEmpty()) { addMarker(); } else { removeMarkers(fMarkers); } } protected List getMarkers() { List breakpoints= new ArrayList(); IResource resource= getResource(); IDocument document= getDocument(); AbstractMarkerAnnotationModel model= getAnnotationModel(); if (model != null) { try { IMarker[] markers= null; if (resource instanceof IFile) markers= resource.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE); else { IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); markers= root.findMarkers(PyBreakpoint.PY_BREAK_MARKER, true, IResource.DEPTH_INFINITE); } if (markers != null) { IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); for (int i= 0; i < markers.length; i++) { IBreakpoint breakpoint= breakpointManager.getBreakpoint(markers[i]); if (breakpoint != null && breakpointManager.isRegistered(breakpoint)) { Position pos = model.getMarkerPosition(markers[i]); if (includesRulerLine(pos, document)) breakpoints.add(markers[i]); } } } } catch (CoreException x) { PydevDebugPlugin.log(IStatus.ERROR, "Unexpected getMarkers error", x); } } return breakpoints; } protected void addMarker() { try { IDocument document= getDocument(); int rulerLine= getVerticalRulerInfo().getLineOfLastMouseButtonActivity(); int lineNumber = rulerLine + 1; if (lineNumber < 0) return; IRegion line= document.getLineInformation(lineNumber - 1); IEditorInput editorInput= getTextEditor().getEditorInput(); final IResource resource = (IResource)editorInput.getAdapter(IResource.class); if (resource == null) throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not find resource to create marker on", null)); final MarkerAttributeMap map = new MarkerAttributeMap(); String functionName = getFunctionAboveLine(document, lineNumber-1); map.put(IMarker.MESSAGE, "what's the message"); map.put(IMarker.LINE_NUMBER, new Integer(lineNumber)); map.put(IBreakpoint.ENABLED, new Boolean(true)); map.put(IBreakpoint.ID, PyDebugModelPresentation.PY_DEBUG_MODEL_ID); if (functionName != null) map.put(PyBreakpoint.FUNCTION_NAME_PROP, functionName); IWorkspaceRunnable r= new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { IMarker marker= resource.createMarker(PyBreakpoint.PY_BREAK_MARKER); marker.setAttributes(map); PyBreakpoint br = new PyBreakpoint(); br.setMarker(marker); IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); breakpointManager.addBreakpoint(br); } }; resource.getWorkspace().run(r, null); } catch (BadLocationException e) { e.printStackTrace(); } catch (CoreException e) { e.printStackTrace(); } } /** * @param document * @param lineNumber * @return */ private String getFunctionAboveLine(IDocument document, int lineNumber) { if (!(fTextEditor instanceof PyEdit)) return null; AbstractNode root = ((PyEdit)fTextEditor).getPythonModel(); AbstractNode closest = ModelUtils.getLessOrEqualNode(root, new Location(lineNumber+1, 0)); while (closest != null && !(closest instanceof FunctionNode)) closest = closest.getParent(); if (closest != null) return closest.getName(); return null; } protected void removeMarkers(List markers) { IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager(); try { Iterator e= markers.iterator(); while (e.hasNext()) { IBreakpoint breakpoint= breakpointManager.getBreakpoint((IMarker) e.next()); breakpointManager.removeBreakpoint(breakpoint, true); } } catch (CoreException e) { PydevDebugPlugin.log(IStatus.ERROR, "error removing markers", e); } } } |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:05:47
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17997/src/org/python/pydev/editor/actions Modified Files: PyOpenAction.java Log Message: Minor tweaks: - removed some debug printfs - hyperlinks show up only when there is something to jump to - OydevPlugin got an error dialog Index: PyOpenAction.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/actions/PyOpenAction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyOpenAction.java 27 Apr 2004 01:06:59 -0000 1.3 --- PyOpenAction.java 5 May 2004 02:05:08 -0000 1.4 *************** *** 55,65 **** IEditorPart editor = null; if (p.file instanceof IFile) ! editor = PydevPlugin.getDefault().doOpenEditor(((IFile)p.file).getFullPath()); else if (p.file instanceof IPath) { ! editor = PydevPlugin.getDefault().doOpenEditor((IPath)p.file); } else if (p.file instanceof File) { Path path = new Path(((File)p.file).getAbsolutePath()); ! editor = PydevPlugin.getDefault().doOpenEditor(path); } if (editor instanceof ITextEditor) { --- 55,65 ---- IEditorPart editor = null; if (p.file instanceof IFile) ! editor = PydevPlugin.getDefault().doOpenEditor(((IFile)p.file).getFullPath(), true); else if (p.file instanceof IPath) { ! editor = PydevPlugin.getDefault().doOpenEditor((IPath)p.file, true); } else if (p.file instanceof File) { Path path = new Path(((File)p.file).getAbsolutePath()); ! editor = PydevPlugin.getDefault().doOpenEditor(path, true); } if (editor instanceof ITextEditor) { |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:05:47
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17997 Modified Files: Changes.txt Log Message: Minor tweaks: - removed some debug printfs - hyperlinks show up only when there is something to jump to - OydevPlugin got an error dialog Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/Changes.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Changes.txt 27 Apr 2004 01:07:44 -0000 1.4 --- Changes.txt 5 May 2004 02:05:09 -0000 1.5 *************** *** 25,28 **** --- 25,29 ---- - When you are editing in the tab mode, paste will replace spaces with tabs - tabs/spaces conversion only takes place inside code, not inside comments + - IDLE like colors for text Bug fixes: |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:05:47
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17997/src/org/python/pydev/editor/model Modified Files: LengthEstimator.java ModelUtils.java Scope.java Log Message: Minor tweaks: - removed some debug printfs - hyperlinks show up only when there is something to jump to - OydevPlugin got an error dialog Index: Scope.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/model/Scope.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Scope.java 27 Apr 2004 01:06:58 -0000 1.4 --- Scope.java 5 May 2004 02:05:08 -0000 1.5 *************** *** 129,133 **** } } ! if (start != null && start instanceof ClassNode) // class name can also be a function call retVal.add(start); --- 129,133 ---- } } ! if (start != null && start instanceof ClassNode && c.compare(token, start) == 0) // class name can also be a function call retVal.add(start); Index: LengthEstimator.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/model/LengthEstimator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LengthEstimator.java 15 Apr 2004 23:19:21 -0000 1.2 --- LengthEstimator.java 5 May 2004 02:05:08 -0000 1.3 *************** *** 51,55 **** public Object visitAssert(Assert node) throws Exception { ! System.out.println("lenVisitAssert:" + node.toString("")); return null; } --- 51,55 ---- public Object visitAssert(Assert node) throws Exception { ! // System.out.println("lenVisitAssert:" + node.toString("")); return null; } *************** *** 57,66 **** public Object visitAssign(Assign node) throws Exception { ! System.out.println("lenVisitAssign:" + node.toString("")); return null; } public Object visitAugAssign(AugAssign node) throws Exception { ! System.out.println("lenVisitAugAssign:" + node.toString("")); return null; } --- 57,66 ---- public Object visitAssign(Assign node) throws Exception { ! // System.out.println("lenVisitAssign:" + node.toString("")); return null; } public Object visitAugAssign(AugAssign node) throws Exception { ! // System.out.println("lenVisitAugAssign:" + node.toString("")); return null; } *************** *** 74,78 **** public Object visitBoolOp(BoolOp node) throws Exception { ! System.out.println("lenVisitBoolOp:" + node.toString("")); return null; } --- 74,78 ---- public Object visitBoolOp(BoolOp node) throws Exception { ! // System.out.println("lenVisitBoolOp:" + node.toString("")); return null; } *************** *** 80,89 **** public Object visitBreak(Break node) throws Exception { ! System.out.println("lenVisitBreak:" + node.toString("")); return null; } public Object visitClassDef(ClassDef node) throws Exception { ! System.out.println("lenVisitClassDef:" + node.name); return null; } --- 80,89 ---- public Object visitBreak(Break node) throws Exception { ! // System.out.println("lenVisitBreak:" + node.toString("")); return null; } public Object visitClassDef(ClassDef node) throws Exception { ! // System.out.println("lenVisitClassDef:" + node.name); return null; } *************** *** 91,95 **** public Object visitCompare(Compare node) throws Exception { ! System.out.println("lenVisitCompare:" + node.toString("")); return null; } --- 91,95 ---- public Object visitCompare(Compare node) throws Exception { ! // System.out.println("lenVisitCompare:" + node.toString("")); return null; } *************** *** 97,101 **** public Object visitContinue(Continue node) throws Exception { ! System.out.println("lenVisitContinue:" + node.toString("")); return null; } --- 97,101 ---- public Object visitContinue(Continue node) throws Exception { ! // System.out.println("lenVisitContinue:" + node.toString("")); return null; } *************** *** 103,107 **** public Object visitDelete(Delete node) throws Exception { ! System.out.println("lenVisitDelete:" + node.toString("")); return null; } --- 103,107 ---- public Object visitDelete(Delete node) throws Exception { ! // System.out.println("lenVisitDelete:" + node.toString("")); return null; } *************** *** 109,113 **** public Object visitDict(Dict node) throws Exception { ! System.out.println("lenVisitDict:" + node.toString("")); return null; } --- 109,113 ---- public Object visitDict(Dict node) throws Exception { ! // System.out.println("lenVisitDict:" + node.toString("")); return null; } *************** *** 115,119 **** public Object visitEllipsis(Ellipsis node) throws Exception { ! System.out.println("lenVisitEllipsis:" + node.toString("")); return null; } --- 115,119 ---- public Object visitEllipsis(Ellipsis node) throws Exception { ! // System.out.println("lenVisitEllipsis:" + node.toString("")); return null; } *************** *** 121,125 **** public Object visitExec(Exec node) throws Exception { ! System.out.println("lenVisitExec:" + node.toString("")); return null; } --- 121,125 ---- public Object visitExec(Exec node) throws Exception { ! // System.out.println("lenVisitExec:" + node.toString("")); return null; } *************** *** 127,131 **** public Object visitExpr(Expr node) throws Exception { ! System.out.println("lenVisitExpr:" + node.toString("")); return null; } --- 127,131 ---- public Object visitExpr(Expr node) throws Exception { ! // System.out.println("lenVisitExpr:" + node.toString("")); return null; } *************** *** 133,137 **** public Object visitExpression(Expression node) throws Exception { ! System.out.println("lenVisitExpression:" + node.toString("")); return null; } --- 133,137 ---- public Object visitExpression(Expression node) throws Exception { ! // System.out.println("lenVisitExpression:" + node.toString("")); return null; } *************** *** 139,143 **** public Object visitExtSlice(ExtSlice node) throws Exception { ! System.out.println("lenVisitExtSlice:" + node.toString("")); return null; } --- 139,143 ---- public Object visitExtSlice(ExtSlice node) throws Exception { ! // System.out.println("lenVisitExtSlice:" + node.toString("")); return null; } *************** *** 145,149 **** public Object visitFor(For node) throws Exception { ! System.out.println("lenVisitFor:" + node.toString("")); return null; } --- 145,149 ---- public Object visitFor(For node) throws Exception { ! // System.out.println("lenVisitFor:" + node.toString("")); return null; } *************** *** 151,155 **** public Object visitFunctionDef(FunctionDef node) throws Exception { ! System.out.println("lenVisitFunctionDef:" + node.toString("")); return null; } --- 151,155 ---- public Object visitFunctionDef(FunctionDef node) throws Exception { ! // System.out.println("lenVisitFunctionDef:" + node.toString("")); return null; } *************** *** 157,161 **** public Object visitGlobal(Global node) throws Exception { ! System.out.println("lenVisitGlobal:" + node.toString("")); return null; } --- 157,161 ---- public Object visitGlobal(Global node) throws Exception { ! // System.out.println("lenVisitGlobal:" + node.toString("")); return null; } *************** *** 163,167 **** public Object visitIf(If node) throws Exception { ! System.out.println("lenVisitIf:" + node.toString("")); return null; } --- 163,167 ---- public Object visitIf(If node) throws Exception { ! // System.out.println("lenVisitIf:" + node.toString("")); return null; } *************** *** 169,173 **** public Object visitImport(Import node) throws Exception { ! System.out.println("lenVisitImport:" + node.toString("")); return null; } --- 169,173 ---- public Object visitImport(Import node) throws Exception { ! // System.out.println("lenVisitImport:" + node.toString("")); return null; } *************** *** 175,179 **** public Object visitImportFrom(ImportFrom node) throws Exception { ! System.out.println("lenVisitImportFrom:" + node.toString("")); return null; } --- 175,179 ---- public Object visitImportFrom(ImportFrom node) throws Exception { ! // System.out.println("lenVisitImportFrom:" + node.toString("")); return null; } *************** *** 181,185 **** public Object visitIndex(Index node) throws Exception { ! System.out.println("lenVisitIndex:" + node.toString("")); return null; } --- 181,185 ---- public Object visitIndex(Index node) throws Exception { ! // System.out.println("lenVisitIndex:" + node.toString("")); return null; } *************** *** 187,191 **** public Object visitInteractive(Interactive node) throws Exception { ! System.out.println("lenVisitInteractive:" + node.toString("")); return null; } --- 187,191 ---- public Object visitInteractive(Interactive node) throws Exception { ! // System.out.println("lenVisitInteractive:" + node.toString("")); return null; } *************** *** 193,197 **** public Object visitLambda(Lambda node) throws Exception { ! System.out.println("lenVisitLambda:" + node.toString("")); return null; } --- 193,197 ---- public Object visitLambda(Lambda node) throws Exception { ! // System.out.println("lenVisitLambda:" + node.toString("")); return null; } *************** *** 199,203 **** public Object visitList(List node) throws Exception { ! System.out.println("lenVisitList:" + node.toString("")); return null; } --- 199,203 ---- public Object visitList(List node) throws Exception { ! // System.out.println("lenVisitList:" + node.toString("")); return null; } *************** *** 205,209 **** public Object visitListComp(ListComp node) throws Exception { ! System.out.println("lenVisitListComp:" + node.toString("")); return null; } --- 205,209 ---- public Object visitListComp(ListComp node) throws Exception { ! // System.out.println("lenVisitListComp:" + node.toString("")); return null; } *************** *** 211,215 **** public Object visitModule(Module node) throws Exception { ! System.out.println("lenVisitModule:" + node.toString("")); return null; } --- 211,215 ---- public Object visitModule(Module node) throws Exception { ! // System.out.println("lenVisitModule:" + node.toString("")); return null; } *************** *** 222,226 **** public Object visitPass(Pass node) throws Exception { ! System.out.println("lenVisitPass:" + node.toString("")); return null; } --- 222,226 ---- public Object visitPass(Pass node) throws Exception { ! // System.out.println("lenVisitPass:" + node.toString("")); return null; } *************** *** 228,232 **** public Object visitPrint(Print node) throws Exception { ! System.out.println("lenVisitPrint:" + node.toString("")); return null; } --- 228,232 ---- public Object visitPrint(Print node) throws Exception { ! // System.out.println("lenVisitPrint:" + node.toString("")); return null; } *************** *** 234,238 **** public Object visitRaise(Raise node) throws Exception { ! System.out.println("lenVisitRaise:" + node.toString("")); return null; } --- 234,238 ---- public Object visitRaise(Raise node) throws Exception { ! // System.out.println("lenVisitRaise:" + node.toString("")); return null; } *************** *** 240,244 **** public Object visitRepr(Repr node) throws Exception { ! System.out.println("lenVisitRepr:" + node.toString("")); return null; } --- 240,244 ---- public Object visitRepr(Repr node) throws Exception { ! // System.out.println("lenVisitRepr:" + node.toString("")); return null; } *************** *** 246,250 **** public Object visitReturn(Return node) throws Exception { ! System.out.println("lenVisitReturn:" + node.toString("")); return null; } --- 246,250 ---- public Object visitReturn(Return node) throws Exception { ! // System.out.println("lenVisitReturn:" + node.toString("")); return null; } *************** *** 252,256 **** public Object visitSlice(Slice node) throws Exception { ! System.out.println("lenVisitSlice:" + node.toString("")); return null; } --- 252,256 ---- public Object visitSlice(Slice node) throws Exception { ! // System.out.println("lenVisitSlice:" + node.toString("")); return null; } *************** *** 270,274 **** public Object visitSuite(Suite node) throws Exception { ! System.out.println("lenVisitSuite:" + node.toString("")); return null; } --- 270,274 ---- public Object visitSuite(Suite node) throws Exception { ! // System.out.println("lenVisitSuite:" + node.toString("")); return null; } *************** *** 276,280 **** public Object visitTryExcept(TryExcept node) throws Exception { ! System.out.println("lenVisitTryExcept:" + node.toString("")); return null; } --- 276,280 ---- public Object visitTryExcept(TryExcept node) throws Exception { ! // System.out.println("lenVisitTryExcept:" + node.toString("")); return null; } *************** *** 282,286 **** public Object visitTryFinally(TryFinally node) throws Exception { ! System.out.println("lenVisitTryFinally:" + node.toString("")); return null; } --- 282,286 ---- public Object visitTryFinally(TryFinally node) throws Exception { ! // System.out.println("lenVisitTryFinally:" + node.toString("")); return null; } *************** *** 294,298 **** public Object visitUnaryOp(UnaryOp node) throws Exception { ! System.out.println("lenVisitUnaryOp:" + node.toString("")); return null; } --- 294,298 ---- public Object visitUnaryOp(UnaryOp node) throws Exception { ! // System.out.println("lenVisitUnaryOp:" + node.toString("")); return null; } *************** *** 300,304 **** public Object visitWhile(While node) throws Exception { ! System.out.println("lenVisitWhile:" + node.toString("")); return null; } --- 300,304 ---- public Object visitWhile(While node) throws Exception { ! // System.out.println("lenVisitWhile:" + node.toString("")); return null; } *************** *** 306,310 **** public Object visitYield(Yield node) throws Exception { ! System.out.println("lenVisitYield:" + node.toString("")); return null; } --- 306,310 ---- public Object visitYield(Yield node) throws Exception { ! // System.out.println("lenVisitYield:" + node.toString("")); return null; } Index: ModelUtils.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/model/ModelUtils.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ModelUtils.java 27 Apr 2004 01:06:58 -0000 1.4 --- ModelUtils.java 5 May 2004 02:05:08 -0000 1.5 *************** *** 68,72 **** if (loc.contained(root.getStart(), root.getEnd()) && ((root.getProperties() & properties) == properties)) { ! System.out.println(root.toString()); return root; } --- 68,73 ---- if (loc.contained(root.getStart(), root.getEnd()) && ((root.getProperties() & properties) == properties)) { ! // LAM Uncomment this to see all items you are hovering over ! // System.out.println(root.toString()); return root; } *************** *** 203,207 **** }); for (Iterator i = funcCalls.iterator(); i.hasNext();) { ! FunctionNode funcNode = (FunctionNode)i.next(); retVal.add(new ItemPointer(funcNode.getPath(), funcNode.getStart(), funcNode.getEnd())); } --- 204,208 ---- }); for (Iterator i = funcCalls.iterator(); i.hasNext();) { ! AbstractNode funcNode = (AbstractNode)i.next(); retVal.add(new ItemPointer(funcNode.getPath(), funcNode.getStart(), funcNode.getEnd())); } *************** *** 231,235 **** ); for (Iterator i = funcCalls.iterator(); i.hasNext();) { ! FunctionNode funcNode = (FunctionNode)i.next(); retVal.add(new ItemPointer(funcNode.getPath(), funcNode.getStart(), funcNode.getEnd())); } --- 232,236 ---- ); for (Iterator i = funcCalls.iterator(); i.hasNext();) { ! AbstractNode funcNode = (AbstractNode)i.next(); retVal.add(new ItemPointer(funcNode.getPath(), funcNode.getStart(), funcNode.getEnd())); } |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:05:30
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17997/src/org/python/pydev/editor Modified Files: Hyperlink.java Log Message: Minor tweaks: - removed some debug printfs - hyperlinks show up only when there is something to jump to - OydevPlugin got an error dialog Index: Hyperlink.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/Hyperlink.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Hyperlink.java 27 Apr 2004 01:06:57 -0000 1.4 --- Hyperlink.java 5 May 2004 02:05:20 -0000 1.5 *************** *** 301,305 **** fClickedNode = ModelUtils.getElement(fEditor.getPythonModel(), offset, viewer.getDocument(), AbstractNode.PROP_CLICKABLE); ! if (fClickedNode == null) return null; --- 301,307 ---- fClickedNode = ModelUtils.getElement(fEditor.getPythonModel(), offset, viewer.getDocument(), AbstractNode.PROP_CLICKABLE); ! ! if (fClickedNode == null || ! ModelUtils.findDefinition(fClickedNode).size() == 0) return null; |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:05:29
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17997/src/org/python/pydev/plugin Modified Files: PydevPrefs.java PydevPlugin.java Log Message: Minor tweaks: - removed some debug printfs - hyperlinks show up only when there is something to jump to - OydevPlugin got an error dialog Index: PydevPlugin.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/PydevPlugin.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PydevPlugin.java 27 Apr 2004 01:06:58 -0000 1.6 --- PydevPlugin.java 5 May 2004 02:05:19 -0000 1.7 *************** *** 110,114 **** * @return part that is the editor */ ! public IEditorPart doOpenEditor(IPath path) { if (path == null) return null; --- 110,114 ---- * @return part that is the editor */ ! public IEditorPart doOpenEditor(IPath path, boolean activate) { if (path == null) return null; *************** *** 119,123 **** if (file != null && file.exists()) { // File is inside the workspace ! return wp.openEditor(file, null, true); } else { IStorage storage = new FileStorage(path); --- 119,123 ---- if (file != null && file.exists()) { // File is inside the workspace ! return wp.openEditor(file, null, activate); } else { IStorage storage = new FileStorage(path); Index: PydevPrefs.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/plugin/PydevPrefs.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PydevPrefs.java 22 Apr 2004 10:35:24 -0000 1.6 --- PydevPrefs.java 5 May 2004 02:05:09 -0000 1.7 *************** *** 41,49 **** private static final RGB DEFAULT_CODE_COLOR = new RGB(0, 0, 0); public static final String KEYWORD_COLOR = "KEYWORD_COLOR"; ! private static final RGB DEFAULT_KEYWORD_COLOR = new RGB(160, 32, 240); public static final String STRING_COLOR = "STRING_COLOR"; ! private static final RGB DEFAULT_STRING_COLOR = new RGB(120, 130, 61); public static final String COMMENT_COLOR = "COMMENT_COLOR"; ! private static final RGB DEFAULT_COMMENT_COLOR = new RGB(178, 34, 34); public static final String INTERPRETER_PATH = "INTERPRETER_PATH"; protected static final String DEFAULT_INTERPRETER_PATH = "python"; --- 41,49 ---- private static final RGB DEFAULT_CODE_COLOR = new RGB(0, 0, 0); public static final String KEYWORD_COLOR = "KEYWORD_COLOR"; ! private static final RGB DEFAULT_KEYWORD_COLOR = new RGB(255, 119, 0); public static final String STRING_COLOR = "STRING_COLOR"; ! private static final RGB DEFAULT_STRING_COLOR = new RGB(0, 170, 0); public static final String COMMENT_COLOR = "COMMENT_COLOR"; ! private static final RGB DEFAULT_COMMENT_COLOR = new RGB(221, 0, 0); public static final String INTERPRETER_PATH = "INTERPRETER_PATH"; protected static final String DEFAULT_INTERPRETER_PATH = "python"; |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:02:58
|
Update of /cvsroot/pydev/org.python.pydev.debug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17527 Modified Files: plugin.xml Log Message: Getting ready for breakpoints Index: plugin.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/plugin.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** plugin.xml 22 Apr 2004 10:57:07 -0000 1.7 --- plugin.xml 5 May 2004 02:02:50 -0000 1.8 *************** *** 1,160 **** <?xml version="1.0" encoding="UTF-8"?> <plugin ! id="org.python.pydev.debug" ! name="Pydev debug" ! version="0.4.0" ! provider-name="Aleks Totic" ! class="org.python.pydev.debug.core.PydevDebugPlugin"> ! <runtime> ! <library name="pydev-debug.jar"/> ! </runtime> ! <requires> ! <import plugin="org.eclipse.core.resources"/> ! <import plugin="org.eclipse.core.runtime"/> ! <import plugin="org.eclipse.core.boot"/> ! <import plugin="org.eclipse.ui"/> ! <import plugin="org.eclipse.ui.editors"/> ! <import plugin="org.eclipse.ui.externaltools"/> ! <import plugin="org.eclipse.ui.views"/> ! <import plugin="org.eclipse.jface.text"/> ! <import plugin="org.eclipse.debug.core"/> ! <import plugin="org.eclipse.debug.ui"/> ! <import plugin="org.python.pydev"/> ! <import plugin="org.apache.xerces"/> ! </requires> <!--- launcher --> ! <extension ! point="org.eclipse.debug.core.launchConfigurationTypes"> ! <launchConfigurationType ! name="Python" ! delegate="org.python.pydev.debug.ui.launching.PythonLaunchConfigurationDelegate" ! modes="run, debug" ! id="org.python.pydev.debug.launchConfigurationType"> ! </launchConfigurationType> ! </extension> <!--- the launcher icon --> ! <extension ! point="org.eclipse.debug.ui.launchConfigurationTypeImages"> ! <launchConfigurationTypeImage ! icon="icons/python.gif" ! configTypeID="org.python.pydev.debug.launchConfigurationType" ! id="org.python.pydev.debug.ui.launchConfigurationTypeImage"> ! </launchConfigurationTypeImage> ! </extension> <!--- launcher tab group --> ! <extension ! point="org.eclipse.debug.ui.launchConfigurationTabGroups"> ! <launchConfigurationTabGroup ! type="org.python.pydev.debug.launchConfigurationType" ! class="org.python.pydev.debug.ui.PythonTabGroup" ! id="org.python.pydev.debug.ui.PythonTabGroup"> ! </launchConfigurationTabGroup> ! </extension> <!--- launch shortcuts --> ! <extension ! point="org.eclipse.debug.ui.launchShortcuts"> ! <shortcut ! label="Python script" ! icon="icons/python.gif" ! modes="run, debug" ! class="org.python.pydev.debug.launching.LaunchShortcut" ! id="org.python.pydev.debug.launchShortcut"> ! <perspective ! id="org.eclipse.debug.ui.DebugPerspective"> ! </perspective> ! </shortcut> ! </extension> <!--- launcher pop up over a python file --> ! <extension ! point="org.eclipse.ui.popupMenus"> ! <objectContribution ! objectClass="org.eclipse.core.resources.IFile" ! adaptable="true" ! nameFilter="*.py" ! id="org.python.pydev.debug.RunPython"> ! <menu ! label="Python" ! path="additions" ! id="org.python.pydev.debug.WorkspaceMenu"> ! <separator ! name="group1"> ! </separator> ! </menu> ! <action ! label="Debug..." ! icon="icons/python.gif" ! tooltip="Debug python script" ! class="org.python.pydev.debug.ui.launching.PythonRunActionDelegate" ! menubarPath="org.python.pydev.debug.WorkspaceMenu/group1" ! enablesFor="1" ! id="org.python.pydev.debug.DebugPythonAction"> ! </action> ! <action ! label="Run..." ! icon="icons/python.gif" ! tooltip="Run a python script" ! class="org.python.pydev.debug.ui.launching.PythonRunActionDelegate" ! menubarPath="org.python.pydev.debug.WorkspaceMenu/group1" ! enablesFor="1" ! id="org.python.pydev.debug.RunPythonAction"> ! </action> ! </objectContribution> ! </extension> <!--- launch groups for python --> ! <extension ! point="org.eclipse.debug.ui.launchGroups"> ! <launchGroup ! label="Debug" ! bannerImage="icons/python-big.gif" ! category="org.python.pydev.debug" ! image="icons/python.gif" ! mode="debug" ! id="org.python.pydev.debug.debug"> ! </launchGroup> ! <launchGroup ! label="Run" ! bannerImage="icons/python-big.gif" ! category="org.python.pydev.debug" ! image="icons/python.gif" ! mode="run" ! id="org.python.pydev.debug.run"> ! </launchGroup> ! </extension> <!--- console line tracking --> ! <extension ! point="org.eclipse.debug.ui.consoleLineTrackers"> ! <consoleLineTracker ! class="org.python.pydev.debug.ui.PythonConsoleLineTracker" ! processType="PYDEV.PYTHON" ! id="org.python.pydev.debug.ui.PythonConsoleLineTracker"> ! </consoleLineTracker> ! </extension> ! <!--- TODO just a placeholder for now --> ! <!--- breakpoint marker --> ! <extension ! id="pyBreakpointMarker" ! point="org.eclipse.core.resources.markers"> ! <super ! type="org.eclipse.debug.core.breakpointMarker"> ! </super> ! <persistent ! value="true"> ! </persistent> ! <attribute ! name="org.eclipse.cdt.debug.core.condition"> ! </attribute> ! <attribute ! name="org.eclipse.cdt.debug.core.ignoreCount"> ! </attribute> ! <attribute ! name="org.eclipse.cdt.debug.core.threadId"> ! </attribute> ! <attribute ! name="org.eclipse.cdt.debug.core.installCount"> ! </attribute> ! </extension> </plugin> --- 1,193 ---- <?xml version="1.0" encoding="UTF-8"?> <plugin ! id="org.python.pydev.debug" ! name="Pydev debug" ! version="0.4.0" ! provider-name="Aleks Totic" ! class="org.python.pydev.debug.core.PydevDebugPlugin"> ! <runtime> ! <library name="pydev-debug.jar"/> ! </runtime> ! <requires> ! <import plugin="org.eclipse.core.resources"/> ! <import plugin="org.eclipse.core.runtime"/> ! <import plugin="org.eclipse.core.boot"/> ! <import plugin="org.eclipse.ui"/> ! <import plugin="org.eclipse.ui.editors"/> ! <import plugin="org.eclipse.ui.externaltools"/> ! <import plugin="org.eclipse.ui.views"/> ! <import plugin="org.eclipse.jface.text"/> ! <import plugin="org.eclipse.debug.core"/> ! <import plugin="org.eclipse.debug.ui"/> ! <import plugin="org.python.pydev"/> ! <import plugin="org.apache.xerces"/> ! </requires> <!--- launcher --> ! <extension ! point="org.eclipse.debug.core.launchConfigurationTypes"> ! <launchConfigurationType ! name="Python" ! delegate="org.python.pydev.debug.ui.launching.PythonLaunchConfigurationDelegate" ! modes="run, debug" ! id="org.python.pydev.debug.launchConfigurationType"> ! </launchConfigurationType> ! </extension> <!--- the launcher icon --> ! <extension ! point="org.eclipse.debug.ui.launchConfigurationTypeImages"> ! <launchConfigurationTypeImage ! icon="icons/python.gif" ! configTypeID="org.python.pydev.debug.launchConfigurationType" ! id="org.python.pydev.debug.ui.launchConfigurationTypeImage"> ! </launchConfigurationTypeImage> ! </extension> <!--- launcher tab group --> ! <extension ! point="org.eclipse.debug.ui.launchConfigurationTabGroups"> ! <launchConfigurationTabGroup ! type="org.python.pydev.debug.launchConfigurationType" ! class="org.python.pydev.debug.ui.PythonTabGroup" ! id="org.python.pydev.debug.ui.PythonTabGroup"> ! </launchConfigurationTabGroup> ! </extension> <!--- launch shortcuts --> ! <extension ! point="org.eclipse.debug.ui.launchShortcuts"> ! <shortcut ! label="Python script" ! icon="icons/python.gif" ! modes="run, debug" ! class="org.python.pydev.debug.launching.LaunchShortcut" ! id="org.python.pydev.debug.launchShortcut"> ! <perspective id="org.eclipse.debug.ui.DebugPerspective"/> ! </shortcut> ! </extension> <!--- launcher pop up over a python file --> ! <extension ! point="org.eclipse.ui.popupMenus"> ! <objectContribution ! objectClass="org.eclipse.core.resources.IFile" ! adaptable="true" ! nameFilter="*.py" ! id="org.python.pydev.debug.RunPython"> ! <menu ! label="Python" ! path="additions" ! id="org.python.pydev.debug.WorkspaceMenu"> ! <separator name="group1"/> ! </menu> ! <action ! label="Debug..." ! icon="icons/python.gif" ! tooltip="Debug python script" ! class="org.python.pydev.debug.ui.launching.PythonRunActionDelegate" ! menubarPath="org.python.pydev.debug.WorkspaceMenu/group1" ! enablesFor="1" ! id="org.python.pydev.debug.DebugPythonAction"> ! </action> ! <action ! label="Run..." ! icon="icons/python.gif" ! tooltip="Run a python script" ! class="org.python.pydev.debug.ui.launching.PythonRunActionDelegate" ! menubarPath="org.python.pydev.debug.WorkspaceMenu/group1" ! enablesFor="1" ! id="org.python.pydev.debug.RunPythonAction"> ! </action> ! </objectContribution> ! </extension> <!--- launch groups for python --> ! <extension ! point="org.eclipse.debug.ui.launchGroups"> ! <launchGroup ! label="Debug" ! bannerImage="icons/python-big.gif" ! category="org.python.pydev.debug" ! image="icons/python.gif" ! mode="debug" ! id="org.python.pydev.debug.debug"> ! </launchGroup> ! <launchGroup ! label="Run" ! bannerImage="icons/python-big.gif" ! category="org.python.pydev.debug" ! image="icons/python.gif" ! mode="run" ! id="org.python.pydev.debug.run"> ! </launchGroup> ! </extension> <!--- console line tracking --> ! <extension ! point="org.eclipse.debug.ui.consoleLineTrackers"> ! <consoleLineTracker ! class="org.python.pydev.debug.ui.PythonConsoleLineTracker" ! processType="PYDEV.PYTHON" ! id="org.python.pydev.debug.ui.PythonConsoleLineTracker"> ! </consoleLineTracker> ! </extension> + <!-- breakpoint ruler action --> + <extension point="org.eclipse.ui.editorActions"> + <editorContribution + id="org.python.pydev.debug.BreakpointRulerActions" + targetID="org.python.pydev.editor.PyEdit"> + <action + id="org.python.pydev.debug.BreakpointRulerAction" + actionID="RulerDoubleClick" + label="Add breakpoint" + class="org.python.pydev.debug.ui.ManageBreakpointRulerActionDelegate"> + </action> + </editorContribution> + </extension> + + <!-- breakpoint popup menu --> + <!-- <extension point="org.eclipse.ui.popupMenus"> + <viewerContribution + id="org.python.pydev.debug.PyEditPopupActions" + targetID="#ClassFileRulerContext"> + <action + id="org.eclipse.jdt.ui.actions.JavaBreakpointPropertiesRulerActionDelegate" + label="%JavaBreakpointProperties.label" + menubarPath="debug" + helpContextId="breakpoint_properties_action_context" + class="org.eclipse.jdt.internal.debug.ui.actions.JavaBreakpointPropertiesRulerActionDelegate"> + </action> + <action + id="org.eclipse.jdt.ui.actions.EnableDisableBreakpointRulerActionDelegate" + label="%EnableBreakpoint.label" + menubarPath="debug" + helpContextId="enable_disable_breakpoint_action_context" + class="org.eclipse.jdt.internal.debug.ui.actions.EnableDisableBreakpointRulerActionDelegate"> + </action> + <action + id="org.eclipse.jdt.ui.actions.ManageBreakpointRulerActionDelegate" + label="%AddBreakpoint.label" + menubarPath="debug" + helpContextId="manage_breakpoint_action_context" + class="org.eclipse.jdt.internal.debug.ui.actions.ManageBreakpointRulerActionDelegate"> + </action> + </viewerContribution> + <extension> + --> + <!--- breakpoint marker --> + <extension + point="org.eclipse.core.resources.markers" + id="pyStopBreakpointMarker"> + <super type="org.eclipse.debug.core.breakpointMarker"/> + <persistent value="true"/> + <attribute name="org.eclipse.cdt.debug.core.condition"/> + <attribute name="org.eclipse.cdt.debug.core.ignoreCount"/> + <attribute name="org.eclipse.cdt.debug.core.threadId"/> + <attribute name="org.eclipse.cdt.debug.core.installCount"/> + </extension> + <extension + point="org.eclipse.debug.core.breakpoints"> + <breakpoint id="pythonStopBreakpoint" + markerType="pyStopBreakpointMarker" + class="org.python.pydev.debug.core.breakpoints.PyStopBreakpoint" + /> + </extension> </plugin> |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:02:09
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17261/src/org/python/pydev/debug/core Modified Files: PydevDebugPlugin.java Added Files: PydevDebugPrefs.java Log Message: variables can now be displayed Index: PydevDebugPlugin.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/core/PydevDebugPlugin.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PydevDebugPlugin.java 28 Apr 2004 02:49:48 -0000 1.3 --- PydevDebugPlugin.java 5 May 2004 02:02:01 -0000 1.4 *************** *** 1,8 **** --- 1,10 ---- package org.python.pydev.debug.core; + import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.plugin.*; import org.eclipse.core.runtime.*; import org.eclipse.core.resources.*; + import org.eclipse.jface.dialogs.ErrorDialog; /** * The main plugin for Python Debugger. *************** *** 31,34 **** --- 33,40 ---- } + protected void initializeDefaultPluginPreferences() { + PydevDebugPrefs.initializeDefaultPreferences(getPluginPreferences()); + } + /** * Returns the active workbench window or <code>null</code> if none *************** *** 48,50 **** --- 54,66 ---- getDefault().getLog().log(s); } + + public static void errorDialog(String message, Throwable t) { + IWorkbenchWindow window = getDefault().getWorkbench().getActiveWorkbenchWindow(); + Shell shell = window == null ? null : window.getShell(); + if (shell != null) { + IStatus status= new Status(IStatus.ERROR, getPluginID(), 0, "Error logged from Pydev Debug: ", t); + ErrorDialog.openError(shell, "Its an error", message, status); + } + } + } --- NEW FILE: PydevDebugPrefs.java --- /* * Author: atotic * Created: Jun 23, 2003 * License: Common Public License v1.0 */ package org.python.pydev.debug.core; import org.eclipse.core.runtime.Preferences; import org.eclipse.jface.preference.FieldEditorPreferencePage; import org.eclipse.jface.preference.IntegerFieldEditor; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPreferencePage; /** * Pydev preference page. * * <p>Uses FieldEditor framework for preference editing. * <p>Defaults are declared here as constants. * <p>There is a string constant for every prefernce you can use for access * <p>Framework takes care of storing of the prefs * <p>The meaning of preferences are documented in user docs, for details grep * the source for the particular string. */ public class PydevDebugPrefs extends FieldEditorPreferencePage implements IWorkbenchPreferencePage{ // Preferences public static final String GET_VARIABLE_TIMEOUT = "GET_VARIABLE_TIMEOUT";// GetVariable command timeout public static final int DEFAULT_GET_VARIABLE_TIMEOUT = 30; /** * Initializer sets the preference store */ public PydevDebugPrefs() { super(GRID); setPreferenceStore(PydevDebugPlugin.getDefault().getPreferenceStore()); } static public Preferences getPreferences() { return PydevDebugPlugin.getDefault().getPluginPreferences(); } public void init(IWorkbench workbench) { } /** * Creates the editors */ protected void createFieldEditors() { Composite p = getFieldEditorParent(); IntegerFieldEditor ife = new IntegerFieldEditor( GET_VARIABLE_TIMEOUT, "Debugger get variable timeout (seconds)", p); ife.setValidRange(1, 180); // you can't restrict widget width on IntegerFieldEditor for now addField(ife); } /** * Sets default preference values */ protected static void initializeDefaultPreferences(Preferences prefs) { prefs.setDefault(GET_VARIABLE_TIMEOUT, DEFAULT_GET_VARIABLE_TIMEOUT); } } |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:02:09
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17261/src/org/python/pydev/debug/model/remote Added Files: VersionCommand.java ICommandResponseListener.java ThreadListCommand.java GetVariableCommand.java StepCommand.java RemoteDebugger.java ThreadKillCommand.java ThreadSuspendCommand.java ThreadRunCommand.java AbstractDebuggerCommand.java Log Message: variables can now be displayed --- NEW FILE: VersionCommand.java --- /* * Author: atotic * Created on Apr 19, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; /** * Version debugger command. * * See protocol definition for more info. Used as */ public class VersionCommand extends AbstractDebuggerCommand { static final String VERSION = "1.0"; /** * @param debugger */ public VersionCommand(RemoteDebugger debugger) { super(debugger); } public String getOutgoing() { return makeCommand(Integer.toString(CMD_VERSION), sequence, VERSION); } public boolean needResponse() { return true; } public void processOKResponse(int cmdCode, String payload) { // System.err.println("The version is " + payload); // not checking for versioning in 1.0, might come in useful later } } --- NEW FILE: ThreadRunCommand.java --- /* * Author: atotic * Created on Apr 22, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; /** * Run thread network command */ public class ThreadRunCommand extends AbstractDebuggerCommand { String thread; public ThreadRunCommand(RemoteDebugger debugger, String thread) { super(debugger); this.thread = thread; } public String getOutgoing() { return makeCommand(Integer.toString(CMD_THREAD_RUN), sequence, thread); } } --- NEW FILE: RemoteDebugger.java --- /* * Author: atotic * Created on Mar 23, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; import java.io.*; import java.net.*; import java.util.ArrayList; import java.util.Hashtable; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.debug.core.model.IProcess; import org.python.pydev.debug.core.PydevDebugPlugin; import org.python.pydev.debug.model.PyDebugTarget; import org.python.pydev.debug.ui.launching.PythonRunnerConfig; /** * Network interface to the remote debugger. */ public class RemoteDebugger extends Object { private int sequence = -1; // sequence seed for command numbers private Socket socket; // connection socket private Reader reader; // reading thread private Writer writer; // writing thread private ListenConnector connector; // Runnable that connects to the debugger private Thread connectThread; // private PythonRunnerConfig config; private PyDebugTarget target = null; protected class ListenConnector implements Runnable { int port; int timeout; ServerSocket serverSocket; Socket socket; // what got accepted Exception e; boolean terminated; public ListenConnector(int port, int timeout) throws IOException { this.port = port; this.timeout = timeout; serverSocket = new ServerSocket(port); } Exception getException() { return e; } public Socket getSocket() { return socket; } public void stopListening() { if (serverSocket != null) try { serverSocket.close(); } catch (IOException e) { PydevDebugPlugin.log(IStatus.WARNING, "Error closing pydevd socket", e); } terminated = true; } public void run() { try { serverSocket.setSoTimeout(timeout); socket = serverSocket.accept(); } catch (IOException e) { this.e = e; } } } /** * Writer writes debugger commands to the network. * Use postCommand to put new ones in queue. */ protected class Writer implements Runnable { ArrayList cmdQueue; // a list of RemoteDebuggerCommands OutputStreamWriter out; boolean done; public Writer(Socket s) throws IOException { done = false; cmdQueue = new ArrayList(); OutputStream sout; sout = s.getOutputStream(); out = new OutputStreamWriter(sout); } /** * Add command for processing */ public void postCommand(AbstractDebuggerCommand cmd) { synchronized(cmdQueue) { cmdQueue.add(cmd); } } public void done() { this.done = true; } /** * Loops and writes commands to the output */ public void run() { while (!done) { AbstractDebuggerCommand cmd = null; synchronized (cmdQueue) { if (cmdQueue.size() > 0) cmd = (AbstractDebuggerCommand) cmdQueue.remove(0); } try { if (cmd != null) { cmd.aboutToSend(); out.write(cmd.getOutgoing()); out.write("\n"); out.flush(); } Thread.sleep(100); } catch (InterruptedException e) { done = true; } catch (IOException e1) { done = true; } } } } /** * Reads and dispatches commands */ protected class Reader implements Runnable { boolean done; Hashtable responseQueue; // commands waiting for response. Their keys are the sequence ids BufferedReader in; public Reader(Socket socket) throws IOException { done = false; responseQueue = new Hashtable(); InputStream sin = socket.getInputStream(); in = new BufferedReader(new InputStreamReader(sin)); } public void done() { this.done = true; } public void addToResponseQueue(AbstractDebuggerCommand cmd) { responseQueue.put(new Integer(cmd.getSequence()), cmd); Object o = responseQueue.remove(new Integer(cmd.getSequence())); responseQueue.put(new Integer(cmd.getSequence()), cmd); } /** * Parses & dispatches the command */ private void processCommand(String cmdLine) { int cmdCode; int seqCode; String payload; String[] cmdParsed = cmdLine.split("\t", 3); cmdCode = Integer.parseInt(cmdParsed[0]); seqCode = Integer.parseInt(cmdParsed[1]); payload = URLDecoder.decode(cmdParsed[2]); // is there a response waiting AbstractDebuggerCommand cmd = (AbstractDebuggerCommand)responseQueue.remove(new Integer(seqCode)); if (cmd == null) if (target != null) target.processCommand(cmdParsed[0], cmdParsed[1], payload); else PydevDebugPlugin.log(IStatus.ERROR, "internal error, command received no target", null); else cmd.processResponse(cmdCode, payload); } public void run() { while (!done) { try { if (in.ready()) { String cmdLine = in.readLine(); processCommand(cmdLine); } Thread.sleep(100); } catch (IOException e) { done = true; } catch (InterruptedException e1) { e1.printStackTrace(); } if ((socket == null) || !socket.isConnected()) { if (target != null) { target.debuggerDisconnected(); } done = true; } } } } public RemoteDebugger(PythonRunnerConfig config) { this.config = config; } public void setTarget(PyDebugTarget target) { this.target = target; } public void startTransmission() throws IOException { this.reader = new Reader(socket); this.writer = new Writer(socket); Thread t = new Thread(reader, "pydevd.reader"); t.start(); t = new Thread(writer, "pydevd.writer"); t.start(); writer.postCommand(new VersionCommand(this)); } /** * @return next available debugger command sequence number */ public int getNextSequence() { sequence += 2; return sequence; } public void startConnect(IProgressMonitor monitor) throws IOException, CoreException { monitor.subTask("Finding free socket..."); connector = new ListenConnector(config.getDebugPort(), config.acceptTimeout); connectThread = new Thread(connector, "pydevd.connect"); connectThread.start(); } /** * Wait for the connection to the debugger to complete. * * If this method returns without an exception, we've connected. * @return true if operation was cancelled by user */ public boolean waitForConnect(IProgressMonitor monitor, Process p, IProcess ip) throws Exception { // Launch the debug listener on a thread, and wait until it completes while (connectThread.isAlive()) { if (monitor.isCanceled()) { connector.stopListening(); p.destroy(); return true; } try { p.exitValue(); // throws exception if process has terminated // process has terminated - stop waiting for a connection connector.stopListening(); String errorMessage= ip.getStreamsProxy().getErrorStreamMonitor().getContents(); if (errorMessage.length() != 0) // not sure if this is really an error throw new CoreException(new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "Something got printed in the error stream", null)); } catch (IllegalThreadStateException e) { // expected while process is alive } try { Thread.sleep(100); } catch (InterruptedException e) { } } if (connector.getException() != null) throw connector.getException(); connected(connector.getSocket()); return false; } /** * Remote debugger has connected */ public void connected(Socket socket) throws IOException { this.socket = socket; } public void disconnect() { try { if (socket != null) { socket.shutdownInput(); // trying to make my pydevd notice that the socket is gone socket.shutdownOutput(); socket.close(); } } catch (IOException e) { e.printStackTrace(); // it is going away } socket = null; if (target != null) target.debuggerDisconnected(); } /** * Dispose must be called to clean up. * Because we call this from PyDebugTarget.terminate, we can be called multiple times * But, once dispose() is called, no other calls will be made. */ public void dispose() { if (connector != null) { connector.stopListening(); connector = null; } if (writer != null) { writer.done(); writer = null; } if (reader != null) { reader.done(); reader = null; } disconnect(); target = null; } public void addToResponseQueue(AbstractDebuggerCommand cmd) { reader.addToResponseQueue(cmd); } public void postCommand(AbstractDebuggerCommand cmd) { writer.postCommand(cmd); } } --- NEW FILE: ThreadKillCommand.java --- /* * Author: atotic * Created on Apr 22, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; /** * KILL_THREAD debugger command * */ public class ThreadKillCommand extends AbstractDebuggerCommand { String thread_id; public ThreadKillCommand(RemoteDebugger debugger, String thread_id) { super(debugger); this.thread_id = thread_id; } public String getOutgoing() { return makeCommand(Integer.toString(CMD_THREAD_KILL), sequence, thread_id); } } --- NEW FILE: AbstractDebuggerCommand.java --- /* * Author: atotic * Created on Mar 23, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; import org.eclipse.core.runtime.IStatus; import org.python.pydev.debug.core.PydevDebugPlugin; /** * Superclass of all debugger commands. * * Debugger commands know how to interact with pydevd.py. * See pydevd.py for protocol information. * * Command lifecycle: * cmd = new Command() // creation * cmd.getSequence() // get the sequence number of the command * cmd.getOutgoing() // asks command for outgoing message * cmd.aboutToSend() // called right before we go on wire * // by default, if command needs response * // it gets posted to in the response queue * if (cmd.needsResponse()) * post the command to response queue, otherwise we are done * when response arrives: * if response is an error * cmd.processResponse() * else * cmd.processErrorResponse() * */ public abstract class AbstractDebuggerCommand { static public final int CMD_LIST_THREADS = 102; static public final int CMD_THREAD_CREATED = 103; static public final int CMD_THREAD_KILL = 104; static public final int CMD_THREAD_SUSPEND = 105; static public final int CMD_THREAD_RUN = 106; static public final int CMD_STEP_INTO = 107; static public final int CMD_STEP_OVER = 108; static public final int CMD_STEP_RETURN = 109; static public final int CMD_GET_VARIABLE = 110; static public final int CMD_ERROR = 901; static public final int CMD_VERSION = 501; static public final int CMD_RETURN = 502; protected RemoteDebugger debugger; protected ICommandResponseListener responseListener; int sequence; public AbstractDebuggerCommand(RemoteDebugger debugger) { this.debugger = debugger; this.responseListener = null; sequence = debugger.getNextSequence(); } public void setCompletionListener(ICommandResponseListener listener) { this.responseListener = listener; } /** * @return outgoing message */ public abstract String getOutgoing(); /** * Notification right before the command is sent. * If subclassed, call super() */ public void aboutToSend() { // if we need a response, put me on the waiting queue if (needResponse()) debugger.addToResponseQueue(this); } /** * Does this command require a response? */ public boolean needResponse() { return false; } /** * returns Sequence # */ public final int getSequence() { return sequence; } /** * Called when command completes, if needResponse was true */ public final void processResponse(int cmdCode, String payload) { if (cmdCode / 100 == 9) processErrorResponse(cmdCode, payload); else processOKResponse(cmdCode, payload); if (responseListener != null) responseListener.commandComplete(this); } /** * notification of the response to the command. * You'll get either processResponse or processErrorResponse */ public void processOKResponse(int cmdCode, String payload) { PydevDebugPlugin.log(IStatus.ERROR, "Debugger command ignored response " + getClass().toString() + payload, null); } /** * notification of the response to the command. * You'll get either processResponse or processErrorResponse */ public void processErrorResponse(int cmdCode, String payload) { PydevDebugPlugin.log(IStatus.ERROR, "Debugger command ignored error response " + getClass().toString() + payload, null); } public static String makeCommand(String code, int sequence, String payload) { StringBuffer s = new StringBuffer(); s.append(code); s.append("\t"); s.append(sequence); s.append("\t"); s.append(payload); return s.toString(); } } --- NEW FILE: ThreadListCommand.java --- /* * Author: atotic * Created on Apr 21, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.model.IThread; import org.python.pydev.debug.core.PydevDebugPlugin; import org.python.pydev.debug.model.*; import org.python.pydev.debug.model.PyDebugTarget; /** * ListThreads command. * * See protocol for more info */ public class ThreadListCommand extends AbstractDebuggerCommand { boolean done; PyDebugTarget target; IThread[] threads; public ThreadListCommand(RemoteDebugger debugger, PyDebugTarget target) { super(debugger); this.target = target; done = false; } public void waitUntilDone(int timeout) throws InterruptedException { while (!done && timeout > 0) { timeout -= 100; Thread.sleep(100); } if (timeout < 0) throw new InterruptedException(); } public IThread[] getThreads() { return threads; } public String getOutgoing() { return makeCommand(Integer.toString(CMD_LIST_THREADS), sequence, ""); } public boolean needResponse() { return true; } /** * The response is a list of threads */ public void processOKResponse(int cmdCode, String payload) { if (cmdCode != 102) { PydevDebugPlugin.log(IStatus.ERROR, "Unexpected response to LIST THREADS" + payload, null); return; } try { threads = XMLUtils.ThreadsFromXML(target, payload); } catch (CoreException e) { PydevDebugPlugin.log(IStatus.ERROR, "LIST THREADS got an unexpected response " + payload, null); e.printStackTrace(); } done = true; } public void processErrorResponse(int cmdCode, String payload) { PydevDebugPlugin.log(IStatus.ERROR, "LIST THREADS got an error " + payload, null); } } --- NEW FILE: ThreadSuspendCommand.java --- /* * Author: atotic * Created on Apr 22, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; /** * Suspend thread network command. * * See protocol docs for more info. */ public class ThreadSuspendCommand extends AbstractDebuggerCommand { String thread; public ThreadSuspendCommand(RemoteDebugger debugger, String thread) { super(debugger); this.thread = thread; } public String getOutgoing() { return makeCommand(Integer.toString(CMD_THREAD_SUSPEND), sequence, thread); } } --- NEW FILE: ICommandResponseListener.java --- /* * Author: atotic * Created on May 4, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; /** * All commands are executed asynchronously. * * This interface, if specified, is called when command completes. */ public interface ICommandResponseListener { public void commandComplete(AbstractDebuggerCommand cmd); } --- NEW FILE: StepCommand.java --- /* * Author: atotic * Created on Apr 27, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; /** * Debugger step command. */ public class StepCommand extends AbstractDebuggerCommand { int command_id; String thread_id; /** * * @param command_id CMD_STEP_INTO CMD_STEP_OVER CMD_STEP_RETURN */ public StepCommand(RemoteDebugger debugger, int command_id, String thread_id) { super(debugger); this.command_id = command_id; this.thread_id = thread_id; } public String getOutgoing() { return makeCommand(Integer.toString(command_id), sequence, thread_id); } } --- NEW FILE: GetVariableCommand.java --- /* * Author: atotic * Created on Apr 30, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model.remote; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.python.pydev.debug.core.PydevDebugPlugin; /** * GetVariable network command. * * GetVariable gets the value of the variable from network as XML. * The caller can busy-wait for the response. */ public class GetVariableCommand extends AbstractDebuggerCommand { String locator; boolean isError = false; int responseCode; String payload; public GetVariableCommand(RemoteDebugger debugger, String locator) { super(debugger); this.locator = locator; } public String getOutgoing() { return makeCommand(Integer.toString(CMD_GET_VARIABLE), sequence, locator); } public boolean needResponse() { return true; } public void processOKResponse(int cmdCode, String payload) { responseCode = cmdCode; if (cmdCode == CMD_GET_VARIABLE) this.payload = payload; else { isError = true; PydevDebugPlugin.log(IStatus.ERROR, "Unexpected response to GetVariableCommand", null); } } public void processErrorResponse(int cmdCode, String payload) { responseCode = cmdCode; this.payload = payload; isError = true; } public String getResponse() throws CoreException { if (isError) throw new CoreException( new Status(IStatus.ERROR, PydevDebugPlugin.getPluginID(), 0, "pydevd error:" + payload , null)); else return payload; } } |
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17261/src/org/python/pydev/debug/model Modified Files: XMLUtils.java PyThread.java PyStackFrame.java PyDebugTarget.java Added Files: PyVariable.java PyVariableCollection.java IVariableLocator.java Removed Files: ThreadListCommand.java StepCommand.java ThreadSuspendCommand.java AbstractDebuggerCommand.java ThreadKillCommand.java RemoteDebugger.java ThreadRunCommand.java VersionCommand.java Log Message: variables can now be displayed --- RemoteDebugger.java DELETED --- Index: PyThread.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyThread.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyThread.java 28 Apr 2004 02:49:48 -0000 1.3 --- PyThread.java 5 May 2004 02:02:00 -0000 1.4 *************** *** 8,11 **** --- 8,12 ---- import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.Platform; + import org.eclipse.core.runtime.PlatformObject; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.ILaunch; *************** *** 14,35 **** import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IThread; import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter; /** * Represents python threads. ! * ! * */ ! public class PyThread implements IThread { private PyDebugTarget target; private String name; private String id; ! boolean isPydevThread; // true if this is a debugger thread, that can't be killed/suspended ! ! boolean isSuspended = false; ! boolean isStepping = false; ! IStackFrame[] stack; public PyThread(PyDebugTarget target, String name, String id) { this.target = target; --- 15,37 ---- import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IThread; + import org.eclipse.ui.views.properties.IPropertySource; import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter; + import org.python.pydev.debug.model.remote.*; /** * Represents python threads. ! * Stack global variables are associated with threads. */ ! public class PyThread extends PlatformObject implements IThread { private PyDebugTarget target; private String name; private String id; ! private boolean isPydevThread; // true if this is a debugger thread, that can't be killed/suspended + private boolean isSuspended = false; + private boolean isStepping = false; + private IStackFrame[] stack; + public PyThread(PyDebugTarget target, String name, String id) { this.target = target; *************** *** 38,42 **** isPydevThread = id.equals("-1"); // use a special id for pydev threads } ! /** * If a thread is entering a suspended state, pass in the stack --- 40,44 ---- isPydevThread = id.equals("-1"); // use a special id for pydev threads } ! /** * If a thread is entering a suspended state, pass in the stack *************** *** 45,51 **** isSuspended = state; this.stack = stack; - if (stack != null) - for (int i=0; i<stack.length; i++) - ((PyStackFrame)stack[i]).setThread(this); } --- 47,50 ---- *************** *** 83,90 **** public void terminate() throws DebugException { ! if (!isPydevThread) { ! RemoteDebugger d = target.getDebugger(); ! d.postCommand(new ThreadKillCommand(d, id)); ! } } --- 82,93 ---- public void terminate() throws DebugException { ! // this only kills a single thread, we usually want to kill ! // the whole app ! // if (!isPydevThread) { ! // RemoteDebugger d = target.getDebugger(); ! // d.postCommand(new ThreadKillCommand(d, id)); ! // } ! // else ! target.terminate(); } *************** *** 168,171 **** --- 171,182 ---- } + public PyStackFrame findStackFrameByID(String id) { + if (stack != null) + for (int i=0; i<stack.length; i++) + if (id.equals(((PyStackFrame)stack[i]).getId())) + return (PyStackFrame)stack[i]; + return null; + } + public IBreakpoint[] getBreakpoints() { // TODO Auto-generated method stub *************** *** 179,182 **** --- 190,195 ---- else if (adapter.equals(ITaskListResourceAdapter.class)) return null; + else if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class)) + return super.getAdapter(adapter); else { System.err.println("PythonThread Need adapter " + adapter.toString()); *************** *** 184,188 **** } // ongoing, I do not fully understand all the interfaces they'd like me to support ! return null; } --- 197,201 ---- } // ongoing, I do not fully understand all the interfaces they'd like me to support ! return super.getAdapter(adapter); } --- NEW FILE: IVariableLocator.java --- /* * Author: atotic * Created on Apr 30, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model; /** * IVariableLocator knows how to produce location information * for CMD_GET_VARIABLE * * The location is specified as: * * thread_id, stack_frame, LOCAL|GLOBAL, attribute* */ public interface IVariableLocator { public String getPyDBLocation(); } --- ThreadRunCommand.java DELETED --- Index: PyStackFrame.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyStackFrame.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PyStackFrame.java 28 Apr 2004 02:49:48 -0000 1.2 --- PyStackFrame.java 5 May 2004 02:02:00 -0000 1.3 *************** *** 9,12 **** --- 9,13 ---- import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; + import org.eclipse.core.runtime.PlatformObject; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.ILaunch; *************** *** 16,19 **** --- 17,21 ---- import org.eclipse.debug.core.model.IThread; import org.eclipse.debug.core.model.IVariable; + import org.eclipse.ui.views.properties.IPropertySource; import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter; import org.python.pydev.debug.core.PydevDebugPlugin; *************** *** 24,28 **** * Needs to integrate with the source locator */ ! public class PyStackFrame implements IStackFrame { private String name; --- 26,30 ---- * Needs to integrate with the source locator */ ! public class PyStackFrame extends PlatformObject implements IStackFrame { private String name; *************** *** 31,43 **** private IPath path; private int line; ! ! public PyStackFrame(String id, String name, IPath file, int line) { ! this.id = id; this.name = name; this.path = file; this.line = line; } public IPath getPath() { return path; --- 33,82 ---- private IPath path; private int line; ! private IVariable[] variables; ! private IVariableLocator localsLocator; ! private IVariableLocator globalsLocator; ! ! public PyStackFrame(PyThread in_thread, String in_id, String name, IPath file, int line) { ! this.id = in_id; this.name = name; this.path = file; this.line = line; + this.thread = in_thread; + localsLocator = new IVariableLocator() { + public String getPyDBLocation() { + return thread.getId() + "\t" + id + "\tLOCAL"; + } + }; + globalsLocator = new IVariableLocator() { + public String getPyDBLocation() { + return thread.getId() + "\t" + id + "\tGLOBAL"; + } + }; + } + + public String getId() { + return id; + } + + public IVariableLocator getLocalsLocator() { + return localsLocator; + } + + public IVariableLocator getGlobalLocator() { + return globalsLocator; + } + + public void setName(String name) { + this.name = name; } + public void setPath(IPath path) { + this.path = path; + } + public void setLine(int line) { + this.line = line; + } + public IPath getPath() { return path; *************** *** 47,63 **** return thread; } ! ! public void setThread(PyThread thread) { ! this.thread = thread; } public IVariable[] getVariables() throws DebugException { ! // TODO Auto-generated method stub ! return null; } public boolean hasVariables() throws DebugException { ! // TODO Auto-generated method stub ! return false; } --- 86,100 ---- return thread; } ! ! public void setVariables(IVariable[] locals) { ! this.variables = locals; } public IVariable[] getVariables() throws DebugException { ! return variables; } public boolean hasVariables() throws DebugException { ! return (variables != null); } *************** *** 76,79 **** --- 113,117 ---- public String getName() throws DebugException { return name + " [" + path.lastSegment() + ":" + Integer.toString(line) + "]"; + // return "(" + id + ")" + name + " [" + path.lastSegment() + ":" + Integer.toString(line) + "]"; } *************** *** 164,170 **** else if (adapter.equals(ITaskListResourceAdapter.class)) return null; // ongoing, I do not fully understand all the interfaces they'd like me to support System.err.println("PyStackFrame Need adapter " + adapter.toString()); ! return null; } --- 202,211 ---- else if (adapter.equals(ITaskListResourceAdapter.class)) return null; + else if (adapter.equals(IPropertySource.class) || + adapter.equals(ITaskListResourceAdapter.class)) + return super.getAdapter(adapter); // ongoing, I do not fully understand all the interfaces they'd like me to support System.err.println("PyStackFrame Need adapter " + adapter.toString()); ! return super.getAdapter(adapter); } *************** *** 196,199 **** return super.equals(obj); } - } --- 237,239 ---- --- ThreadListCommand.java DELETED --- --- ThreadSuspendCommand.java DELETED --- --- StepCommand.java DELETED --- Index: PyDebugTarget.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyDebugTarget.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyDebugTarget.java 28 Apr 2004 02:49:48 -0000 1.3 --- PyDebugTarget.java 5 May 2004 02:02:00 -0000 1.4 *************** *** 13,18 **** --- 13,20 ---- import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; + import org.eclipse.core.runtime.PlatformObject; import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; *************** *** 27,31 **** --- 29,35 ---- import org.eclipse.debug.core.model.IThread; import org.eclipse.ui.views.properties.IPropertySource; + import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter; import org.python.pydev.debug.core.PydevDebugPlugin; + import org.python.pydev.debug.model.remote.*; /** *************** *** 33,39 **** * TODO Comment this class * Make sure we fire the right org.eclipse.debug.core.DebugEvents ! * What happens with debug events? LaunchViewEventHandlerL:: */ ! public class PyDebugTarget implements IDebugTarget, ILaunchListener { ILaunch launch; --- 37,43 ---- * TODO Comment this class * Make sure we fire the right org.eclipse.debug.core.DebugEvents ! * What happens with debug events? see LaunchViewEventHandler */ ! public class PyDebugTarget extends PlatformObject implements IDebugTarget, ILaunchListener { ILaunch launch; *************** *** 120,123 **** --- 124,128 ---- if (debugger != null) debugger.disconnect(); + threads = new IThread[0]; process.terminate(); } *************** *** 167,170 **** --- 172,177 ---- public IThread[] getThreads() throws DebugException { + if (debugger == null) + return null; if (threads == null) { ThreadListCommand cmd = new ThreadListCommand(debugger, this); *************** *** 225,231 **** } else if (adapter.equals(IPropertySource.class)) return launch.getAdapter(adapter); ! else ! System.err.println("Need adapter " + adapter.toString()); ! return null; } --- 232,239 ---- } else if (adapter.equals(IPropertySource.class)) return launch.getAdapter(adapter); ! else if (adapter.equals(ITaskListResourceAdapter.class)) ! return super.getAdapter(adapter); ! System.err.println("Need adapter " + adapter.toString()); ! return super.getAdapter(adapter); } *************** *** 251,255 **** } ! private void fireEvent(DebugEvent event) { DebugPlugin manager= DebugPlugin.getDefault(); if (manager != null) { --- 259,263 ---- } ! protected void fireEvent(DebugEvent event) { DebugPlugin manager= DebugPlugin.getDefault(); if (manager != null) { *************** *** 261,268 **** * @return an existing thread with a given id (null if none) */ ! private IThread findThreadByID(String thread_id) throws DebugException { for (int i = 0; i < threads.length; i++) if (thread_id.equals(((PyThread)threads[i]).getId())) ! return threads[i]; return null; } --- 269,276 ---- * @return an existing thread with a given id (null if none) */ ! protected PyThread findThreadByID(String thread_id) { for (int i = 0; i < threads.length; i++) if (thread_id.equals(((PyThread)threads[i]).getId())) ! return (PyThread)threads[i]; return null; } *************** *** 272,276 **** */ private void processThreadCreated(String payload) { ! IThread[] newThreads = XMLUtils.ThreadsFromXML(this, payload); if (threads == null) threads = newThreads; --- 280,291 ---- */ private void processThreadCreated(String payload) { ! ! IThread[] newThreads; ! try { ! newThreads = XMLUtils.ThreadsFromXML(this, payload); ! } catch (CoreException e) { ! PydevDebugPlugin.errorDialog("Error in processThreadCreated", e); ! return; ! } if (threads == null) threads = newThreads; *************** *** 291,377 **** // Remote this from our thread list private void processThreadKilled(String thread_id) { ! try { ! IThread threadToDelete = findThreadByID(thread_id); ! if (threadToDelete != null) { ! int j = 0; ! IThread[] newThreads = new IThread[threads.length - 1]; ! for (int i=0; i < threads.length; i++) ! if (threads[i] != threadToDelete) ! newThreads[j++] = threads[i]; ! threads = newThreads; ! fireEvent(new DebugEvent(threadToDelete, DebugEvent.TERMINATE)); ! } ! } catch (DebugException e) { ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected error thread kill", e); } } private void processThreadSuspended(String payload) { try { ! Object[] threadNstack = XMLUtils.XMLToStack(payload); ! PyThread t = (PyThread)findThreadByID((String)threadNstack[0]); ! int reason = DebugEvent.UNSPECIFIED; ! String stopReason = (String) threadNstack[1]; ! if (stopReason != null) { ! int stopReason_i = Integer.parseInt(stopReason); ! if (stopReason_i == AbstractDebuggerCommand.CMD_STEP_OVER || ! stopReason_i == AbstractDebuggerCommand.CMD_STEP_INTO || ! stopReason_i == AbstractDebuggerCommand.CMD_STEP_RETURN) ! reason = DebugEvent.STEP_END; ! else if (stopReason_i == AbstractDebuggerCommand.CMD_THREAD_SUSPEND) ! reason = DebugEvent.CLIENT_REQUEST; ! else { ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected reason for suspension", null); ! reason = DebugEvent.UNSPECIFIED; ! } ! } ! if (t != null) { ! t.setSuspended(true, (IStackFrame[])threadNstack[2]); ! if (reason == DebugEvent.STEP_END) ! System.out.println("need love"); ! fireEvent(new DebugEvent(t, DebugEvent.SUSPEND, reason)); } ! } catch (DebugException e) { ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected error thread suspended", e); } } static Pattern threadRunPattern = Pattern.compile("(\\d+)\\t(\\w*)"); private void processThreadRun(String payload) { ! try { ! String threadID = ""; ! int resumeReason = DebugEvent.UNSPECIFIED; ! Matcher m = threadRunPattern.matcher(payload); ! if (m.matches()) { ! threadID = m.group(1); ! try { ! int raw_reason = Integer.parseInt(m.group(2)); ! if (raw_reason == AbstractDebuggerCommand.CMD_STEP_OVER) ! resumeReason = DebugEvent.STEP_OVER; ! else if (raw_reason == AbstractDebuggerCommand.CMD_STEP_RETURN) ! resumeReason = DebugEvent.STEP_RETURN; ! else if (raw_reason == AbstractDebuggerCommand.CMD_STEP_INTO) ! resumeReason = DebugEvent.STEP_INTO; ! else if (raw_reason == AbstractDebuggerCommand.CMD_THREAD_RUN) ! resumeReason = DebugEvent.CLIENT_REQUEST; ! else { ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected resume reason code", null); ! resumeReason = DebugEvent.UNSPECIFIED; ! } } ! catch (NumberFormatException e) { ! // expected, when pydevd reports "None" resumeReason = DebugEvent.UNSPECIFIED; ! } } ! else ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected treadRun payload " + payload, null); ! ! PyThread t = (PyThread)findThreadByID(threadID); ! if (t != null) { ! t.setSuspended(false, null); ! fireEvent(new DebugEvent(t, DebugEvent.RESUME, resumeReason)); } ! } catch (DebugException e) { ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected error thread run", e); } } --- 306,388 ---- // Remote this from our thread list private void processThreadKilled(String thread_id) { ! IThread threadToDelete = findThreadByID(thread_id); ! if (threadToDelete != null) { ! int j = 0; ! IThread[] newThreads = new IThread[threads.length - 1]; ! for (int i=0; i < threads.length; i++) ! if (threads[i] != threadToDelete) ! newThreads[j++] = threads[i]; ! threads = newThreads; ! fireEvent(new DebugEvent(threadToDelete, DebugEvent.TERMINATE)); } } private void processThreadSuspended(String payload) { + Object[] threadNstack; try { ! threadNstack = XMLUtils.XMLToStack(this, payload); ! } catch (CoreException e) { ! PydevDebugPlugin.errorDialog("Error reading ThreadSuspended", e); ! return; ! } ! PyThread t = (PyThread)threadNstack[0]; ! int reason = DebugEvent.UNSPECIFIED; ! String stopReason = (String) threadNstack[1]; ! if (stopReason != null) { ! int stopReason_i = Integer.parseInt(stopReason); ! if (stopReason_i == AbstractDebuggerCommand.CMD_STEP_OVER || ! stopReason_i == AbstractDebuggerCommand.CMD_STEP_INTO || ! stopReason_i == AbstractDebuggerCommand.CMD_STEP_RETURN) ! reason = DebugEvent.STEP_END; ! else if (stopReason_i == AbstractDebuggerCommand.CMD_THREAD_SUSPEND) ! reason = DebugEvent.CLIENT_REQUEST; ! else { ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected reason for suspension", null); ! reason = DebugEvent.UNSPECIFIED; } ! } ! if (t != null) { ! t.setSuspended(true, (IStackFrame[])threadNstack[2]); ! fireEvent(new DebugEvent(t, DebugEvent.SUSPEND, reason)); } } static Pattern threadRunPattern = Pattern.compile("(\\d+)\\t(\\w*)"); + /** + * ThreadRun event processing + */ private void processThreadRun(String payload) { ! String threadID = ""; ! int resumeReason = DebugEvent.UNSPECIFIED; ! Matcher m = threadRunPattern.matcher(payload); ! if (m.matches()) { ! threadID = m.group(1); ! try { ! int raw_reason = Integer.parseInt(m.group(2)); ! if (raw_reason == AbstractDebuggerCommand.CMD_STEP_OVER) ! resumeReason = DebugEvent.STEP_OVER; ! else if (raw_reason == AbstractDebuggerCommand.CMD_STEP_RETURN) ! resumeReason = DebugEvent.STEP_RETURN; ! else if (raw_reason == AbstractDebuggerCommand.CMD_STEP_INTO) ! resumeReason = DebugEvent.STEP_INTO; ! else if (raw_reason == AbstractDebuggerCommand.CMD_THREAD_RUN) ! resumeReason = DebugEvent.CLIENT_REQUEST; ! else { ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected resume reason code", null); resumeReason = DebugEvent.UNSPECIFIED; ! } } ! catch (NumberFormatException e) { ! // expected, when pydevd reports "None" ! resumeReason = DebugEvent.UNSPECIFIED; } ! } ! else ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected treadRun payload " + payload, null); ! ! PyThread t = (PyThread)findThreadByID(threadID); ! if (t != null) { ! t.setSuspended(false, null); ! fireEvent(new DebugEvent(t, DebugEvent.RESUME, resumeReason)); } } --- VersionCommand.java DELETED --- --- ThreadKillCommand.java DELETED --- Index: XMLUtils.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/XMLUtils.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** XMLUtils.java 27 Apr 2004 19:12:59 -0000 1.1 --- XMLUtils.java 5 May 2004 02:02:00 -0000 1.2 *************** *** 16,23 **** --- 16,27 ---- import javax.xml.parsers.SAXParserFactory; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; + import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IThread; + import org.eclipse.debug.core.model.IVariable; + import org.python.pydev.debug.core.PydevDebugPlugin; import org.xml.sax.Attributes; import org.xml.sax.SAXException; *************** *** 25,33 **** /** ! * Various utilities */ public class XMLUtils { static SAXParserFactory parserFactory = SAXParserFactory.newInstance(); /** * SAX parser for thread info --- 29,53 ---- /** ! * Translate XML protocol responses into Py structures. ! * ! * Things get more complex than I'd like when complex Py structures get built. */ public class XMLUtils { static SAXParserFactory parserFactory = SAXParserFactory.newInstance(); + + static SAXParser getSAXParser() throws CoreException { + SAXParser parser = null; + try { + synchronized(parserFactory) { + parser = parserFactory.newSAXParser(); + } + } catch (ParserConfigurationException e) { + throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML SAX error", e)); + } catch (SAXException e) { + throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML SAX error", e)); + } + return parser; + } /** * SAX parser for thread info *************** *** 58,68 **** * Creates IThread[] from the XML response */ ! static public IThread[] ThreadsFromXML(PyDebugTarget target, String payload) { IThread[] threads = null; try { ! SAXParser parser; ! synchronized(parserFactory) { ! parser = parserFactory.newSAXParser(); ! } XMLToThreadInfo info = new XMLToThreadInfo(target); parser.parse(new StringBufferInputStream(payload), info); --- 78,85 ---- * Creates IThread[] from the XML response */ ! static public IThread[] ThreadsFromXML(PyDebugTarget target, String payload) throws CoreException { IThread[] threads = null; try { ! SAXParser parser = getSAXParser(); XMLToThreadInfo info = new XMLToThreadInfo(target); parser.parse(new StringBufferInputStream(payload), info); *************** *** 72,110 **** while (it.hasNext()) threads[i++] = (IThread)it.next(); ! } catch (ParserConfigurationException e) { ! e.printStackTrace(); } catch (SAXException e) { ! e.printStackTrace(); } catch (IOException e) { ! e.printStackTrace(); } return threads; } static class XMLToStackInfo extends DefaultHandler { ! public String thread_id; public String stop_reason; public ArrayList stack = new ArrayList(); ! /* ! """ <xml> ! <thread id="id"/> ! <frame id="id" name="functionName " file="file" line="line"> ! */ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { ! if (qName.equals("thread")) { ! thread_id = attributes.getValue("id"); ! stop_reason = attributes.getValue("stop_reason"); ! } ! else if (qName.equals("frame")) { ! String name = attributes.getValue("name"); ! String id = attributes.getValue("id"); ! String file = attributes.getValue("file"); ! String line = attributes.getValue("line"); ! IPath filePath = new Path(file); ! stack.add(new PyStackFrame(id, name, filePath, Integer.parseInt(line))); ! } } } /** --- 89,210 ---- while (it.hasNext()) threads[i++] = (IThread)it.next(); ! } catch (CoreException e) { ! throw e; } catch (SAXException e) { ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML error", e)); } catch (IOException e) { ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML error", e)); } return threads; } + /** + * Creates a variable from XML attributes + * <var name="self" type="ObjectType" value="<DeepThread>"/> + */ + static PyVariable createVariable(PyDebugTarget target, IVariableLocator locator, Attributes attributes) { + PyVariable var; + String name = attributes.getValue("name"); + String type = attributes.getValue("type"); + String value = attributes.getValue("value"); + if (value != null) + value = URLDecoder.decode(value); + String isContainer = attributes.getValue("isContainer"); + if ("True".equals(isContainer)) + var = new PyVariableCollection(target, name, type, value, locator); + else + var = new PyVariable(target, name, type, value); + return var; + } + + /** + * XMLToStack SAX traverse + */ static class XMLToStackInfo extends DefaultHandler { ! public PyThread thread; public String stop_reason; public ArrayList stack = new ArrayList(); + public ArrayList locals; + public PyDebugTarget target; + PyStackFrame currentFrame; ! public XMLToStackInfo(PyDebugTarget target) { ! this.target = target; ! } ! ! private void startThread(Attributes attributes) throws SAXException { ! String target_id = attributes.getValue("id"); ! thread = target.findThreadByID(target_id); ! if (thread == null) ! throw new SAXException("Thread not found"); // can happen when debugger has been destroyed ! stop_reason = attributes.getValue("stop_reason"); ! } ! ! private void startFrame(Attributes attributes) { ! String name = attributes.getValue("name"); ! String id = attributes.getValue("id"); ! String file = attributes.getValue("file"); ! String line = attributes.getValue("line"); ! IPath filePath = new Path(file); ! // Try to recycle old stack objects ! currentFrame = thread.findStackFrameByID(id);; ! if (currentFrame == null) ! currentFrame = new PyStackFrame(thread, id, name, filePath, Integer.parseInt(line)); ! else { ! currentFrame.setName(name); ! currentFrame.setPath(filePath); ! currentFrame.setLine(Integer.parseInt(line)); ! } ! stack.add(currentFrame); ! } ! ! // local variables belong to the stack frame ! // when ! private void startVar(Attributes attributes) { ! if (locals == null) { ! locals = new ArrayList(); ! PyVariableCollection global = new PyVariableCollection(target, "Globals", "frame.f_global", "Global variables", currentFrame.getGlobalLocator()); ! locals.add(global); // locals always include global as the top ! } ! // create a local variable, and add it to locals ! PyVariable newLocal = createVariable(target, currentFrame.getLocalsLocator(), attributes); ! locals.add(newLocal); ! } ! ! ! /** ! * Assign stack frames to thread. ! * Assign global variables to thread ! * Assign local variables to stack frame ! */ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { ! /* ! <xml> ! <thread id="id"/> ! <frame id="id" name="functionName " file="file" line="line"> ! <var scope="local" name="self" type="ObjectType" value="<DeepThread>"/> ! </frame>* ! */ ! if (qName.equals("thread")) ! startThread(attributes); ! else if (qName.equals("frame")) ! startFrame(attributes); ! else if (qName.equals("var")) ! startVar(attributes); } + + public void endElement(String uri, String localName, String qName) + throws SAXException { + if (qName.equals("frame")) { + // when frame ends, we need to assign all the local variables + IVariable[] locArry = new IVariable[locals.size()]; + for (int i=0; i < locArry.length; i++) + locArry[i] = (IVariable)locals.get(i); + currentFrame.setVariables(locArry); + locals = null; + } + } + } /** *************** *** 112,125 **** * @return an array of [thread_id, stop_reason, IStackFrame[]] */ ! public static Object[] XMLToStack(String payload) { String thread_id; IStackFrame[] stack; Object[] retVal = new Object[3]; try { ! SAXParser parser; ! synchronized(parserFactory) { ! parser = parserFactory.newSAXParser(); ! } ! XMLToStackInfo info = new XMLToStackInfo(); parser.parse(new StringBufferInputStream(payload), info); stack = new IStackFrame[info.stack.size()]; --- 212,222 ---- * @return an array of [thread_id, stop_reason, IStackFrame[]] */ ! public static Object[] XMLToStack(PyDebugTarget target, String payload) throws CoreException { String thread_id; IStackFrame[] stack; Object[] retVal = new Object[3]; try { ! SAXParser parser = getSAXParser(); ! XMLToStackInfo info = new XMLToStackInfo(target); parser.parse(new StringBufferInputStream(payload), info); stack = new IStackFrame[info.stack.size()]; *************** *** 128,143 **** while (it.hasNext()) stack[i++] = (IStackFrame)it.next(); ! retVal[0] = info.thread_id; retVal[1] = info.stop_reason; retVal[2] = stack; ! } catch (ParserConfigurationException e) { ! e.printStackTrace(); } catch (SAXException e) { ! e.printStackTrace(); } catch (IOException e) { ! e.printStackTrace(); } return retVal; } } --- 225,283 ---- while (it.hasNext()) stack[i++] = (IStackFrame)it.next(); ! retVal[0] = info.thread; retVal[1] = info.stop_reason; retVal[2] = stack; ! } catch (CoreException e) { ! throw e; } catch (SAXException e) { ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML error", e)); } catch (IOException e) { ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML error", e)); } return retVal; } + + /** + * Processes CMD_GET_VARIABLE return + * + */ + static class XMLToVariableInfo extends DefaultHandler { + private PyDebugTarget target; + private IVariableLocator locator; + public ArrayList vars; + + public XMLToVariableInfo(PyDebugTarget target, IVariableLocator locator) { + this.target = target; + this.locator = locator; + vars = new ArrayList(); + } + + public void startElement(String uri, String localName, String qName, + Attributes attributes) throws SAXException { + // <var name="self" type="ObjectType" value="<DeepThread>"/> + // create a local variable, and add it to locals + if (qName.equals("var")) + vars.add(createVariable(target, locator, attributes)); + } + } + + public static PyVariable[] XMLToVariables(PyDebugTarget target, IVariableLocator locator, String payload) throws CoreException { + try { + SAXParser parser = getSAXParser(); + XMLToVariableInfo info = new XMLToVariableInfo(target, locator); + parser.parse(new StringBufferInputStream(payload), info); + PyVariable[] vars = new PyVariable[info.vars.size()]; + for (int i =0; i< info.vars.size(); i++) + vars[i] = (PyVariable)info.vars.get(i); + return vars; + } catch (CoreException e) { + throw e; + } catch (SAXException e) { + throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML error", e)); + } catch (IOException e) { + throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML error", e)); + } + } + } --- NEW FILE: PyVariableCollection.java --- /* * Author: atotic * Created on May 4, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.model.IVariable; import org.python.pydev.debug.core.PydevDebugPlugin; import org.python.pydev.debug.model.remote.AbstractDebuggerCommand; import org.python.pydev.debug.model.remote.GetVariableCommand; import org.python.pydev.debug.model.remote.ICommandResponseListener; import org.python.pydev.debug.model.remote.RemoteDebugger; /** * * TODO Comment this class */ public class PyVariableCollection extends PyVariable implements ICommandResponseListener, IVariableLocator { IVariableLocator locator; PyVariable[] variables = new PyVariable[0]; IVariable[] waitVariables = null; int requestedVariables = 0; // Network request state: 0 did not request, 1 requested, 2 requested & arrived boolean fireChangeEvent = true; public PyVariableCollection(PyDebugTarget target, String name, String type, String value, IVariableLocator locator) { super(target, name, type, value); this.locator = locator; } public String getPyDBLocation() { return locator.getPyDBLocation() + "\t" + name; } private IVariable[] getWaitVariables() { if (waitVariables == null) { PyVariable waitVar = new PyVariable(target, "wait", "", "for network"); waitVariables = new IVariable[1]; waitVariables[0] = waitVar; } return waitVariables; } public void commandComplete(AbstractDebuggerCommand cmd) { try { String payload = ((GetVariableCommand) cmd).getResponse(); synchronized(variables) { variables = XMLUtils.XMLToVariables(target, this, payload); } } catch (CoreException e) { variables = new PyVariable[1]; variables[0] = new PyVariable(target, "Error", "pydev ERROR", "Could not resolve variable"); PydevDebugPlugin.log(IStatus.ERROR, "Error fetching a variable", e); } requestedVariables = 2; if (fireChangeEvent) target.fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.STATE)); } public IVariable[] getVariables() throws DebugException { if (requestedVariables == 2) return variables; else if (requestedVariables == 1) return getWaitVariables(); RemoteDebugger dbg; dbg = target.getDebugger(); // send the command, and then busy-wait GetVariableCommand cmd = new GetVariableCommand(dbg, getPyDBLocation()); cmd.setCompletionListener(this); requestedVariables = 1; fireChangeEvent = false; // do not fire change event while we are waiting on response dbg.postCommand(cmd); try { // VariablesView does not deal well with children changing asynchronously. // it causes unneeded scrolling, because view preserves selection instead // of visibility. // I try to minimize the occurence here, by giving pydevd time to complete the // task before we are forced to do asynchronous notification. int i = 10; while (--i > 0 && requestedVariables != 2) Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } fireChangeEvent = true; if (requestedVariables == 2) return variables; else return getWaitVariables(); } public boolean hasVariables() throws DebugException { return true; } public String getReferenceTypeName() throws DebugException { return type; } } --- AbstractDebuggerCommand.java DELETED --- --- NEW FILE: PyVariable.java --- /* * Author: atotic * Created on Apr 28, 2004 * License: Common Public License v1.0 */ package org.python.pydev.debug.model; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.PlatformObject; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IVariable; import org.eclipse.ui.views.properties.IPropertySource; import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter; /** * * TODO Comment this class * */ public class PyVariable extends PlatformObject implements IVariable, IValue { protected String name; protected String type; protected String value; protected PyDebugTarget target; public PyVariable(PyDebugTarget target, String name, String type, String value) { this.value = value; this.name = name; this.type = type; this.target = target; } public IValue getValue() throws DebugException { return this; } public String getValueString() throws DebugException { if (value == null) return ""; if ("StringType".equals(type) || "UnicodeType".equals(type)) // quote the strings return "\"" + value + "\""; return value; } public String getName() throws DebugException { return name; } public String getModelIdentifier() { return target.getModelIdentifier(); } public IDebugTarget getDebugTarget() { return target; } public ILaunch getLaunch() { return target.getLaunch(); } /** * TODO valueChanging nterface has not been implemented yet. * When implemented, recently changed variables are shown in red. */ public boolean supportsValueModification() { return false; } public boolean hasValueChanged() throws DebugException { return false; } public void setValue(String expression) throws DebugException { } public void setValue(IValue value) throws DebugException { } public boolean verifyValue(String expression) throws DebugException { return false; } public boolean verifyValue(IValue value) throws DebugException { return false; } public Object getAdapter(Class adapter) { if (adapter.equals(ILaunch.class) || adapter.equals(IResource.class)) return target.getAdapter(adapter); else if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class)) return super.getAdapter(adapter); // ongoing, I do not fully understand all the interfaces they'd like me to support System.err.println("PyVariable Need adapter " + adapter.toString()); return super.getAdapter(adapter); } public boolean isAllocated() throws DebugException { return true; } public IVariable[] getVariables() throws DebugException { return null; } public boolean hasVariables() throws DebugException { return false; } public String getReferenceTypeName() throws DebugException { return type; } } |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:02:08
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17261/src/org/python/pydev/debug/ui/actions Added Files: PythonRunActionDelegate.java Log Message: variables can now be displayed --- NEW FILE: PythonRunActionDelegate.java --- /* * Author: atotic * Created: Aug 27, 2003 * License: Common Public License v1.0 */ package org.python.pydev.debug.ui.actions; import org.eclipse.core.resources.IFile; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.actions.ActionDelegate; import org.python.pydev.debug.ui.launching.LaunchShortcut; /** * Implements "Run Python..." extension for org.eclipse.ui.popupMenus. * * <p>Passes off the selected file to {@link org.python.pydev.debug.ui.launching.LaunchShortcut LaunchShortcut}. * * @see org.python.pydev.debug.ui.launching.LaunchShortcut */ public class PythonRunActionDelegate extends ActionDelegate implements IObjectActionDelegate { private IFile selectedFile; private IWorkbenchPart part; public void run(IAction action) { if (part != null && selectedFile != null) { // figure out run or debug mode String runMode = action.getId().endsWith("RunPythonAction") ? ILaunchManager.RUN_MODE : ILaunchManager.DEBUG_MODE; LaunchShortcut shortcut = new LaunchShortcut(); shortcut.setShowDialog(true); shortcut.launch(selectedFile, runMode, null); } } public void selectionChanged(IAction action, ISelection selection) { selectedFile = null; if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; if (structuredSelection.size() == 1) { Object selectedResource = structuredSelection.getFirstElement(); if (selectedResource instanceof IFile) selectedFile = (IFile) selectedResource; } } } public void setActivePart(IAction action, IWorkbenchPart targetPart) { this.part = targetPart; } } |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:02:08
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17261/src/org/python/pydev/debug/ui/launching Modified Files: PythonRunner.java LaunchShortcut.java Removed Files: PythonRunActionDelegate.java Log Message: variables can now be displayed Index: LaunchShortcut.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/LaunchShortcut.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LaunchShortcut.java 15 Apr 2004 23:24:49 -0000 1.4 --- LaunchShortcut.java 5 May 2004 02:01:58 -0000 1.5 *************** *** 227,231 **** } else { DebugUITools.launch(conf, mode); ! // TODO what's this code doing? // It is copied from Ant, so I am keeping it around // if (targetAttribute != null) { --- 227,231 ---- } else { DebugUITools.launch(conf, mode); ! // what's this code doing? // It is copied from Ant, so I am keeping it around // if (targetAttribute != null) { Index: PythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunner.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PythonRunner.java 27 Apr 2004 19:12:58 -0000 1.4 --- PythonRunner.java 5 May 2004 02:01:58 -0000 1.5 *************** *** 23,27 **** import org.python.pydev.debug.model.PyDebugTarget; import org.python.pydev.debug.model.PySourceLocator; ! import org.python.pydev.debug.model.RemoteDebugger; /** --- 23,27 ---- import org.python.pydev.debug.model.PyDebugTarget; import org.python.pydev.debug.model.PySourceLocator; ! import org.python.pydev.debug.model.remote.RemoteDebugger; /** --- PythonRunActionDelegate.java DELETED --- |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:01:54
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17205/src/org/python/pydev/debug/ui/actions Log Message: Directory /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/actions added to the repository |
From: Aleksandar T. <at...@us...> - 2004-05-05 02:01:54
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17205/src/org/python/pydev/debug/model/remote Log Message: Directory /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote added to the repository |
From: Aleksandar T. <at...@us...> - 2004-04-28 02:49:57
|
Update of /cvsroot/pydev/org.python.pydev.debug/pysrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6529/pysrc Modified Files: pydevd.py Log Message: Stepping is done Index: pydevd.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/pysrc/pydevd.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pydevd.py 27 Apr 2004 19:13:20 -0000 1.2 --- pydevd.py 28 Apr 2004 02:49:48 -0000 1.3 *************** *** 162,166 **** def makeMessage(self, cmd, seq, payload): ! encoded = urllib.quote(str(payload), '/<>_=" ') return str(cmd) + '\t' + str(seq) + '\t' + encoded + "\n" --- 162,166 ---- def makeMessage(self, cmd, seq, payload): ! encoded = urllib.quote(str(payload), '/<>_=" \t') return str(cmd) + '\t' + str(seq) + '\t' + encoded + "\n" *************** *** 272,278 **** try: int_id = int(thread_id) ! print >>sys.stderr, "enumerating" threads = threading.enumerate() ! print >>sys.stderr, "done enumerating" for i in threads: if int_id == id(i): return i --- 272,279 ---- try: int_id = int(thread_id) ! # print >>sys.stderr, "enumerating" ! # there was a deadlock here when I did not remove the tracing function when thread was dead threads = threading.enumerate() ! # print >>sys.stderr, "done enumerating" for i in threads: if int_id == id(i): return i *************** *** 390,394 **** try: cmd = None ! print >>sys.stderr, "processing command", id if (id == CMD_VERSION): # response is version number cmd = self.cmdFactory.makeVersionMessage(seq) --- 391,395 ---- try: cmd = None ! # print >>sys.stderr, "processing command", id if (id == CMD_VERSION): # response is version number cmd = self.cmdFactory.makeVersionMessage(seq) *************** *** 437,441 **** thread.stop_reason = stop_reason ! def doWaitSuspend(self, thread): """ busy waits until the thread state changes to RUN it expects thread's state as attributes of the thread. --- 438,442 ---- thread.stop_reason = stop_reason ! def doWaitSuspend(self, thread, frame, event, arg): """ busy waits until the thread state changes to RUN it expects thread's state as attributes of the thread. *************** *** 444,448 **** # print >>sys.stderr, "thread suspended", thread.getName() ! cmd = self.cmdFactory.makeThreadSuspendMessage(id(thread), thread.pydev_frame, thread.stop_reason) self.writer.addCommand(cmd) while (thread.pydev_state == PyDB.STATE_SUSPEND): --- 445,449 ---- # print >>sys.stderr, "thread suspended", thread.getName() ! cmd = self.cmdFactory.makeThreadSuspendMessage(id(thread), frame, thread.stop_reason) self.writer.addCommand(cmd) while (thread.pydev_state == PyDB.STATE_SUSPEND): *************** *** 453,469 **** """ process any stepping instructions """ if (thread.pydev_step_cmd == CMD_STEP_INTO): ! thread.pydev_step_return = None ! pass elif (thread.pydev_step_cmd == CMD_STEP_OVER): ! thread.pydev_step_stop = thread.pydev_frame elif (thread.pydev_step_cmd == CMD_STEP_RETURN): ! thread.pydev_step_stop = thread.pydev_frame.f_back except AttributeError: thread.pydev_step_cmd = None # so we do ont thro pass ! del thread.pydev_frame ! del thread.pydev_event ! del thread.pydev_arg ! print >>sys.stderr, "thread resumed", thread.getName() cmd = self.cmdFactory.makeThreadRunMessage(id(thread), thread.pydev_step_cmd) --- 454,466 ---- """ process any stepping instructions """ if (thread.pydev_step_cmd == CMD_STEP_INTO): ! thread.pydev_step_stop = None elif (thread.pydev_step_cmd == CMD_STEP_OVER): ! thread.pydev_step_stop = frame elif (thread.pydev_step_cmd == CMD_STEP_RETURN): ! thread.pydev_step_stop = frame.f_back except AttributeError: thread.pydev_step_cmd = None # so we do ont thro pass ! print >>sys.stderr, "thread resumed", thread.getName() cmd = self.cmdFactory.makeThreadRunMessage(id(thread), thread.pydev_step_cmd) *************** *** 484,492 **** """ if thread has a suspend flag, we suspend with a busy wait """ if (t.pydev_state == PyDB.STATE_SUSPEND): - t.pydev_frame = frame - t.pydev_event = event - t.pydev_arg = arg wasSuspended = True ! self.doWaitSuspend(t) return self.trace_dispatch except AttributeError: --- 481,486 ---- """ if thread has a suspend flag, we suspend with a busy wait """ if (t.pydev_state == PyDB.STATE_SUSPEND): wasSuspended = True ! self.doWaitSuspend(t, frame, event, arg) return self.trace_dispatch except AttributeError: *************** *** 498,510 **** if ( not wasSuspended and event == 'line'): ! """ step handling """ try: if (t.pydev_step_cmd == CMD_STEP_INTO): self.setSuspend(t, CMD_STEP_INTO) ! self.doWaitSuspend(t) elif (t.pydev_step_cmd == CMD_STEP_OVER or t.pydev_step_cmd == CMD_STEP_RETURN): if (t.pydev_step_stop == frame): self.setSuspend(t, t.pydev_step_cmd) ! self.doWaitSuspend(t) except: t.pydev_step_cmd = None --- 492,504 ---- if ( not wasSuspended and event == 'line'): ! """ step handling. We stop when we hit the right frame""" try: if (t.pydev_step_cmd == CMD_STEP_INTO): self.setSuspend(t, CMD_STEP_INTO) ! self.doWaitSuspend(t, frame, event, arg) elif (t.pydev_step_cmd == CMD_STEP_OVER or t.pydev_step_cmd == CMD_STEP_RETURN): if (t.pydev_step_stop == frame): self.setSuspend(t, t.pydev_step_cmd) ! self.doWaitSuspend(t, frame, event, arg) except: t.pydev_step_cmd = None |