[Python-checkins] r50587 - sandbox/trunk/pdb/README.txt sandbox/trunk/pdb/mconnection.py sandbox/trunk/pdb/mpdb.py

matt.fleming python-checkins at python.org
Tue Jul 11 21:28:21 CEST 2006


Author: matt.fleming
Date: Tue Jul 11 21:28:21 2006
New Revision: 50587

Modified:
   sandbox/trunk/pdb/README.txt
   sandbox/trunk/pdb/mconnection.py
   sandbox/trunk/pdb/mpdb.py
Log:
Target can now be 'remote-client' or 'remote-pdbserver' to indicate which end we're at. 


Modified: sandbox/trunk/pdb/README.txt
==============================================================================
--- sandbox/trunk/pdb/README.txt	(original)
+++ sandbox/trunk/pdb/README.txt	Tue Jul 11 21:28:21 2006
@@ -15,7 +15,6 @@
 * info [target/threads]
   set debug threads [on|off]
   show debug threads, command needs to be written.
-* Decide on a way to execute commands for a specific thread.
 * Implement thread debugging, commands to switch between threads.
 	- Because the 'main' thread may exit unexpectedly we need to keep
 	any other threads that we're debugging alive. This may mean that
@@ -42,20 +41,23 @@
 		   - Debugging outside a process
 		   - Debugging remotely
 		   - Debugging threads
-* Provide a command to distinguish between 'server' and 'client', because
-  at the moment 'info target' only tells the user whether they are local
-  or remote, and not whether they are the local/remote server or 
-  local/remote client.
 * We can switch between threads (like in gdb) with 'thread <thread id>', but
   this currently has _no_ effect. We should at some point be able to switch
   threads and from them on not have to use the 'thread apply <tid> <cmd>' 
   syntax, but just '<cmd>' which would be applied to the current thread.
-* Run command does not pass arguments across a remote connection, i.e.
-      `run 2' does not pass the argument 2 to the script.
-* Allow thread debugging to be turned on with a command line switch.
 * Allow reading commands from .mpdbrc file 
 * Changed the name of the default history file from ~/.pydbhist to ~/.mpdbhist
 * do_return inherited from pydb.gdb.Gdb doesn't use self.stdin for reading
   input from the user and doesn't work remotely.
 * pdbserver using a TCP connection uses setsockopt() REUSEADDR by default.
   Need some way to make this configurable. `set reuseaddr' ?
+
+-=[FIXED]=-
+* Can restart program remotely with new arguments.
+* Allow thread debugging to be turned on with a command line switch.
+* Decide on a way to execute commands for a specific thread. ('thread' command)
+* Provide a command to distinguish between 'server' and 'client', because
+  at the moment 'info target' only tells the user whether they are local
+  or remote, and not whether they are the local/remote server or 
+  local/remote client - target attr is either 'remote-client' or 
+  'remote-pdbserver'.

Modified: sandbox/trunk/pdb/mconnection.py
==============================================================================
--- sandbox/trunk/pdb/mconnection.py	(original)
+++ sandbox/trunk/pdb/mconnection.py	Tue Jul 11 21:28:21 2006
@@ -70,7 +70,6 @@
         self.output.close()
         self.input.close()
 
-
     def readline(self, bufsize=2048):
         try:
             line = self.input.readline(bufsize)

Modified: sandbox/trunk/pdb/mpdb.py
==============================================================================
--- sandbox/trunk/pdb/mpdb.py	(original)
+++ sandbox/trunk/pdb/mpdb.py	Tue Jul 11 21:28:21 2006
@@ -22,7 +22,7 @@
 import time
 import traceback
 
-__all__ = ["MPdb", "pdbserver", "target"]
+__all__ = ["MPdb", "pdbserver", "target", "thread_debugging"]
 
 line_prefix = '\n-> '
 
@@ -198,7 +198,7 @@
         except ValueError:
             self.errmsg('Invalid arguments')
             return
-        if self.target == 'remote':
+        if 'remote' in self.target:
             self.errmsg('Already connected to a remote machine.')
             return
         if target == 'tcp':
@@ -248,7 +248,7 @@
             line = self.connection.readline()
         self.msg_nocr(line)
         self.onecmd = self.remote_onecmd
-        self.target = 'remote'
+        self.target = 'remote-client'
         return
 
     def do_detach(self, args):
@@ -279,7 +279,7 @@
         except ValueError:
             self.errmsg('Invalid arguments')
             return
-        if self.target == 'remote':
+        if 'remote' in self.target:
             self.errmsg('Already connected remotely')
             return
         if target == 'tcp':
@@ -322,7 +322,7 @@
             self.errmsg("Failed to connect to %s: (%s)" % (comm, err))
             return
         self.pdbserver_addr = comm
-        self.target = 'remote'
+        self.target = 'remote-pdbserver'
         self._rebind_input(self.connection)
         self._rebind_output(self.connection)
         
@@ -359,7 +359,21 @@
         else:
             self.msg("Re exec'ing\n\t%s" % self._sys_argv)
         os.execvp(self._sys_argv[0], self._sys_argv)
-            
+
+    def do_disassemble(self, arg):
+        """disassemble [arg]
+        With no argument disassemble at the current frame location.
+        With a numeric argument, disassemble at the frame location at that
+        line number. With a class, method, function, code or string argument
+        disassemble that."""
+        # XXX Override this method so that we can take control of where
+        # the output is written to. This seems generally 'wrong'. Rocky,
+        # what's your opinion?
+        orig_stdout = sys.stdout
+        sys.stdout = self.stdout
+        pydb.Pdb.do_disassemble(self, arg)
+        sys.stdout = orig_stdout
+
 def pdbserver(addr, m):
     """ This method sets up a pdbserver debugger that allows debuggers
     to connect to 'addr', which a protocol-specific address, i.e.
@@ -373,6 +387,7 @@
         try:
             m._runscript(m.mainpyfile)
         except Restart:
+            sys.argv = list(m._program_sys_argv)
             m.msg('Restarting')
         except Exit:
             break


More information about the Python-checkins mailing list