aboutsummaryrefslogtreecommitdiff
path: root/Host/nxt-gdb-server.py
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-04-01 10:38:00 +0800
committerTat-Chee Wan (USM)2011-04-01 10:38:00 +0800
commit70c877428aa27b2403a2f0046d8f6895d7d05d2d (patch)
tree5bfa6160faa16400e09868abed465c560e071e5a /Host/nxt-gdb-server.py
parent7a8bb3a1166faf96af20fae8a6cbf50593a4c272 (diff)
update server to send ctrl-c message
Diffstat (limited to 'Host/nxt-gdb-server.py')
-rwxr-xr-xHost/nxt-gdb-server.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/Host/nxt-gdb-server.py b/Host/nxt-gdb-server.py
index d3485d3..47a552d 100755
--- a/Host/nxt-gdb-server.py
+++ b/Host/nxt-gdb-server.py
@@ -22,7 +22,7 @@ import select
import usb
import struct
-CTRLC = 0x03
+CTRLC = chr(3)
STATUS_QUERY = "$?#3F"
DEFAULT_PORT = 2828
SELECT_TIMEOUT = 0.1
@@ -72,6 +72,14 @@ class NXTGDBServer:
"""Split datas in GDB commands and make segments with each command."""
segs = [ ]
self.in_buf += data
+ # Find Ctrl-C (assumed to be by itself and not following a normal command)
+ end = self.in_buf.find (CTRLC)
+ if end >= 0:
+ msg, self.in_buf = self.in_buf[0:end+1], self.in_buf[end+1:]
+ assert len (msg) <= self.pack_size, "Ctrl-C Command Packet too long!"
+ segs.append (self.pack (msg, 0))
+ end = self.in_buf.find (CTRLC)
+
end = self.in_buf.find ('#')
# Is # found and enough place for the checkum?
while end >= 0 and end < len (self.in_buf) - 2:
@@ -144,9 +152,9 @@ class NXTGDBServer:
data = client.recv (self.recv_size)
data = data.strip()
if len (data) > 0:
- if len (data) == 0 and data[0] == CTRLC:
- print "CTRL-C Received!"
- data = STATUS_QUERY
+ #if len (data) == 1 and data.find(CTRLC) >= 0:
+ # print "CTRL-C Received!"
+ # data = STATUS_QUERY
if DEBUG:
print "[GDB->NXT] %s" % data
segments = self.segment (data)