Saturday, June 03, 2006

Day 8

I just posted a link to the pyxides group regarding the status of my project. In the post I asked two questions to the pyxides community..

1. Whether they thought that subclassing two classes, one the specified the interface of a MPdb target and one that specified the protocol used for communication, was a good design. In this design the target abstract class, which we'll call MTargetInterface looks something like that

class MTargetInterface(object):
def accept(self, client):
""" Accept a connection from a debugging console. """
raise NotImplementedError, "Override this method in a subclass"

def disconnect(self):
""" Close a connection to a debugging console. """
raise NotImplementedError

def listen(self):
""" Listen for incoming connections from debugging consoles. """
raise NotImplementedError


And this is what I meant about the 'interface' for a target. This is just an abstract class that provides an interface that a subclass must implement. How these classes are implemented for different protocols is of no concern to the debugger core. So, an implementation of a target may be something along the lines of


from SocketServer import TCPServer

class MTCPTarget(MTargetInterface, TCPServer):
""" Allow incoming connections from debugging consoles using the TCP protocol. """
def __init__(self, addr):
MTargetInterface.__init__(self)
TCPServer.__init__(self, addr, TCPRequestHandler)

def accept(self, client):
""" Accept incoming connections from a debugging console. """
# This is just a TCPServer method, although the method signature is wrong I think
self.handle_request(client)

def listen(self):
""" Listen for incoming connections """
# This would probably be handled by TCPServer anyway

def disconnect(self):
""" Close all connections. """
# Here we would close all connections


I've left out the real _meat_ of this class because the other stuff would just be getting TCPServer to properly.


2. What techniques are currently being used to keep the source file that is local to a GUI front-end for a debugger and the source code the debugger is working on. Front-ends usually keep a 'local' copy of the source code so that they can perform their own parsing and whatnot, and I was curious to find out from the community how exactly they do this.

Well that's all for this time, be sure to check the pyxides group for more information and replies form people.

Comments:
Hello Matt,

RPDB2, for example, fetches the code from the debugged script, so you are always seeing the correct version of the source and in the case of remote debugging, the source files don't even need to exist on the machine where the debugger is.

However, in the general case, when debugging from an IDE that has some local copy of the code, version conflicts may indeed exist, and these conflicts need to be communicated to the IDE, so it can in its turn alert the user, etc...

Nir Aides
 
Post a Comment

Subscribe to Post Comments [Atom]





<< Home

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

Subscribe to Posts [Atom]