Monday, June 12, 2006

Checking in..

Well, I haven't posted here for quite a few days. But I've started making some progress with the
code in the tree. There's now a pdbserver command analogous to the gdbserver command in gdb, and a target command to connect to a pdbserver. Here's some docstrings,

target,

""" Connect to a target machine or process.
The first argument is the type or protocol of the target machine
(which can be the name of a class that is avaible either in the current
working directory or in Python's PYTHONPATH environtment variable).
Remaining arguments are interpreted by the target protocol. For more
information on the arguments for a particular protocol, type
`help target ' followed by the protocol name.

List of target subcommands:

target serial -- Use a remote computer via a serial line
target tcp -- Use a remote computer via a socket connection
"""


So, from a MPdb prompt you can do

`target tcp localhost:8000'

which connects to a pdbserver running on port 8000 on localhost.

pdbserver,


""" Allow a debugger to connect to this session.
The first argument is the type or protocol that is used for this connection
(which can be the name of a class that is avaible either in the current
working directory or in Python's PYTHONPATH environtment variable).
The next argument is protocol specific arguments (e.g. hostname and
port number for a TCP connection, or a serial device for a serial line
connection). The next argument is the filename of the script that is
being debugged. The rest of the arguments are passed as arguments to the
script file and are optional. For more information on the arguments for a
particular protocol, type `help pdbserver ' followed by the protocol name.
The syntax for this command is,

`pdbserver ConnectionClass comm scriptfile [args ...]'

"""


And we can do

`pdbserver tcp localhost:8000 broken_script.py'


One thing that you can do with this is instead of naming 'tcp' as the protocol, you can name a class as the protocol, for example, SocketServer.TCPServer (not that this would actually work, but you get the idea). More importantly, there's an abstract interface that connection classes must implement in order to be used by pdbserver. This class is called MServerConnectionInterface so somebody could derive from this class in a class named MyNewConnectionClass and (as long as this class was in the current directory of in PYTHONPATH environment variable) if this class was ina file named connclasses.py a user could do

`pdbserver connclasses.MyNewConnectionClass localhost:8000 broken_script.py'

I've found this pretty useful.

Right, bedtime.

Comments:
Keep up the good work man
 
Keep up the good work man
 
Thanks! I will :) And thanks for your comments
 
Multipost...post...post...(post).....
 
Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]