[Pydev-cvs] org.python.pydev.debug/src/org/python/pydev/debug/model/remote DebuggerWriter.java, 1.
Brought to you by:
fabioz
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20604/src/org/python/pydev/debug/model/remote Modified Files: DebuggerWriter.java ThreadKillCommand.java StepCommand.java ChangeVariableCommand.java AbstractDebuggerCommand.java ThreadRunCommand.java RunCommand.java RemoveBreakpointCommand.java AbstractRemoteDebugger.java DebuggerReader.java EvaluateExpressionCommand.java RemoteDebugger.java ThreadListCommand.java VersionCommand.java ThreadSuspendCommand.java AbstractListenConnector.java GetFrameCommand.java GetVariableCommand.java ICommandResponseListener.java SetBreakpointCommand.java ListenConnector.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: RemoteDebugger.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/RemoteDebugger.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RemoteDebugger.java 17 Apr 2006 02:06:17 -0000 1.11 --- RemoteDebugger.java 27 Sep 2008 19:59:06 -0000 1.12 *************** *** 20,135 **** * Network interface to the remote debugger. */ ! public class RemoteDebugger extends AbstractRemoteDebugger { ! private ListenConnector connector; // Runnable that connects to the debugger ! private Thread connectThread; // ! private PythonRunnerConfig config; ! public RemoteDebugger(PythonRunnerConfig config) { ! this.config = config; ! } ! 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(PydevDebugPlugin.makeStatus(IStatus.ERROR, "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 ! */ ! private void connected(Socket socket) throws IOException { ! this.socket = socket; ! } ! ! public void disconnect() { ! if (socket != null) { ! try { ! socket.shutdownInput(); // trying to make my pydevd notice that the socket is gone ! } catch (Exception e) { ! // ok, ignore ! } ! try { ! socket.shutdownOutput(); ! } catch (Exception e) { ! // ok, ignore ! } ! try { ! socket.close(); ! } catch (Exception e) { ! // ok, ignore ! } ! } ! 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; - } try { ! if(target != null){ ! target.terminate(); ! } } catch (DebugException e) { throw new RuntimeException(e); } ! target = null; ! } } --- 20,135 ---- * Network interface to the remote debugger. */ ! public class RemoteDebugger extends AbstractRemoteDebugger { ! private ListenConnector connector; // Runnable that connects to the debugger ! private Thread connectThread; // ! private PythonRunnerConfig config; ! public RemoteDebugger(PythonRunnerConfig config) { ! this.config = config; ! } ! 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(PydevDebugPlugin.makeStatus(IStatus.ERROR, "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 ! */ ! private void connected(Socket socket) throws IOException { ! this.socket = socket; ! } ! ! public void disconnect() { ! if (socket != null) { ! try { ! socket.shutdownInput(); // trying to make my pydevd notice that the socket is gone ! } catch (Exception e) { ! // ok, ignore ! } ! try { ! socket.shutdownOutput(); ! } catch (Exception e) { ! // ok, ignore ! } ! try { ! socket.close(); ! } catch (Exception e) { ! // ok, ignore ! } ! } ! 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; } try { ! if(target != null){ ! target.terminate(); ! } } catch (DebugException e) { throw new RuntimeException(e); } ! target = null; ! } } Index: GetVariableCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/GetVariableCommand.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GetVariableCommand.java 20 Jan 2006 13:24:42 -0000 1.4 --- GetVariableCommand.java 27 Sep 2008 19:59:06 -0000 1.5 *************** *** 18,68 **** public class GetVariableCommand extends AbstractDebuggerCommand { ! String locator; ! boolean isError = false; ! int responseCode; ! String payload; ! public GetVariableCommand(AbstractRemoteDebugger debugger, String locator) { ! super(debugger); ! this.locator = locator; ! } ! public String getOutgoing() { ! return makeCommand(getCommandId(), sequence, locator); ! } ! public boolean needResponse() { ! return true; ! } ! public void processOKResponse(int cmdCode, String payload) { ! responseCode = cmdCode; ! if (cmdCode == getCommandId()) ! this.payload = payload; ! else { ! isError = true; ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected response to "+this.getClass(), null); ! } ! } ! protected int getCommandId() { ! return CMD_GET_VARIABLE; ! } ! ! public void processErrorResponse(int cmdCode, String payload) { ! responseCode = cmdCode; ! this.payload = payload; ! isError = true; ! } ! ! public String getResponse() throws CoreException { ! if (isError) ! throw new CoreException( ! PydevDebugPlugin.makeStatus(IStatus.ERROR, ! "pydevd error:" + payload , ! null)); ! else ! return payload; ! } } --- 18,68 ---- public class GetVariableCommand extends AbstractDebuggerCommand { ! String locator; ! boolean isError = false; ! int responseCode; ! String payload; ! public GetVariableCommand(AbstractRemoteDebugger debugger, String locator) { ! super(debugger); ! this.locator = locator; ! } ! public String getOutgoing() { ! return makeCommand(getCommandId(), sequence, locator); ! } ! public boolean needResponse() { ! return true; ! } ! public void processOKResponse(int cmdCode, String payload) { ! responseCode = cmdCode; ! if (cmdCode == getCommandId()) ! this.payload = payload; ! else { ! isError = true; ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected response to "+this.getClass(), null); ! } ! } ! protected int getCommandId() { ! return CMD_GET_VARIABLE; ! } ! ! public void processErrorResponse(int cmdCode, String payload) { ! responseCode = cmdCode; ! this.payload = payload; ! isError = true; ! } ! ! public String getResponse() throws CoreException { ! if (isError) ! throw new CoreException( ! PydevDebugPlugin.makeStatus(IStatus.ERROR, ! "pydevd error:" + payload , ! null)); ! else ! return payload; ! } } Index: DebuggerReader.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/DebuggerReader.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DebuggerReader.java 17 Apr 2006 02:06:17 -0000 1.6 --- DebuggerReader.java 27 Sep 2008 19:59:06 -0000 1.7 *************** *** 7,10 **** --- 7,11 ---- import java.net.Socket; import java.net.URLDecoder; + import java.util.Dictionary; import java.util.Hashtable; *************** *** 18,24 **** */ public class DebuggerReader implements Runnable { ! /** * can be specified to debug this class ! */ private static final boolean DEBUG = false; --- 19,25 ---- */ public class DebuggerReader implements Runnable { ! /** * can be specified to debug this class ! */ private static final boolean DEBUG = false; *************** *** 29,51 **** /** ! * means that we are done */ ! private boolean done = false; /** * commands waiting for response. Their keys are the sequence ids */ ! private Hashtable responseQueue = new Hashtable(); /** * we read from this */ ! private BufferedReader in; /** * that's the debugger that made us... we have to finish it when we are done */ ! private AbstractRemoteDebugger remote; ! /** * Create it --- 30,57 ---- /** ! * Volatile, as multiple threads may ask it to be 'done' */ ! private volatile boolean done = false; ! ! /** ! * Lock object for sleeping. ! */ ! private Object lock = new Object(); /** * commands waiting for response. Their keys are the sequence ids */ ! private Dictionary<Integer, AbstractDebuggerCommand> responseQueue = new Hashtable<Integer, AbstractDebuggerCommand>(); /** * we read from this */ ! private BufferedReader in; /** * that's the debugger that made us... we have to finish it when we are done */ ! private AbstractRemoteDebugger remote; ! /** * Create it *************** *** 56,87 **** * @throws IOException */ ! public DebuggerReader(Socket s, AbstractRemoteDebugger r ) throws IOException { ! remote = r; ! socket = s; ! InputStream sin = socket.getInputStream(); ! in = new BufferedReader(new InputStreamReader(sin)); ! } ! /** * mark things as done */ ! public void done() { ! this.done = true; ! } /** * @param cmd */ ! public void addToResponseQueue(AbstractDebuggerCommand cmd) { ! int sequence = cmd.getSequence(); ! responseQueue.put(new Integer(sequence), cmd); ! } ! ! /** ! * Parses & dispatches the command ! */ ! private void processCommand(String cmdLine) { ! try { ! String[] cmdParsed = cmdLine.split("\t", 3); int cmdCode = Integer.parseInt(cmdParsed[0]); int seqCode = Integer.parseInt(cmdParsed[1]); --- 62,95 ---- * @throws IOException */ ! public DebuggerReader(Socket s, AbstractRemoteDebugger r ) throws IOException { ! remote = r; ! socket = s; ! InputStream sin = socket.getInputStream(); ! in = new BufferedReader(new InputStreamReader(sin)); ! } ! /** * mark things as done */ ! public void done() { ! this.done = true; ! } /** * @param cmd */ ! public void addToResponseQueue(AbstractDebuggerCommand cmd) { ! int sequence = cmd.getSequence(); ! synchronized (responseQueue) { ! responseQueue.put(new Integer(sequence), cmd); ! } ! } ! ! /** ! * Parses & dispatches the command ! */ ! private void processCommand(String cmdLine) { ! try { ! String[] cmdParsed = cmdLine.split("\t", 3); int cmdCode = Integer.parseInt(cmdParsed[0]); int seqCode = Integer.parseInt(cmdParsed[1]); *************** *** 90,94 **** // is there a response waiting ! AbstractDebuggerCommand cmd = (AbstractDebuggerCommand) responseQueue.remove(new Integer(seqCode)); if (cmd == null){ --- 98,105 ---- // is there a response waiting ! AbstractDebuggerCommand cmd; ! synchronized (responseQueue) { ! cmd = (AbstractDebuggerCommand) responseQueue.remove(new Integer(seqCode)); ! } if (cmd == null){ *************** *** 102,109 **** } } catch (Exception e) { ! PydevPlugin.log(e); throw new RuntimeException(e); } ! } /** --- 113,120 ---- } } catch (Exception e) { ! PydevPlugin.log(e); throw new RuntimeException(e); } ! } /** *************** *** 112,127 **** * * @see java.lang.Runnable#run() ! */ ! public void run() { ! while (!done) { ! try { ! String cmdLine = in.readLine(); ! if(cmdLine != null){ ! processCommand(cmdLine); ! } ! synchronized (this) { ! Thread.sleep(50); ! } ! } catch (Exception e1) { done = true; //that's ok, it means that the client finished --- 123,138 ---- * * @see java.lang.Runnable#run() ! */ ! public void run() { ! while (!done) { ! try { ! String cmdLine = in.readLine(); ! if(cmdLine != null){ ! processCommand(cmdLine); ! } ! synchronized(lock) { ! Thread.sleep(50); ! } ! } catch (Exception e1) { done = true; //that's ok, it means that the client finished *************** *** 129,144 **** e1.printStackTrace(); } ! } ! if ((socket == null) || !socket.isConnected() ) { ! AbstractDebugTarget target = remote.getTarget(); if ( target != null) { ! target.debuggerDisconnected(); ! } ! done = true; ! } ! } remote.dispose(); ! } } --- 140,155 ---- e1.printStackTrace(); } ! } ! if ((socket == null) || !socket.isConnected() ) { ! AbstractDebugTarget target = remote.getTarget(); if ( target != null) { ! target.debuggerDisconnected(); ! } ! done = true; ! } ! } remote.dispose(); ! } } Index: ThreadKillCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ThreadKillCommand.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ThreadKillCommand.java 7 May 2004 02:03:08 -0000 1.2 --- ThreadKillCommand.java 27 Sep 2008 19:59:06 -0000 1.3 *************** *** 12,25 **** 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(CMD_THREAD_KILL, sequence, thread_id); ! } } --- 12,25 ---- 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(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.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ThreadListCommand.java 24 Jun 2006 01:45:53 -0000 1.6 --- ThreadListCommand.java 27 Sep 2008 19:59:06 -0000 1.7 *************** *** 21,77 **** public class ThreadListCommand extends AbstractDebuggerCommand { ! boolean done; ! AbstractDebugTarget target; ! PyThread[] threads; ! ! public ThreadListCommand(AbstractRemoteDebugger debugger, AbstractDebugTarget target) { ! super(debugger); ! this.target = target; ! done = false; ! } ! public void waitUntilDone(int timeout) throws InterruptedException { ! while (!done && timeout > 0) { ! timeout -= 100; ! synchronized (this) { ! Thread.sleep(100); ! } ! } ! if (timeout < 0) ! throw new InterruptedException(); ! } ! ! public PyThread[] getThreads() { ! return threads; ! } ! ! public String getOutgoing() { ! return makeCommand(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); ! } } --- 21,77 ---- public class ThreadListCommand extends AbstractDebuggerCommand { ! boolean done; ! AbstractDebugTarget target; ! PyThread[] threads; ! ! public ThreadListCommand(AbstractRemoteDebugger debugger, AbstractDebugTarget target) { ! super(debugger); ! this.target = target; ! done = false; ! } ! public void waitUntilDone(int timeout) throws InterruptedException { ! while (!done && timeout > 0) { ! timeout -= 100; ! synchronized (this) { ! Thread.sleep(100); ! } ! } ! if (timeout < 0) ! throw new InterruptedException(); ! } ! ! public PyThread[] getThreads() { ! return threads; ! } ! ! public String getOutgoing() { ! return makeCommand(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); ! } } Index: ThreadSuspendCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ThreadSuspendCommand.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ThreadSuspendCommand.java 15 Sep 2005 16:11:06 -0000 1.3 --- ThreadSuspendCommand.java 27 Sep 2008 19:59:06 -0000 1.4 *************** *** 13,25 **** public class ThreadSuspendCommand extends AbstractDebuggerCommand { ! String thread; ! ! public ThreadSuspendCommand(AbstractRemoteDebugger debugger, String thread) { ! super(debugger); ! this.thread = thread; ! } ! public String getOutgoing() { ! return makeCommand(CMD_THREAD_SUSPEND, sequence, thread); ! } } --- 13,25 ---- public class ThreadSuspendCommand extends AbstractDebuggerCommand { ! String thread; ! ! public ThreadSuspendCommand(AbstractRemoteDebugger debugger, String thread) { ! super(debugger); ! this.thread = thread; ! } ! public String getOutgoing() { ! return makeCommand(CMD_THREAD_SUSPEND, sequence, thread); ! } } Index: RunCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/RunCommand.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunCommand.java 15 Sep 2005 16:11:45 -0000 1.2 --- RunCommand.java 27 Sep 2008 19:59:06 -0000 1.3 *************** *** 11,20 **** public class RunCommand extends AbstractDebuggerCommand { ! public RunCommand(AbstractRemoteDebugger debugger) { ! super(debugger); ! } ! public String getOutgoing() { ! return makeCommand(CMD_RUN, sequence, ""); ! } } --- 11,20 ---- public class RunCommand extends AbstractDebuggerCommand { ! public RunCommand(AbstractRemoteDebugger debugger) { ! super(debugger); ! } ! public String getOutgoing() { ! return makeCommand(CMD_RUN, sequence, ""); ! } } Index: ICommandResponseListener.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ICommandResponseListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ICommandResponseListener.java 5 May 2004 02:02:01 -0000 1.1 --- ICommandResponseListener.java 27 Sep 2008 19:59:06 -0000 1.2 *************** *** 12,15 **** */ public interface ICommandResponseListener { ! public void commandComplete(AbstractDebuggerCommand cmd); } --- 12,15 ---- */ public interface ICommandResponseListener { ! public void commandComplete(AbstractDebuggerCommand cmd); } Index: StepCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/StepCommand.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StepCommand.java 15 Sep 2005 16:11:23 -0000 1.3 --- StepCommand.java 27 Sep 2008 19:59:06 -0000 1.4 *************** *** 11,30 **** 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(AbstractRemoteDebugger debugger, int command_id, String thread_id) { ! super(debugger); ! this.command_id = command_id; ! this.thread_id = thread_id; ! } ! public String getOutgoing() { ! return makeCommand(command_id, sequence, thread_id); ! } } --- 11,30 ---- 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(AbstractRemoteDebugger debugger, int command_id, String thread_id) { ! super(debugger); ! this.command_id = command_id; ! this.thread_id = thread_id; ! } ! public String getOutgoing() { ! return makeCommand(command_id, sequence, thread_id); ! } } Index: AbstractRemoteDebugger.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/AbstractRemoteDebugger.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractRemoteDebugger.java 20 May 2006 14:09:54 -0000 1.4 --- AbstractRemoteDebugger.java 27 Sep 2008 19:59:06 -0000 1.5 *************** *** 12,38 **** * connection socket */ ! protected Socket socket; /** * reading thread */ ! protected DebuggerReader reader; /** * writing thread */ ! protected DebuggerWriter writer; /** * sequence seed for command numbers */ ! protected int sequence = -1; - protected AbstractDebugTarget target = null; - /** * debugger should finish when this is called */ ! public abstract void dispose(); /** --- 12,38 ---- * connection socket */ ! protected Socket socket; /** * reading thread */ ! protected DebuggerReader reader; /** * writing thread */ ! protected DebuggerWriter writer; /** * sequence seed for command numbers */ ! protected int sequence = -1; ! ! protected AbstractDebugTarget target = null; /** * debugger should finish when this is called */ ! public abstract void dispose(); /** *************** *** 41,81 **** * @throws DebugException */ ! public abstract void disconnect() throws DebugException; ! public AbstractDebugTarget getTarget() { ! return target; ! } ! public void setTarget(AbstractDebugTarget target) { ! this.target = target; ! } ! ! /** ! * @return next available debugger command sequence number ! */ ! public int getNextSequence() { ! sequence += 2; ! return sequence; ! } ! ! public void addToResponseQueue(AbstractDebuggerCommand cmd) { ! reader.addToResponseQueue(cmd); ! } ! ! public void postCommand(AbstractDebuggerCommand cmd) { ! if( writer!=null ) { ! writer.postCommand(cmd); ! } ! } ! ! public void startTransmission() throws IOException { ! //socket = connector.getSocket(); ! this.reader = new DebuggerReader( socket, this ); ! this.writer = new DebuggerWriter(socket); ! Thread t = new Thread(reader, "pydevd.reader"); ! t.start(); ! t = new Thread(writer, "pydevd.writer"); ! t.start(); ! } ! } --- 41,81 ---- * @throws DebugException */ ! public abstract void disconnect() throws DebugException; ! public AbstractDebugTarget getTarget() { ! return target; ! } ! public void setTarget(AbstractDebugTarget target) { ! this.target = target; ! } ! ! /** ! * @return next available debugger command sequence number ! */ ! public int getNextSequence() { ! sequence += 2; ! return sequence; ! } ! ! public void addToResponseQueue(AbstractDebuggerCommand cmd) { ! reader.addToResponseQueue(cmd); ! } ! ! public void postCommand(AbstractDebuggerCommand cmd) { ! if( writer!=null ) { ! writer.postCommand(cmd); ! } ! } ! ! public void startTransmission() throws IOException { ! //socket = connector.getSocket(); ! this.reader = new DebuggerReader( socket, this ); ! this.writer = new DebuggerWriter(socket); ! Thread t = new Thread(reader, "pydevd.reader"); ! t.start(); ! t = new Thread(writer, "pydevd.writer"); ! t.start(); ! } ! } Index: AbstractListenConnector.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/AbstractListenConnector.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AbstractListenConnector.java 17 Apr 2006 02:06:17 -0000 1.3 --- AbstractListenConnector.java 27 Sep 2008 19:59:06 -0000 1.4 *************** *** 7,14 **** protected int port; ! protected int timeout; ! protected ServerSocket serverSocket; ! protected Socket socket; // what got accepted ! protected Exception e; ! } --- 7,14 ---- protected int port; ! protected int timeout; ! protected ServerSocket serverSocket; ! protected Socket socket; // what got accepted ! protected Exception e; ! } Index: VersionCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/VersionCommand.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VersionCommand.java 15 Sep 2005 16:09:32 -0000 1.3 --- VersionCommand.java 27 Sep 2008 19:59:06 -0000 1.4 *************** *** 13,37 **** public class VersionCommand extends AbstractDebuggerCommand { ! static final String VERSION = "1.0"; ! ! /** ! * @param debugger ! */ ! public VersionCommand(AbstractRemoteDebugger debugger) { ! super(debugger); ! } ! public String getOutgoing() { ! return makeCommand(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 ! } } --- 13,37 ---- public class VersionCommand extends AbstractDebuggerCommand { ! static final String VERSION = "1.0"; ! ! /** ! * @param debugger ! */ ! public VersionCommand(AbstractRemoteDebugger debugger) { ! super(debugger); ! } ! public String getOutgoing() { ! return makeCommand(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 ! } } Index: ThreadRunCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ThreadRunCommand.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ThreadRunCommand.java 15 Sep 2005 16:11:06 -0000 1.3 --- ThreadRunCommand.java 27 Sep 2008 19:59:06 -0000 1.4 *************** *** 11,23 **** public class ThreadRunCommand extends AbstractDebuggerCommand { ! String thread; ! ! public ThreadRunCommand(AbstractRemoteDebugger debugger, String thread) { ! super(debugger); ! this.thread = thread; ! } ! public String getOutgoing() { ! return makeCommand(CMD_THREAD_RUN, sequence, thread); ! } } --- 11,23 ---- public class ThreadRunCommand extends AbstractDebuggerCommand { ! String thread; ! ! public ThreadRunCommand(AbstractRemoteDebugger debugger, String thread) { ! super(debugger); ! this.thread = thread; ! } ! public String getOutgoing() { ! return makeCommand(CMD_THREAD_RUN, sequence, thread); ! } } Index: GetFrameCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/GetFrameCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GetFrameCommand.java 20 Jan 2006 13:24:42 -0000 1.1 --- GetFrameCommand.java 27 Sep 2008 19:59:06 -0000 1.2 *************** *** 3,14 **** public class GetFrameCommand extends GetVariableCommand{ ! public GetFrameCommand(AbstractRemoteDebugger debugger, String locator) { ! super(debugger, locator); ! } ! ! @Override ! protected int getCommandId() { ! return CMD_GET_FRAME; ! } --- 3,14 ---- public class GetFrameCommand extends GetVariableCommand{ ! public GetFrameCommand(AbstractRemoteDebugger debugger, String locator) { ! super(debugger, locator); ! } ! ! @Override ! protected int getCommandId() { ! return CMD_GET_FRAME; ! } Index: DebuggerWriter.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/DebuggerWriter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DebuggerWriter.java 7 Feb 2007 00:46:14 -0000 1.5 --- DebuggerWriter.java 27 Sep 2008 19:59:06 -0000 1.6 *************** *** 5,8 **** --- 5,9 ---- import java.net.Socket; import java.util.ArrayList; + import java.util.List; /** *************** *** 20,29 **** * a list of RemoteDebuggerCommands */ ! private ArrayList cmdQueue = new ArrayList(); private OutputStreamWriter out; ! private boolean done = false; public DebuggerWriter(Socket s) throws IOException { socket = s; --- 21,39 ---- * a list of RemoteDebuggerCommands */ ! private List<AbstractDebuggerCommand> cmdQueue = new ArrayList<AbstractDebuggerCommand>(); private OutputStreamWriter out; ! /** ! * Volatile, as multiple threads may ask it to be 'done' ! */ ! private volatile boolean done = false; + /** + * Lock object for sleeping. + */ + private Object lock = new Object(); + + public DebuggerWriter(Socket s) throws IOException { socket = s; *************** *** 51,56 **** AbstractDebuggerCommand cmd = null; synchronized (cmdQueue) { ! if (cmdQueue.size() > 0) cmd = (AbstractDebuggerCommand) cmdQueue.remove(0); } try { --- 61,67 ---- AbstractDebuggerCommand cmd = null; synchronized (cmdQueue) { ! if (cmdQueue.size() > 0){ cmd = (AbstractDebuggerCommand) cmdQueue.remove(0); + } } try { *************** *** 61,65 **** out.flush(); } ! synchronized (this) { Thread.sleep(100); } --- 72,76 ---- out.flush(); } ! synchronized (lock) { Thread.sleep(100); } Index: RemoveBreakpointCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/RemoveBreakpointCommand.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RemoveBreakpointCommand.java 15 Sep 2005 16:12:05 -0000 1.2 --- RemoveBreakpointCommand.java 27 Sep 2008 19:59:06 -0000 1.3 *************** *** 11,25 **** public class RemoveBreakpointCommand extends AbstractDebuggerCommand { ! public String file; ! public Object line; ! ! public RemoveBreakpointCommand(AbstractRemoteDebugger 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()); ! } } --- 11,25 ---- public class RemoveBreakpointCommand extends AbstractDebuggerCommand { ! public String file; ! public Object line; ! ! public RemoveBreakpointCommand(AbstractRemoteDebugger 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.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** AbstractDebuggerCommand.java 7 Feb 2007 00:46:14 -0000 1.9 --- AbstractDebuggerCommand.java 27 Sep 2008 19:59:06 -0000 1.10 *************** *** 17,142 **** * 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_RUN = 101; ! 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_SET_BREAK = 111; ! static public final int CMD_REMOVE_BREAK = 112; ! static public final int CMD_EVALUATE_EXPRESSION = 113; ! static public final int CMD_GET_FRAME = 114; ! static public final int CMD_EXEC_EXPRESSION = 115; ! static public final int CMD_WRITE_TO_CONSOLE = 116; ! static public final int CMD_CHANGE_VARIABLE = 117; ! static public final int CMD_ERROR = 901; ! static public final int CMD_VERSION = 501; ! static public final int CMD_RETURN = 502; ! ! protected AbstractRemoteDebugger debugger; ! protected ICommandResponseListener responseListener; ! int sequence; ! ! public AbstractDebuggerCommand(AbstractRemoteDebugger 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? * * This is meant to be overriden by subclasses if they need 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(int 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(); ! } } --- 17,142 ---- * 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_RUN = 101; ! 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_SET_BREAK = 111; ! static public final int CMD_REMOVE_BREAK = 112; ! static public final int CMD_EVALUATE_EXPRESSION = 113; ! static public final int CMD_GET_FRAME = 114; ! static public final int CMD_EXEC_EXPRESSION = 115; ! static public final int CMD_WRITE_TO_CONSOLE = 116; ! static public final int CMD_CHANGE_VARIABLE = 117; ! static public final int CMD_ERROR = 901; ! static public final int CMD_VERSION = 501; ! static public final int CMD_RETURN = 502; ! ! protected AbstractRemoteDebugger debugger; ! protected ICommandResponseListener responseListener; ! int sequence; ! ! public AbstractDebuggerCommand(AbstractRemoteDebugger 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? * * This is meant to be overriden by subclasses if they need 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(int 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(); ! } } Index: EvaluateExpressionCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/EvaluateExpressionCommand.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EvaluateExpressionCommand.java 9 Feb 2006 18:52:29 -0000 1.4 --- EvaluateExpressionCommand.java 27 Sep 2008 19:59:06 -0000 1.5 *************** *** 18,74 **** public class EvaluateExpressionCommand extends AbstractDebuggerCommand { ! String locator; ! String expression; ! ! boolean isError = false; ! int responseCode; ! String payload; ! private boolean doExec; ! ! public EvaluateExpressionCommand(AbstractRemoteDebugger debugger, String expression, String locator, boolean doExec) { ! super(debugger); ! this.doExec = doExec; ! this.locator = locator; ! this.expression = expression.replaceAll("\r","").replaceAll("\n",""); ! } ! public String getOutgoing() { ! int cmd = CMD_EVALUATE_EXPRESSION; ! if(doExec){ ! cmd = CMD_EXEC_EXPRESSION; ! } ! return makeCommand(cmd, sequence, locator + "\t" + expression); ! } ! public boolean needResponse() { ! return true; ! } ! public void processOKResponse(int cmdCode, String payload) { ! responseCode = cmdCode; ! if (cmdCode == CMD_EVALUATE_EXPRESSION || cmdCode == CMD_EXEC_EXPRESSION) ! this.payload = payload; ! else { ! isError = true; ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected response to EvaluateExpressionCommand", 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( ! PydevDebugPlugin.makeStatus(IStatus.ERROR, ! "pydevd error:" + payload , ! null)); ! else ! return payload; ! } } --- 18,74 ---- public class EvaluateExpressionCommand extends AbstractDebuggerCommand { ! String locator; ! String expression; ! ! boolean isError = false; ! int responseCode; ! String payload; ! private boolean doExec; ! ! public EvaluateExpressionCommand(AbstractRemoteDebugger debugger, String expression, String locator, boolean doExec) { ! super(debugger); ! this.doExec = doExec; ! this.locator = locator; ! this.expression = expression.replaceAll("\r","").replaceAll("\n",""); ! } ! public String getOutgoing() { ! int cmd = CMD_EVALUATE_EXPRESSION; ! if(doExec){ ! cmd = CMD_EXEC_EXPRESSION; ! } ! return makeCommand(cmd, sequence, locator + "\t" + expression); ! } ! public boolean needResponse() { ! return true; ! } ! public void processOKResponse(int cmdCode, String payload) { ! responseCode = cmdCode; ! if (cmdCode == CMD_EVALUATE_EXPRESSION || cmdCode == CMD_EXEC_EXPRESSION) ! this.payload = payload; ! else { ! isError = true; ! PydevDebugPlugin.log(IStatus.ERROR, "Unexpected response to EvaluateExpressionCommand", 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( ! PydevDebugPlugin.makeStatus(IStatus.ERROR, ! "pydevd error:" + payload , ! null)); ! else ! return payload; ! } } Index: SetBreakpointCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/SetBreakpointCommand.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SetBreakpointCommand.java 11 May 2007 01:57:54 -0000 1.4 --- SetBreakpointCommand.java 27 Sep 2008 19:59:06 -0000 1.5 *************** *** 13,34 **** public class SetBreakpointCommand extends AbstractDebuggerCommand { ! public String file; ! public Object line; ! public String condition; private String functionName; ! public SetBreakpointCommand(AbstractRemoteDebugger debugger, String file, Object line, String condition, String functionName) { ! super(debugger); ! this.file = file; ! this.line = line; ! if (condition == null){ ! this.condition = "None"; }else{ ! this.condition = condition; } this.functionName = functionName; ! } ! public String getOutgoing() { StringBuffer cmd = new StringBuffer(). append(file).append("\t").append(line); --- 13,34 ---- public class SetBreakpointCommand extends AbstractDebuggerCommand { ! public String file; ! public Object line; ! public String condition; private String functionName; ! public SetBreakpointCommand(AbstractRemoteDebugger debugger, String file, Object line, String condition, String functionName) { ! super(debugger); ! this.file = file; ! this.line = line; ! if (condition == null){ ! this.condition = "None"; }else{ ! this.condition = condition; } this.functionName = functionName; ! } ! public String getOutgoing() { StringBuffer cmd = new StringBuffer(). append(file).append("\t").append(line); Index: ListenConnector.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ListenConnector.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ListenConnector.java 17 Apr 2006 02:06:17 -0000 1.3 --- ListenConnector.java 27 Sep 2008 19:59:06 -0000 1.4 *************** *** 9,46 **** public class ListenConnector extends AbstractListenConnector { ! 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; ! } ! } } --- 9,46 ---- public class ListenConnector extends AbstractListenConnector { ! 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; ! } ! } } Index: ChangeVariableCommand.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/remote/ChangeVariableCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ChangeVariableCommand.java 7 Feb 2007 00:46:14 -0000 1.1 --- ChangeVariableCommand.java 27 Sep 2008 19:59:06 -0000 1.2 *************** *** 14,41 **** public class ChangeVariableCommand extends AbstractDebuggerCommand { ! String locator; ! boolean isError = false; ! int responseCode; ! String payload; String expression; ! public ChangeVariableCommand(AbstractRemoteDebugger debugger, String locator, String expression) { ! super(debugger); ! this.locator = locator; this.expression = expression; ! } ! public String getOutgoing() { ! return makeCommand(getCommandId(), sequence, locator+"\t"+expression); ! } ! public boolean needResponse() { ! return false; ! } ! protected int getCommandId() { ! return CMD_CHANGE_VARIABLE; ! } ! } --- 14,41 ---- public class ChangeVariableCommand extends AbstractDebuggerCommand { ! String locator; ! boolean isError = false; ! int responseCode; ! String payload; String expression; ! public ChangeVariableCommand(AbstractRemoteDebugger debugger, String locator, String expression) { ! super(debugger); ! this.locator = locator; this.expression = expression; ! } ! public String getOutgoing() { ! return makeCommand(getCommandId(), sequence, locator+"\t"+expression); ! } ! public boolean needResponse() { ! return false; ! } ! protected int getCommandId() { ! return CMD_CHANGE_VARIABLE; ! } ! } |