summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-07-22 10:38:01 +0800
committerTat-Chee Wan (USM)2011-07-22 10:38:01 +0800
commit0df4f4935d61c45789bf2ed744f809c8b71f57a1 (patch)
treedefd328a52a8d8c95884233d5e0102e530f27584
parent3c27ee0902ba21bcb2517f1e09db6f58caafee45 (diff)
provide verbose, nowait options for invoking nxt-gdb-server
Default is non-verbose, wait when invoking nxt-gdb-server. Allow nowait option to enable Eclipse external tool launching
-rwxr-xr-xHost/nxt-gdb-server.py17
-rwxr-xr-xHost/pyenv-nxt-gdb-server2
2 files changed, 14 insertions, 5 deletions
diff --git a/Host/nxt-gdb-server.py b/Host/nxt-gdb-server.py
index a631952..453e62b 100755
--- a/Host/nxt-gdb-server.py
+++ b/Host/nxt-gdb-server.py
@@ -30,7 +30,7 @@ ACKCHAR = '+'
STATUS_QUERY = "$?#3F"
DEFAULT_PORT = 2828
SELECT_TIMEOUT = 0.1
-DEBUG = True
+DEBUG = False
DEBUG2 = False
NXT_RECV_ERR = -1
@@ -48,8 +48,9 @@ class NXTGDBServer:
# Debug command header, no reply.
debug_command = 0x8d
- def __init__ (self, port):
+ def __init__ (self, port, nowait):
"""Initialise server."""
+ self.nowait = nowait
self.port = port
self.in_buf = ''
@@ -160,7 +161,8 @@ class NXTGDBServer:
while True:
# We should open the NXT connection first, otherwise Python startup delay
# may cause GDB to misbehave
- dummy = raw_input('Waiting...Press <ENTER> when NXT GDB Stub is ready. ')
+ if not self.nowait:
+ dummy = raw_input('Waiting...Press <ENTER> when NXT GDB Stub is ready. ')
# Open connection to the NXT brick.
brick = nxt.locator.find_one_brick ()
brick.sock.debug = DEBUG
@@ -226,12 +228,19 @@ if __name__ == '__main__':
""")
parser.add_option ('-p', '--port', type = 'int', default = DEFAULT_PORT,
help = "server listening port (default: %default)", metavar = "PORT")
+ parser.add_option ('-v', '--verbose', action='store_true', dest='verbose', default = False,
+ help = "verbose mode (default: %default)")
+ parser.add_option ('-n', '--nowait', action='store_true', dest='nowait', default = False,
+ help = "Don't wait for NXT GDB Stub Setup before connecting (default: %default)")
(options, args) = parser.parse_args ()
if args:
parser.error ("Too many arguments")
# Run.
try:
- s = NXTGDBServer (options.port)
+ DEBUG = options.verbose
+ if DEBUG:
+ print "Debug Mode Enabled!"
+ s = NXTGDBServer (options.port, options.nowait)
s.run ()
except KeyboardInterrupt:
print "\n\nException caught. Bye!"
diff --git a/Host/pyenv-nxt-gdb-server b/Host/pyenv-nxt-gdb-server
index b98c2d8..875e92e 100755
--- a/Host/pyenv-nxt-gdb-server
+++ b/Host/pyenv-nxt-gdb-server
@@ -1,3 +1,3 @@
#!/bin/sh
export PYTHONPATH=~/svnrepo/nxt-python:~/gitrepo/pyfantom
-arch -i386 /usr/bin/python2.6 ~/gitrepo/armdebug/Host/nxt-gdb-server.py
+arch -i386 /usr/bin/python2.6 ~/gitrepo/armdebug/Host/nxt-gdb-server.py $*