summaryrefslogtreecommitdiff
path: root/Host/nxt-gdb-server.py
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-07-11 07:58:58 +0800
committerTat-Chee Wan (USM)2011-07-11 07:58:58 +0800
commit7d8f3895e29f9659d2974dfa285bb594aeef1fa0 (patch)
tree657a957073688ae266c150f8f1c5aa41f2f7852a /Host/nxt-gdb-server.py
parent4bb47785205304ad894021864d6bb8ea5afe34bb (diff)
handle proper brick socket open and close sequence
Allow for multiple GDB sessions from gdb client by opening the brick socket after client connection, and closing the brick socket after client disconnection.
Diffstat (limited to 'Host/nxt-gdb-server.py')
-rwxr-xr-xHost/nxt-gdb-server.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Host/nxt-gdb-server.py b/Host/nxt-gdb-server.py
index 9ef8ff1..c1cf083 100755
--- a/Host/nxt-gdb-server.py
+++ b/Host/nxt-gdb-server.py
@@ -156,14 +156,17 @@ class NXTGDBServer:
s.setsockopt (socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind (('', self.port))
s.listen (1)
- # Open connection to the NXT brick.
- brick = nxt.locator.find_one_brick (method=nxt.Method(usb=False, bluetooth=False, fantomusb=True, fantombt=False))
- brick.sock.debug = DEBUG
+ ## Open connection to the NXT brick.
+ #brick = nxt.locator.find_one_brick ()
+ #brick.sock.debug = DEBUG
print "Waiting for GDB connection on port %s..." % self.port
while True:
# Wait for a connection.
client, addr = s.accept ()
print "Client from", addr
+ # Open connection to the NXT brick.
+ brick = nxt.locator.find_one_brick ()
+ brick.sock.debug = DEBUG
# Work loop, wait for a message from client socket or NXT brick.
while client is not None:
data = ''
@@ -212,6 +215,7 @@ class NXTGDBServer:
if client:
client.send (data)
data = ''
+ brick.sock.close()
print "Connection closed, waiting for GDB connection on port %s..." % self.port
if __name__ == '__main__':