summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-11-12 11:15:23 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-11-12 11:15:23 +0100
commit04a52040aef69910e9ac2218fea48077e34d4017 (patch)
treed7b623bc23ddc2765812cf406e567b4ee7c3e848
parentAdd tools patches for RTEMS 4.12. (diff)
downloadrtems-tools-04a52040aef69910e9ac2218fea48077e34d4017.tar.bz2
Python 3 compatibility
-rw-r--r--rtemstoolkit/check.py14
-rw-r--r--rtemstoolkit/config.py24
-rw-r--r--rtemstoolkit/error.py8
-rwxr-xr-xrtemstoolkit/execute.py28
-rw-r--r--rtemstoolkit/git.py14
-rwxr-xr-xrtemstoolkit/log.py38
-rw-r--r--rtemstoolkit/macros.py24
-rw-r--r--rtemstoolkit/mailer.py10
-rw-r--r--rtemstoolkit/options.py18
-rw-r--r--rtemstoolkit/path.py44
-rw-r--r--rtemstoolkit/version.py8
-rw-r--r--tester/rt/config.py2
-rw-r--r--tester/rt/console.py10
-rw-r--r--tester/rt/gdb.py40
-rw-r--r--tester/rt/options.py10
-rwxr-xr-xtester/rt/pygdb/mi_parser.py34
-rw-r--r--tester/rt/pygdb/spark.py29
-rw-r--r--tester/rt/stty.py6
-rw-r--r--tester/rt/test.py22
-rw-r--r--tester/rt/version.py8
-rw-r--r--tools/gdb/python/__init__.py2
-rw-r--r--tools/gdb/python/classic.py82
-rw-r--r--tools/gdb/python/heaps.py12
-rw-r--r--tools/gdb/python/helper.py4
-rw-r--r--tools/gdb/python/rtems.py32
-rw-r--r--tools/gdb/python/sparc.py34
-rw-r--r--tools/gdb/python/supercore.py8
-rw-r--r--tools/gdb/python/watchdog.py2
28 files changed, 284 insertions, 283 deletions
diff --git a/rtemstoolkit/check.py b/rtemstoolkit/check.py
index f4c05b8..19d4dfa 100644
--- a/rtemstoolkit/check.py
+++ b/rtemstoolkit/check.py
@@ -155,16 +155,16 @@ def run():
_opts = options.load(args = sys.argv)
log.notice('RTEMS Source Builder - Check, v%s' % (version.str()))
if host_setup(_opts):
- print 'Environment is ok'
+ print('Environment is ok')
else:
- print 'Environment is not correctly set up'
- except error.general, gerr:
- print gerr
+ print('Environment is not correctly set up')
+ except error.general as gerr:
+ print(gerr)
sys.exit(1)
- except error.internal, ierr:
- print ierr
+ except error.internal as ierr:
+ print (ierr)
sys.exit(1)
- except error.exit, eerr:
+ except error.exit:
pass
except KeyboardInterrupt:
log.notice('abort: user terminated')
diff --git a/rtemstoolkit/config.py b/rtemstoolkit/config.py
index 306e3df..70cd05f 100644
--- a/rtemstoolkit/config.py
+++ b/rtemstoolkit/config.py
@@ -48,10 +48,10 @@ try:
import options
import path
except KeyboardInterrupt:
- print 'user terminated'
+ print('user terminated')
sys.exit(1)
except:
- print 'error: unknown application load error'
+ print('error: unknown application load error')
sys.exit(1)
def _check_bool(value):
@@ -137,14 +137,14 @@ class file(object):
outter level. Nested levels will need to split with futher calls.'''
trace_me = False
if trace_me:
- print '------------------------------------------------------'
+ print('------------------------------------------------------')
macros = []
nesting = []
has_braces = False
c = 0
while c < len(s):
if trace_me:
- print 'ms:', c, '"' + s[c:] + '"', has_braces, len(nesting), nesting
+ print('ms:', c, '"' + s[c:] + '"', has_braces, len(nesting), nesting)
#
# We need to watch for shell type variables or the form '${var}' because
# they can upset the brace matching.
@@ -192,9 +192,9 @@ class file(object):
macros.append(s[macro_start:c + 1].strip())
c += 1
if trace_me:
- print 'ms:', macros
+ print('ms:', macros)
if trace_me:
- print '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='
+ print('-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=')
return macros
def _shell(self, line):
@@ -750,7 +750,7 @@ class file(object):
try:
log.trace('config: %s: _open: %s' % (self.init_name, path.host(configname)))
config = open(path.host(configname), 'r')
- except IOError, err:
+ except IOError as err:
raise error.general('error opening config file: %s' % (path.host(configname)))
self.configpath += [configname]
@@ -840,13 +840,13 @@ def run():
log.trace('config: count %d' % (len(opts.config_files())))
for config_file in opts.config_files():
s = file(config_file, opts)
- print s
+ print(s)
del s
- except error.general, gerr:
- print gerr
+ except error.general as gerr:
+ print(gerr)
sys.exit(1)
- except error.internal, ierr:
- print ierr
+ except error.internal as ierr:
+ print(ierr)
sys.exit(1)
except KeyboardInterrupt:
log.notice('abort: user terminated')
diff --git a/rtemstoolkit/error.py b/rtemstoolkit/error.py
index 89ea181..ea6b71d 100644
--- a/rtemstoolkit/error.py
+++ b/rtemstoolkit/error.py
@@ -57,9 +57,9 @@ class exit(error):
if __name__ == '__main__':
try:
raise general('a general error')
- except general, gerr:
- print 'caught:', gerr
+ except general as gerr:
+ print('caught:', gerr)
try:
raise internal('an internal error')
- except internal, ierr:
- print 'caught:', ierr
+ except internal as ierr:
+ print('caught:', ierr)
diff --git a/rtemstoolkit/execute.py b/rtemstoolkit/execute.py
index b1afc7c..3f8e3e6 100755
--- a/rtemstoolkit/execute.py
+++ b/rtemstoolkit/execute.py
@@ -127,7 +127,7 @@ class execute(object):
block and return None or False if this thread is to exit and True if this
is a timeout check."""
if trace_threads:
- print 'executte:_writethread: start'
+ print('executte:_writethread: start')
try:
while True:
lines = input()
@@ -142,14 +142,14 @@ class execute(object):
break
except:
if trace_threads:
- print 'executte:_writethread: exception'
+ print('executte:_writethread: exception')
pass
try:
fh.close()
except:
pass
if trace_threads:
- print 'executte:_writethread: finished'
+ print('executte:_writethread: finished')
def _readthread(exe, fh, out, prefix = ''):
"""Read from a file handle and write to the output handler
@@ -167,7 +167,7 @@ class execute(object):
log.flush()
if trace_threads:
- print 'executte:_readthread: start'
+ print('executte:_readthread: start')
count = 0
line = ''
try:
@@ -187,7 +187,7 @@ class execute(object):
except:
raise
if trace_threads:
- print 'executte:_readthread: exception'
+ print('executte:_readthread: exception')
pass
try:
fh.close()
@@ -196,7 +196,7 @@ class execute(object):
if len(line):
_output_line(line, exe, prefix, out, 100)
if trace_threads:
- print 'executte:_readthread: finished'
+ print('executte:_readthread: finished')
def _timerthread(exe, interval, function):
"""Timer thread is used to timeout a process if no output is
@@ -345,7 +345,7 @@ class execute(object):
exit_code = self._capture(command, proc, timeout)
if self.verbose:
log.output('exit: ' + str(exit_code))
- except OSError, ose:
+ except OSError as ose:
exit_code = ose.errno
if self.verbose:
log.output('exit: ' + str(ose))
@@ -453,7 +453,7 @@ class execute(object):
self.lock.acquire()
try:
if self.proc is not None:
- print "sending sig"
+ print("sending sig")
self.proc.send_signal(signal)
except:
raise
@@ -517,8 +517,8 @@ if __name__ == "__main__":
ec, proc = e.command(commands['pipe'][0], commands['pipe'][1],
capture = False, stdin = subprocess.PIPE)
if ec == 0:
- print 'piping input into ' + commands['pipe'][0] + ': ' + \
- commands['pipe'][2]
+ print('piping input into ' + commands['pipe'][0] + ': ' + \
+ commands['pipe'][2])
proc.stdin.write(commands['pipe'][2])
proc.stdin.close()
e.capture(proc)
@@ -544,10 +544,10 @@ if __name__ == "__main__":
('date %0 %1', ['-u', '+%d %D %S'])]
commands['unix']['pipe'] = ('grep', 'hello', 'hello world')
- print arg_list('cmd a1 a2 "a3 is a string" a4')
- print arg_list('cmd b1 b2 "b3 is a string a4')
- print arg_subst(['nothing', 'xx-%0-yyy', '%1', '%2-something'],
- ['subst0', 'subst1', 'subst2'])
+ print(arg_list('cmd a1 a2 "a3 is a string" a4'))
+ print(arg_list('cmd b1 b2 "b3 is a string a4'))
+ print(arg_subst(['nothing', 'xx-%0-yyy', '%1', '%2-something'],
+ ['subst0', 'subst1', 'subst2']))
e = execute(error_prefix = 'ERR: ', verbose = True)
if sys.platform == "win32":
diff --git a/rtemstoolkit/git.py b/rtemstoolkit/git.py
index 2c23c05..d00007c 100644
--- a/rtemstoolkit/git.py
+++ b/rtemstoolkit/git.py
@@ -192,10 +192,10 @@ if __name__ == '__main__':
import sys
opts = options.load(sys.argv)
g = repo('.', opts)
- print g.git_version()
- print g.valid()
- print g.status()
- print g.clean()
- print g.remotes()
- print g.email()
- print g.head()
+ print(g.git_version())
+ print(g.valid())
+ print(g.status())
+ print(g.clean())
+ print(g.remotes())
+ print(g.email())
+ print(g.head())
diff --git a/rtemstoolkit/log.py b/rtemstoolkit/log.py
index 92d3ed2..1308203 100755
--- a/rtemstoolkit/log.py
+++ b/rtemstoolkit/log.py
@@ -74,7 +74,7 @@ def _output(text = os.linesep, log = None):
else:
lock.acquire()
for l in text.replace(chr(13), '').splitlines():
- print l
+ print(l)
lock.release()
def stderr(text = os.linesep, log = None):
@@ -92,7 +92,7 @@ def notice(text = os.linesep, log = None, stdout_only = False):
(default is not None and not default.has_stdout() or stdout_only):
lock.acquire()
for l in text.replace(chr(13), '').splitlines():
- print l
+ print(l)
lock.release()
if not stdout_only:
_output(text, log)
@@ -127,7 +127,7 @@ class log:
else:
try:
self.fhs.append(file(s, 'w'))
- except IOError, ioe:
+ except IOError as ioe:
raise error.general("creating log file '" + s + \
"': " + str(ioe))
@@ -186,41 +186,41 @@ if __name__ == "__main__":
l.output('log: hello world CRLF\r\n')
l.output('log: hello world NONE')
l.flush()
- print '=-' * 40
- print 'tail: %d' % (len(l.tail))
- print l
- print '=-' * 40
+ print('=-' * 40)
+ print('tail: %d' % (len(l.tail)))
+ print(l)
+ print('=-' * 40)
for i in range(0, 10):
l.output('log: hello world 2: %d\n' % (i))
l.flush()
- print '=-' * 40
- print 'tail: %d' % (len(l.tail))
- print l
- print '=-' * 40
+ print('=-' * 40)
+ print('tail: %d' % (len(l.tail)))
+ print(l)
+ print('=-' * 40)
for i in [0, 1]:
quiet = False
tracing = False
- print '- quiet:%s - trace:%s %s' % (str(quiet), str(tracing), '-' * 30)
+ print('- quiet:%s - trace:%s %s' % (str(quiet), str(tracing), '-' * 30))
trace('trace with quiet and trace off')
notice('notice with quiet and trace off')
quiet = True
tracing = False
- print '- quiet:%s - trace:%s %s' % (str(quiet), str(tracing), '-' * 30)
+ print('- quiet:%s - trace:%s %s' % (str(quiet), str(tracing), '-' * 30))
trace('trace with quiet on and trace off')
notice('notice with quiet on and trace off')
quiet = False
tracing = True
- print '- quiet:%s - trace:%s %s' % (str(quiet), str(tracing), '-' * 30)
+ print('- quiet:%s - trace:%s %s' % (str(quiet), str(tracing), '-' * 30))
trace('trace with quiet off and trace on')
notice('notice with quiet off and trace on')
quiet = True
tracing = True
- print '- quiet:%s - trace:%s %s' % (str(quiet), str(tracing), '-' * 30)
+ print('- quiet:%s - trace:%s %s' % (str(quiet), str(tracing), '-' * 30))
trace('trace with quiet on and trace on')
notice('notice with quiet on and trace on')
default = l
- print '=-' * 40
- print 'tail: %d' % (len(l.tail))
- print l
- print '=-' * 40
+ print('=-' * 40)
+ print('tail: %d' % (len(l.tail)))
+ print(l)
+ print('=-' * 40)
del l
diff --git a/rtemstoolkit/macros.py b/rtemstoolkit/macros.py
index 8db0729..632be87 100644
--- a/rtemstoolkit/macros.py
+++ b/rtemstoolkit/macros.py
@@ -239,7 +239,7 @@ class macros:
trace_me = False
if trace_me:
- print '[[[[]]]] parsing macros'
+ print('[[[[]]]] parsing macros')
orig_macros = copy.copy(self.macros)
map = 'global'
lc = 0
@@ -254,8 +254,8 @@ class macros:
l_remaining = l
for c in l:
if trace_me:
- print ']]]]]]]] c:%s(%d) s:%s t:"%s" m:%r M:%s' % \
- (c, ord(c), state, token, macro, map)
+ print(']]]]]]]] c:%s(%d) s:%s t:"%s" m:%r M:%s' % \
+ (c, ord(c), state, token, macro, map))
l_remaining = l_remaining[1:]
if c is '#' and not state.startswith('value'):
break
@@ -378,7 +378,7 @@ class macros:
mc.close()
self.files += [n]
return
- except IOError, err:
+ except IOError as err:
pass
raise error.general('opening macro file: %s' % \
(path.host(self.expand(name))))
@@ -490,23 +490,23 @@ class macros:
if __name__ == "__main__":
import copy
import sys
- print inspect.getfile(macros)
+ print(inspect.getfile(macros))
m = macros(name = 'defaults.mc')
d = copy.copy(m)
m['test1'] = 'something'
if d.has_key('test1'):
- print 'error: copy failed.'
+ print('error: copy failed.')
sys.exit(1)
m.parse("[test]\n" \
"test1: none, undefine, ''\n" \
"name: none, override, 'pink'\n")
- print 'set test:', m.set_read_map('test')
+ print('set test:', m.set_read_map('test'))
if m['name'] != 'pink':
- print 'error: override failed. name is %s' % (m['name'])
+ print('error: override failed. name is %s' % (m['name']))
sys.exit(1)
if m.has_key('test1'):
- print 'error: map undefine failed.'
+ print('error: map undefine failed.')
sys.exit(1)
- print 'unset test:', m.unset_read_map('test')
- print m
- print m.keys()
+ print('unset test:', m.unset_read_map('test'))
+ print(m)
+ print(m.keys())
diff --git a/rtemstoolkit/mailer.py b/rtemstoolkit/mailer.py
index df42580..e24ed12 100644
--- a/rtemstoolkit/mailer.py
+++ b/rtemstoolkit/mailer.py
@@ -75,7 +75,7 @@ class mail:
mrc = open(mailrc, 'r')
lines = mrc.readlines()
mrc.close()
- except IOError, err:
+ except IOError as err:
raise error.general('error reading: %s' % (mailrc))
for l in lines:
l = _clean(l)
@@ -104,9 +104,9 @@ class mail:
try:
s = smtplib.SMTP(self.smtp_host())
s.sendmail(from_addr, [to_addr], msg)
- except smtplib.SMTPException, se:
+ except smtplib.SMTPException as se:
raise error.general('sending mail: %s' % (str(se)))
- except socket.error, se:
+ except socket.error as se:
raise error.general('sending mail: %s' % (str(se)))
if __name__ == '__main__':
@@ -115,6 +115,6 @@ if __name__ == '__main__':
append_options(optargs)
opts = options.load(sys.argv, optargs = optargs, defaults = 'defaults.mc')
m = mail(opts)
- print 'From: %s' % (m.from_address())
- print 'SMTP Host: %s' % (m.smtp_host())
+ print('From: %s' % (m.from_address()))
+ print('SMTP Host: %s' % (m.smtp_host()))
m.send(m.from_address(), 'Test mailer.py', 'This is a test')
diff --git a/rtemstoolkit/options.py b/rtemstoolkit/options.py
index 11e3c5a..75d8069 100644
--- a/rtemstoolkit/options.py
+++ b/rtemstoolkit/options.py
@@ -273,9 +273,9 @@ class command_line(object):
return indent
def help(self):
- print '%s: [options] [args]' % (self.command_name)
- print 'RTEMS Tools Project (c) 2012-2015 Chris Johns'
- print 'Options and arguments:'
+ print('%s: [options] [args]' % (self.command_name))
+ print('RTEMS Tools Project (c) 2012-2015 Chris Johns')
+ print('Options and arguments:')
opts = self.long_opts_help.keys()
if self.optargs:
opts += self.optargs.keys()
@@ -287,7 +287,7 @@ class command_line(object):
h = self.optargs[o]
else:
raise error.general('invalid help data: %s' %(o))
- print '%-*s : %s' % (indent, o, h)
+ print('%-*s : %s' % (indent, o, h))
raise error.exit()
def process(self):
@@ -580,13 +580,13 @@ def run(args):
log.notice(str(opts))
log.notice('Defaults:')
log.notice(str(opts.defaults))
- except error.general, gerr:
- print gerr
+ except error.general as gerr:
+ print(gerr)
sys.exit(1)
- except error.internal, ierr:
- print ierr
+ except error.internal as ierr:
+ print(ierr)
sys.exit(1)
- except error.exit, eerr:
+ except error.exit:
pass
except KeyboardInterrupt:
_notice(opts, 'abort: user terminated')
diff --git a/rtemstoolkit/path.py b/rtemstoolkit/path.py
index 238e6d9..c2f3ae2 100644
--- a/rtemstoolkit/path.py
+++ b/rtemstoolkit/path.py
@@ -122,24 +122,24 @@ def mkdir(path):
if windows:
try:
os.makedirs(host(path))
- except IOError, err:
+ except IOError:
raise error.general('cannot make directory: %s' % (path))
- except OSError, err:
+ except OSError:
raise error.general('cannot make directory: %s' % (path))
- except WindowsError, err:
+ except WindowsError:
raise error.general('cannot make directory: %s' % (path))
else:
try:
os.makedirs(host(path))
- except IOError, err:
+ except IOError:
raise error.general('cannot make directory: %s' % (path))
- except OSError, err:
+ except OSError:
raise error.general('cannot make directory: %s' % (path))
def removeall(path):
def _onerror(function, path, excinfo):
- print 'removeall error: (%s) %s' % (excinfo, path)
+ print('removeall error: (%s) %s' % (excinfo, path))
path = host(path)
shutil.rmtree(path, onerror = _onerror)
@@ -208,13 +208,13 @@ def copy_tree(src, dst):
copy_tree(srcname, dstname)
else:
shutil.copy2(srcname, dstname)
- except shutil.Error, err:
+ except shutil.Error as err:
raise error.general('copying tree: %s -> %s: %s' % (src, dst, str(err)))
- except EnvironmentError, why:
+ except EnvironmentError as why:
raise error.general('copying tree: %s -> %s: %s' % (srcname, dstname, str(why)))
try:
shutil.copystat(src, dst)
- except OSError, why:
+ except OSError as why:
ok = False
if windows:
if WindowsError is not None and isinstance(why, WindowsError):
@@ -223,17 +223,17 @@ def copy_tree(src, dst):
raise error.general('copying tree: %s -> %s: %s' % (src, dst, str(why)))
if __name__ == '__main__':
- print host('/a/b/c/d-e-f')
- print host('//a/b//c/d-e-f')
- print shell('/w/x/y/z')
- print basename('/as/sd/df/fg/me.txt')
- print dirname('/as/sd/df/fg/me.txt')
- print join('/d', 'g', '/tyty/fgfg')
+ print(host('/a/b/c/d-e-f'))
+ print(host('//a/b//c/d-e-f'))
+ print(shell('/w/x/y/z'))
+ print(basename('/as/sd/df/fg/me.txt'))
+ print(dirname('/as/sd/df/fg/me.txt'))
+ print(join('/d', 'g', '/tyty/fgfg'))
windows = True
- print host('/a/b/c/d-e-f')
- print host('//a/b//c/d-e-f')
- print shell('/w/x/y/z')
- print shell('w:/x/y/z')
- print basename('x:/sd/df/fg/me.txt')
- print dirname('x:/sd/df/fg/me.txt')
- print join('s:/d/', '/g', '/tyty/fgfg')
+ print(host('/a/b/c/d-e-f'))
+ print(host('//a/b//c/d-e-f'))
+ print(shell('/w/x/y/z'))
+ print(shell('w:/x/y/z'))
+ print(basename('x:/sd/df/fg/me.txt'))
+ print(dirname('x:/sd/df/fg/me.txt'))
+ print(join('s:/d/', '/g', '/tyty/fgfg'))
diff --git a/rtemstoolkit/version.py b/rtemstoolkit/version.py
index a3cf5a8..5b2a01a 100644
--- a/rtemstoolkit/version.py
+++ b/rtemstoolkit/version.py
@@ -42,7 +42,7 @@ def str():
return '%d.%d.%d'% (major, minor, revision)
if __name__ == '__main__':
- print 'major = %d' % (major)
- print 'minor = %d' % (minor)
- print 'revision = %d' % (revision)
- print 'Version: %s' % (str())
+ print('major = %d' % (major))
+ print('minor = %d' % (minor))
+ print('revision = %d' % (revision))
+ print('Version: %s' % (str()))
diff --git a/tester/rt/config.py b/tester/rt/config.py
index ac9c8aa..444420b 100644
--- a/tester/rt/config.py
+++ b/tester/rt/config.py
@@ -185,7 +185,7 @@ class file(config.file):
def _realtime_trace(self, text):
if self.realtime_trace:
for l in text:
- print ' '.join(l)
+ print(' '.join(l))
def run(self):
self.load(self.name)
diff --git a/tester/rt/console.py b/tester/rt/console.py
index fa70541..a6d3161 100644
--- a/tester/rt/console.py
+++ b/tester/rt/console.py
@@ -100,7 +100,7 @@ class tty(console):
def __del__(self):
super(tty, self).__del__()
if self._tracing():
- print ':: tty close', self.dev
+ print(':: tty close', self.dev)
if fcntl is not None:
fcntl.fcntl(me.tty.fd, fcntl.F_SETFL,
fcntl.fcntl(me.tty.fd, fcntl.F_GETFL) & ~os.O_NONBLOCK)
@@ -109,7 +109,7 @@ class tty(console):
def open(self):
def _readthread(me, x):
if self._tracing():
- print ':: tty runner started', self.dev
+ print(':: tty runner started', self.dev)
if fcntl is not None:
fcntl.fcntl(me.tty.fd, fcntl.F_SETFL,
fcntl.fcntl(me.tty.fd, fcntl.F_GETFL) | os.O_NONBLOCK)
@@ -118,7 +118,7 @@ class tty(console):
time.sleep(0.05)
try:
data = me.tty.fd.read()
- except IOError, ioe:
+ except IOError as ioe:
if ioe.errno == errno.EAGAIN:
continue
raise
@@ -133,9 +133,9 @@ class tty(console):
me.output(line)
line = ''
if self._tracing():
- print ':: tty runner finished', self.dev
+ print(':: tty runner finished', self.dev)
if self._tracing():
- print ':: tty open', self.dev
+ print(':: tty open', self.dev)
self.tty = stty.tty(self.dev)
self.tty.set(self.setup)
self.tty.on()
diff --git a/tester/rt/gdb.py b/tester/rt/gdb.py
index 2efd5c0..cbf2c0d 100644
--- a/tester/rt/gdb.py
+++ b/tester/rt/gdb.py
@@ -76,12 +76,12 @@ class gdb(object):
def _lock(self, msg):
if self.lock_trace:
- print '|[ LOCK:%s ]|' % (msg)
+ print('|[ LOCK:%s ]|' % (msg))
self.lock.acquire()
def _unlock(self, msg):
if self.lock_trace:
- print '|] UNLOCK:%s [|' % (msg)
+ print('|] UNLOCK:%s [|' % (msg))
self.lock.release()
def _mi_lock(self):
@@ -92,7 +92,7 @@ class gdb(object):
def _put(self, text):
if self.trace:
- print ')))', text
+ print(')))', text)
self.commands.put(text)
def _input_commands(self):
@@ -100,11 +100,11 @@ class gdb(object):
return False
try:
if self.trace:
- print '... input empty ', self.input.empty()
+ print('... input empty ', self.input.empty())
if self.input.empty():
line = self.commands.get(block = False)
if self.trace:
- print '+++', line
+ print('+++', line)
self.input.put(line)
except:
pass
@@ -113,12 +113,12 @@ class gdb(object):
def _reader(self, line):
self._lock('_reader')
if self.trace:
- print '<<<', line
+ print('<<<', line)
try:
self.lc += 1
if line.startswith('(gdb)'):
if self.trace:
- print '^^^ (gdb)'
+ print('^^^ (gdb)')
if not self._input_commands():
self.gdb_expect()
self._input_commands()
@@ -138,7 +138,7 @@ class gdb(object):
self._unlock('_open')
line = self.input.get(timeout = 0.5)
if self.trace:
- print '>>> input: queue=%d' % (self.input.qsize()), line
+ print('>>> input: queue=%d' % (self.input.qsize()), line)
except Queue.Empty:
return True
if line is None:
@@ -146,10 +146,10 @@ class gdb(object):
return line + os.linesep
except:
if self.trace:
- print 'writer exception'
+ print('writer exception')
pass
if self.trace:
- print 'writer closing'
+ print('writer closing')
return False
def _timeout(self):
@@ -206,7 +206,7 @@ class gdb(object):
self.gdb_console('gdb: %s' % (' '.join(cmds)))
ec, proc = self.process.open(cmds, timeout = (timeout, self._timeout))
if self.trace:
- print 'gdb done', ec
+ print('gdb done', ec)
if ec > 0:
raise error.general('gdb exec: %s: %s' % (cmds[0], os.strerror(ec)))
except:
@@ -219,7 +219,7 @@ class gdb(object):
def gdb_expect(self):
if self.trace:
- print '}}} gdb-expect'
+ print('}}} gdb-expect')
if self.process and not self.running and self.script is not None:
if self.script_line == len(self.script):
self._put(None)
@@ -238,12 +238,12 @@ class gdb(object):
self._mi_lock()
try:
if self.mi_trace:
- print 'mi-data:', lines
+ print('mi-data:', lines)
rec = pygdb.mi_parser.process(lines)
finally:
self._mi_unlock()
if self.mi_trace:
- print 'mi-rec:', rec
+ print('mi-rec:', rec)
if rec.record_type == 'result':
if rec.type == 'result':
if rec.class_ == 'error':
@@ -255,12 +255,12 @@ class gdb(object):
elif rec.type == 'exec':
if rec.class_ == 'running':
if self.trace:
- print '*** running'
+ print('*** running')
self._put('')
self.running = True
elif rec.class_ == 'stopped':
if self.trace:
- print '*** stopped'
+ print('*** stopped')
self.running = False
#self._put('-data-list-register-values')
elif rec.type == 'breakpoint':
@@ -283,13 +283,13 @@ class gdb(object):
if last_lf >= 0:
lines = self.output_buffer[:last_lf]
if self.trace:
- print '/// console output'
+ print('/// console output')
for line in lines.splitlines():
self.output(line)
self.output_buffer = self.output_buffer[last_lf + 1:]
except:
if self.trace:
- print '/// console output'
+ print('/// console output')
for line in lines.splitlines():
self.output(line)
@@ -297,9 +297,9 @@ if __name__ == "__main__":
stdtty = console.save()
try:
def output(text):
- print ']', text
+ print(']', text)
def gdb_console(text):
- print '>', text
+ print('>', text)
script = ['target sim']
if len(sys.argv) > 1:
executable = sys.argv[1]
diff --git a/tester/rt/options.py b/tester/rt/options.py
index a916cbb..c49a288 100644
--- a/tester/rt/options.py
+++ b/tester/rt/options.py
@@ -114,13 +114,13 @@ def run(args):
log.notice(str(_opts))
log.notice('Defaults:')
log.notice(str(_opts.defaults))
- except error.general, gerr:
- print gerr
+ except error.general as gerr:
+ print(gerr)
sys.exit(1)
- except error.internal, ierr:
- print ierr
+ except error.internal as ierr:
+ print(ierr)
sys.exit(1)
- except error.exit, eerr:
+ except error.exit:
pass
except KeyboardInterrupt:
log.notice('abort: user terminated')
diff --git a/tester/rt/pygdb/mi_parser.py b/tester/rt/pygdb/mi_parser.py
index 65ea5e0..7ec8e34 100755
--- a/tester/rt/pygdb/mi_parser.py
+++ b/tester/rt/pygdb/mi_parser.py
@@ -93,7 +93,7 @@ def __private():
def t_default(self, s):
r'( . | \n )+'
- raise Exception, "Specification error: unmatched input for '%s'" % s
+ raise Exception("Specification error: unmatched input for '%s'" % s)
def __unescape(self, s):
s = re.sub(r'\\r', r'\r', s)
@@ -167,8 +167,8 @@ def __private():
def error(self, token, i=0, tokens=None):
if i > 2:
- print '%s %s %s %s' % (tokens[i-3], tokens[i-2], tokens[i-1], tokens[i])
- raise Exception, "Syntax error at or near %d:'%s' token" % (i, token)
+ print('%s %s %s %s' % (tokens[i-3], tokens[i-2], tokens[i-1], tokens[i]))
+ raise Exception("Syntax error at or near %d:'%s' token" % (i, token))
class GdbMiInterpreter(spark.GenericASTTraversal):
def __init__(self, ast):
@@ -190,7 +190,7 @@ def __private():
def n_result(self, node):
# result ::= variable = value
node.value = { node[0].value: node[2].value }
- #print 'result: %s' % node.value
+ #print('result: %s' % node.value)
def n_tuple(self, node):
if len(node) == 2:
@@ -205,7 +205,7 @@ def __private():
for result in node[2].value:
for n, v in result.items():
if node.value.has_key(n):
- #print '**********list conversion: [%s] %s -> %s' % (n, node.value[n], v)
+ #print('**********list conversion: [%s] %s -> %s' % (n, node.value[n], v))
old = node.value[n]
if not isinstance(old, list):
node.value[n] = [ node.value[n] ]
@@ -213,8 +213,8 @@ def __private():
else:
node.value[n] = v
else:
- raise Exception, 'Invalid tuple'
- #print 'tuple: %s' % node.value
+ raise Exception('Invalid tuple')
+ #print('tuple: %s' % node.value)
def n_list(self, node):
if len(node) == 2:
@@ -230,7 +230,7 @@ def __private():
#list ::= [ result result_list ]
#list ::= { value }
#list ::= { value value_list }
- #print 'list %s' % node.value
+ #print('list %s' % node.value)
def n_value_list(self, node):
if len(node) == 2:
@@ -247,7 +247,7 @@ def __private():
else:
# result_list ::= , result result_list
node.value = [ node[1].value ] + node[2].value
- #print 'result_list: %s' % node.value
+ #print('result_list: %s' % node.value)
def n_result_record(self, node):
node.value = node[0].value
@@ -257,7 +257,7 @@ def __private():
elif len(node) == 2:
# result_record ::= result_header nl
pass
- #print 'result_record: %s' % (node.value)
+ #print('result_record: %s' % (node.value))
def n_result_header(self, node):
if len(node) == 3:
@@ -284,7 +284,7 @@ def __private():
'value': node[1].value,
'record_type': 'stream'
}
- #print 'stream_record: %s' % node.value
+ #print('stream_record: %s' % node.value)
def n_record_list(self, node):
if len(node) == 1:
@@ -293,10 +293,10 @@ def __private():
elif len(node) == 2:
# record_list ::= generic_record record_list
node.value = [ node[0].value ] + node[1].value
- #print 'record_list: %s' % node.value
+ #print('record_list: %s' % node.value)
#def default(self, node):
- #print 'default: ' + node.type
+ #print('default: ' + node.type)
class GdbDynamicObject:
def __init__(self, dict_):
@@ -363,7 +363,7 @@ def parse(tokens):
def process(input):
tokens = scan(input)
- ast = parse(tokens)
+ ast = parse(tokens)
__the_interpreter(ast)
return __the_output(ast.value)
@@ -373,9 +373,9 @@ if __name__ == '__main__':
print
for token in tokens:
if token.value:
- print token.type + ': ' + token.value
+ print(token.type + ': ' + token.value)
else:
- print token.type
+ print(token.type)
def run_test(test):
lines = test.splitlines()
@@ -386,7 +386,7 @@ if __name__ == '__main__':
ast = parse(tokens)
__the_interpreter(ast)
output = __the_output(ast.value)
- print output
+ print(output)
x = '"No symbol table is loaded. Use the \\"file\\" command."'
m = re.match('\".*?(?<![\\\\])\"', x)
diff --git a/tester/rt/pygdb/spark.py b/tester/rt/pygdb/spark.py
index aab2d19..7dc1358 100644
--- a/tester/rt/pygdb/spark.py
+++ b/tester/rt/pygdb/spark.py
@@ -60,7 +60,7 @@ class GenericScanner:
return string.join(rv, '|')
def error(self, s, pos):
- print "Lexical error at position %s" % pos
+ print("Lexical error at position %s" % pos)
raise SystemExit
def position(self, newpos=None):
@@ -86,7 +86,7 @@ class GenericScanner:
def t_default(self, s):
r'( . | \n )+'
- print "Specification error: unmatched input"
+ print("Specification error: unmatched input")
raise SystemExit
#
@@ -303,7 +303,7 @@ class GenericParser:
return None
def error(self, token):
- print "Syntax error at or near `%s' token" % token
+ print("Syntax error at or near `%s' token" % token)
raise SystemExit
def parse(self, tokens):
@@ -349,7 +349,8 @@ class GenericParser:
#
return self._NULLABLE == sym[0:len(self._NULLABLE)]
- def skip(self, (lhs, rhs), pos=0):
+ def skip(self, lhs_rhs, pos=0):
+ lhs, rhs = lhs_rhs
n = len(rhs)
while pos < n:
if not self.isnullable(rhs[pos]):
@@ -612,7 +613,7 @@ class GenericParser:
rule = self.ambiguity(self.newrules[nt])
else:
rule = self.newrules[nt][0]
- #print rule
+ #print(rule)
rhs = rule[1]
attr = [None] * len(rhs)
@@ -631,7 +632,7 @@ class GenericParser:
rule = choices[0]
if len(choices) > 1:
rule = self.ambiguity(choices)
- #print rule
+ #print(rule)
rhs = rule[1]
attr = [None] * len(rhs)
@@ -668,7 +669,7 @@ class GenericParser:
sortlist.append((len(rhs), name))
name2index[name] = i
sortlist.sort()
- list = map(lambda (a,b): b, sortlist)
+ list = list(map(lambda a,b: b, sortlist))
return rules[name2index[self.resolve(list)]]
def resolve(self, list):
@@ -833,15 +834,15 @@ class GenericASTMatcher(GenericParser):
def _dump(tokens, sets, states):
for i in range(len(sets)):
- print 'set', i
+ print('set', i)
for item in sets[i]:
- print '\t', item
+ print('\t', item)
for (lhs, rhs), pos in states[item[0]].items:
- print '\t\t', lhs, '::=',
- print string.join(rhs[:pos]),
- print '.',
- print string.join(rhs[pos:])
+ print('\t\t', lhs, '::=',)
+ print(string.join(rhs[:pos]),)
+ print('.',)
+ print(string.join(rhs[pos:]))
if i < len(tokens):
print
- print 'token', str(tokens[i])
+ print('token', str(tokens[i]))
print
diff --git a/tester/rt/stty.py b/tester/rt/stty.py
index d059b40..b6f0204 100644
--- a/tester/rt/stty.py
+++ b/tester/rt/stty.py
@@ -72,7 +72,7 @@ class tty:
raise error.general('dev not found: %s' % (dev))
try:
self.fd = open(dev, 'rw')
- except IOError, ioe:
+ except IOError as ioe:
raise error.general('opening tty dev: %s: %s' % (dev, ioe))
except:
raise error.general('opening tty dev: %s: unknown' % (dev))
@@ -558,9 +558,9 @@ if __name__ == "__main__":
t.control('CRTSCTS', False)
t.vmin(1)
t.vtime(2)
- print t
+ print(t)
t.set('B115200,~BRKINT,IGNBRK,IGNCR,~ICANON,~ISIG,~IEXTEN,~ECHO,CLOCAL,~CRTSCTS')
- print t
+ print(t)
t.on()
while True:
c = t.fd.read(1)
diff --git a/tester/rt/test.py b/tester/rt/test.py
index 551c8b5..ff211d2 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -118,7 +118,7 @@ class test_run(object):
def reraise(self):
if self.result is not None:
- raise self.result[0], self.result[1], self.result[2]
+ raise (self.result[0], self.result[1], self.result[2])
def kill(self):
if self.test:
@@ -157,9 +157,9 @@ def report_finished(reports, report_mode, reporting, finished, job_trace):
if len(reported):
del reported[:]
if job_trace:
- print '}} threading:', threading.active_count()
+ print('}} threading:', threading.active_count())
for t in threading.enumerate():
- print '}} ', t.name
+ print('}} ', t.name)
return reporting
def _job_trace(tst, msg, total, exe, active, reporting):
@@ -302,20 +302,20 @@ def run(command_path = None):
end_time = datetime.datetime.now()
log.notice('Average test time: %s' % (str((end_time - start_time) / total)))
log.notice('Testing time : %s' % (str(end_time - start_time)))
- except error.general, gerr:
- print gerr
+ except error.general as gerr:
+ print(gerr)
sys.exit(1)
- except error.internal, ierr:
- print ierr
+ except error.internal as ierr:
+ print(ierr)
sys.exit(1)
- except error.exit, eerr:
+ except error.exit:
sys.exit(2)
except KeyboardInterrupt:
if opts is not None and opts.find_arg('--stacktrace'):
- print '}} dumping:', threading.active_count()
+ print('}} dumping:', threading.active_count())
for t in threading.enumerate():
- print '}} ', t.name
- print stacktraces.trace()
+ print('}} ', t.name)
+ print(stacktraces.trace())
log.notice('abort: user terminated')
killall(tests)
sys.exit(1)
diff --git a/tester/rt/version.py b/tester/rt/version.py
index 0cc1fca..743d38a 100644
--- a/tester/rt/version.py
+++ b/tester/rt/version.py
@@ -42,7 +42,7 @@ def str():
return '%d.%d.%d'% (major, minor, revision)
if __name__ == '__main__':
- print 'major = %d' % (major)
- print 'minor = %d' % (minor)
- print 'revision = %d' % (revision)
- print 'Version: %s' % (str())
+ print('major = %d' % (major))
+ print('minor = %d' % (minor))
+ print('revision = %d' % (revision))
+ print('Version: %s' % (str()))
diff --git a/tools/gdb/python/__init__.py b/tools/gdb/python/__init__.py
index 58c8625..0ea5fb2 100644
--- a/tools/gdb/python/__init__.py
+++ b/tools/gdb/python/__init__.py
@@ -37,4 +37,4 @@ def get_architure():
_cmds = rtems.create()
-print 'RTEMS GDB Support'
+print('RTEMS GDB Support')
diff --git a/tools/gdb/python/classic.py b/tools/gdb/python/classic.py
index 7c004db..b5aacf8 100644
--- a/tools/gdb/python/classic.py
+++ b/tools/gdb/python/classic.py
@@ -147,29 +147,29 @@ class semaphore:
def show(self, from_tty):
if self.object_control.id() != 0:
- print ' Name:', self.object_control.name()
- print ' Id: 0x%08x (@ 0x%08x)' % (self.object_control.id(),
- self.reference)
- print ' Attr:', self.attr.to_string()
+ print(' Name:', self.object_control.name())
+ print(' Id: 0x%08x (@ 0x%08x)' % (self.object_control.id(),
+ self.reference))
+ print(' Attr:', self.attr.to_string())
if self.attr.test('semaphore-type', 'bin-sema') or \
self.attr.test('semaphore-type', 'simple-bin-sema'):
core_mutex = mutex.control(self.object['Core_control']['mutex'])
- print ' Nesting:', core_mutex.nest_count()
- print ' Holder:',
+ print(' Nesting:', core_mutex.nest_count())
+ print(' Holder:',)
holder = core_mutex.holder()
if holder:
- print '%s (id 0x%08x)' % (holder.brief(), holder.id())
+ print('%s (id 0x%08x)' % (holder.brief(), holder.id()))
else:
- print 'no holder (unlocked)'
+ print('no holder (unlocked)')
wait_queue = core_mutex.wait_queue()
tasks = wait_queue.tasks()
- print ' Queue: len = %d, state = %s' % (len(tasks),
- wait_queue.state())
+ print(' Queue: len = %d, state = %s' % (len(tasks),
+ wait_queue.state()))
if len(tasks) > 0:
- print ' Tasks:'
- print ' Name (c:current, r:real), (id)'
+ print(' Tasks:')
+ print(' Name (c:current, r:real), (id)')
for t in range(0, len(tasks)):
- print ' ', tasks[t].brief(), ' (%08x)' % (tasks[t].id())
+ print(' ', tasks[t].brief(), ' (%08x)' % (tasks[t].id()))
return True
return False
@@ -189,21 +189,21 @@ class task:
cpu = self.task.executing()
if cpu == -1:
cpu = 'not executing'
- print ' Id:', '0x%08x (@ 0x%08x)' % (self.task.id(),
- self.task.reference)
- print ' Name:', self.task.name()
- print ' Active CPU:', cpu
- print ' State:', self.task.current_state()
- print ' Current:', self.task.current_priority()
- print ' Real:', self.task.real_priority()
- print ' Preempt:', self.task.preemptible()
- print ' T Budget:', self.task.cpu_time_budget()
- print ' Time:', self.task.cpu_time_used()
- print ' Resources:', self.task.resource_count()
- print ' Regsters:'
+ print(' Id:', '0x%08x (@ 0x%08x)' % (self.task.id(),
+ self.task.reference))
+ print(' Name:', self.task.name())
+ print(' Active CPU:', cpu)
+ print(' State:', self.task.current_state())
+ print(' Current:', self.task.current_priority())
+ print(' Real:', self.task.real_priority())
+ print(' Preempt:', self.task.preemptible())
+ print(' T Budget:', self.task.cpu_time_budget())
+ print(' Time:', self.task.cpu_time_used())
+ print(' Resources:', self.task.resource_count())
+ print(' Regsters:')
for name in self.regs.names():
val = self.regs.get(name)
- print ' %20s: %08x (%d)' % (name, val, val)
+ print(' %20s: %08x (%d)' % (name, val, val))
return True
return False
@@ -222,8 +222,8 @@ class message_queue:
self.core_control = supercore.message_queue(self.object['message_queue'])
def show(self, from_tty):
- print ' Name:', self.object_control.name()
- print ' Attr:', self.attr.to_string()
+ print(' Name:', self.object_control.name())
+ print(' Attr:', self.attr.to_string())
self.core_control.show()
@@ -237,7 +237,7 @@ class timer:
self.watchdog = watchdog.control(self.object['Ticker'])
def show(self, from_tty):
- print ' Name:', self.object_control.name()
+ print(' Name:', self.object_control.name())
self.watchdog.show()
class partition:
@@ -255,11 +255,11 @@ class partition:
def show(self, from_tty):
# ToDo: the printing still somewhat crude.
- print ' Name:', self.object_control.name()
- print ' Attr:', self.attr.to_string()
- print ' Length:', self.length
- print ' B Size:', self.buffer_size
- print ' U Blocks:', self.used_blocks
+ print(' Name:', self.object_control.name())
+ print(' Attr:', self.attr.to_string())
+ print(' Length:', self.length)
+ print(' B Size:', self.buffer_size)
+ print(' U Blocks:', self.used_blocks)
class region:
"prints a classic region"
@@ -273,10 +273,10 @@ class region:
self.heap = heaps.control(self.object['Memory'])
def show(self, from_tty):
- print ' Name:', self.object_control.name()
- print ' Attr:', self.attr.to_string()
+ print(' Name:', self.object_control.name())
+ print(' Attr:', self.attr.to_string())
helper.tasks_printer_routine(self.wait_queue)
- print ' Memory:'
+ print(' Memory:')
self.heap.show()
class barrier:
@@ -290,12 +290,12 @@ class barrier:
self.core_b_control = supercore.barrier_control(self.object['Barrier'])
def show(self,from_tty):
- print ' Name:',self.object_control.name()
- print ' Attr:',self.attr.to_string()
+ print(' Name:',self.object_control.name())
+ print(' Attr:',self.attr.to_string())
if self.attr.test('barrier','barrier-auto-release'):
max_count = self.core_b_control.max_count()
- print 'Aut Count:', max_count
+ print('Aut Count:', max_count)
- print ' Waiting:',self.core_b_control.waiting_threads()
+ print(' Waiting:',self.core_b_control.waiting_threads())
helper.tasks_printer_routine(self.core_b_control.tasks())
diff --git a/tools/gdb/python/heaps.py b/tools/gdb/python/heaps.py
index e843f33..14238e3 100644
--- a/tools/gdb/python/heaps.py
+++ b/tools/gdb/python/heaps.py
@@ -73,9 +73,9 @@ class stats:
return self.stat['free_size']
def show(self):
- print ' Instance:',self.inst()
- print ' Avail:',self.avail()
- print ' Free:',self.free()
+ print(' Instance:',self.inst())
+ print(' Avail:',self.avail())
+ print(' Free:',self.free())
# ToDo : incorporate others
@@ -105,9 +105,9 @@ class control:
fi = self.first()
la = self.last()
- print ' First:', fi.val()
- print ' Last:', la.val()
+ print(' First:', fi.val())
+ print(' Last:', la.val())
stats = self.stat()
- print ' stats:'
+ print(' stats:')
stats.show()
diff --git a/tools/gdb/python/helper.py b/tools/gdb/python/helper.py
index 5efcf02..e9fe2f8 100644
--- a/tools/gdb/python/helper.py
+++ b/tools/gdb/python/helper.py
@@ -34,9 +34,9 @@ import gdb
def tasks_printer_routine(wait_queue):
tasks = wait_queue.tasks()
- print ' Queue: len = %d, state = %s' % (len(tasks),wait_queue.state())
+ print(' Queue: len = %d, state = %s' % (len(tasks),wait_queue.state()))
for t in range(0, len(tasks)):
- print ' ', tasks[t].brief(), ' (%08x)' % (tasks[t].id())
+ print(' ', tasks[t].brief(), ' (%08x)' % (tasks[t].id()))
def type_from_value(val):
type = val.type;
diff --git a/tools/gdb/python/rtems.py b/tools/gdb/python/rtems.py
index d4317ff..a097797 100644
--- a/tools/gdb/python/rtems.py
+++ b/tools/gdb/python/rtems.py
@@ -78,15 +78,15 @@ class rtems_object(gdb.Command):
val = gdb.parse_and_eval(num)
num = int(val)
except:
- print 'error: "%s" is not a number' % (num)
+ print('error: "%s" is not a number' % (num))
return True
id = objects.ident(num)
if not id.valid():
- print 'Invalid object id'
+ print('Invalid object id')
return True
- print 'API:%s Class:%s Node:%d Index:%d Id:%08X' % \
- (id.api(), id._class(), id.node(), id.index(), id.value())
+ print('API:%s Class:%s Node:%d Index:%d Id:%08X' % \
+ (id.api(), id._class(), id.node(), id.index(), id.value()))
objectname = id.api() + '/' + id._class()
obj = objects.information.object(id).dereference()
@@ -124,32 +124,32 @@ class rtems_index(gdb.Command):
index = int(val, base = 0)
if index < maximum:
if index < minimum_id.index():
- print "error: %s is not an index (min is %d)" % (val,
- minimum_id.index())
+ print("error: %s is not an index (min is %d)" % (val,
+ minimum_id.index()))
return
else:
index = objects.ident(index).index()
except ValueError:
- print "error: %s is not an index" % (val)
+ print("error: %s is not an index" % (val))
return
try:
obj = objects.information.object_return(self.api,
self._class,
index)
except IndexError:
- print "error: index %s is invalid" % (index)
+ print("error: index %s is invalid" % (index))
return
instance = self.instance(obj)
valid = instance.show(from_tty)
objects.information.invalidate()
else:
- print '-' * 70
- print ' %s: %d [%08x -> %08x]' % (objects.information.name(self.api, self._class),
- maximum, minimum_id.value(), maximum_id.value())
+ print('-' * 70)
+ print(' %s: %d [%08x -> %08x]' % (objects.information.name(self.api, self._class),
+ maximum, minimum_id.value(), maximum_id.value()))
valid = True
for index in range(minimum_id.index(), minimum_id.index() + maximum):
if valid:
- print '-' * 70
+ print('-' * 70)
valid = self.invoke(str(index), from_tty)
return valid
@@ -249,7 +249,7 @@ class rtems_tod(gdb.Command):
def invoke(self, arg, from_tty):
if arg:
- print "warning: commad takes no arguments!"
+ print("warning: commad takes no arguments!")
obj = objects.information.object_return(self.api, self._class)
instance = supercore.time_of_day(obj)
instance.show()
@@ -271,15 +271,15 @@ class rtems_watchdog_chain(gdb.Command):
inst = chains.control(obj)
if inst.empty():
- print ' error: empty chain'
+ print(' error: empty chain')
return
nd = inst.first()
i = 0
while not nd.null():
wd = watchdog.control(nd.cast('Watchdog_Control'))
- print ' #'+str(i)
- print wd.to_string()
+ print(' #'+str(i))
+ print(wd.to_string())
nd.next()
i += 1
diff --git a/tools/gdb/python/sparc.py b/tools/gdb/python/sparc.py
index 41b6fec..38f19b7 100644
--- a/tools/gdb/python/sparc.py
+++ b/tools/gdb/python/sparc.py
@@ -114,29 +114,29 @@ class register:
return self.psr(self.reg['psr'])
def show(self):
- print ' Global Regs:',
- print ' [',
+ print(' Global Regs:',)
+ print(' [',)
for i in self.global_regs():
- print str(i)+',',
- print '\b\b ]'
+ print(str(i)+',',)
+ print('\b\b ]')
- print ' Local Regs:',
- print ' [',
+ print(' Local Regs:',)
+ print(' [',)
for i in self.local_regs():
- print str(i)+',',
- print '\b\b ]'
+ print(str(i)+',',)
+ print('\b\b ]')
- print ' In Regs:',
- print ' [',
+ print(' In Regs:',)
+ print(' [',)
for i in self.in_regs():
- print str(i)+',',
- print '\b\b ]'
+ print(str(i)+',',)
+ print('\b\b ]')
- print ' Out Regs:',
- print ' [',
+ print(' Out Regs:',)
+ print(' [',)
for i in self.out_regs():
- print str(i)+',',
- print '\b\b ]'
+ print(str(i)+',',)
+ print('\b\b ]')
sr = self.status()
- print sr.to_string()
+ print(sr.to_string())
diff --git a/tools/gdb/python/supercore.py b/tools/gdb/python/supercore.py
index 0790cc9..318ebb7 100644
--- a/tools/gdb/python/supercore.py
+++ b/tools/gdb/python/supercore.py
@@ -50,13 +50,13 @@ class time_of_day:
return bool(self.tod['is_set'])
def show(self):
- print ' Time Of Day'
+ print(' Time Of Day')
if not self.is_set():
- print ' Application has not set a TOD'
+ print(' Application has not set a TOD')
- print ' Now:', self.now()
- print ' Uptime:', self.timer()
+ print(' Now:', self.now())
+ print(' Uptime:', self.timer())
class message_queue:
diff --git a/tools/gdb/python/watchdog.py b/tools/gdb/python/watchdog.py
index dfa57a0..6a80421 100644
--- a/tools/gdb/python/watchdog.py
+++ b/tools/gdb/python/watchdog.py
@@ -89,4 +89,4 @@ class control:
return val
def show(self):
- print self.to_string()
+ print(self.to_string())