[rtems-tools commit] Add subcommand semaphore
Chris Johns
chrisj at rtems.org
Sun Aug 24 23:45:34 UTC 2014
Module: rtems-tools
Branch: master
Commit: 479717912afe27705874805f3a3786dd9d665bb6
Changeset: http://git.rtems.org/rtems-tools/commit/?id=479717912afe27705874805f3a3786dd9d665bb6
Author: Dhananjay Balan <mb.dhananjay at gmail.com>
Date: Fri Aug 9 14:25:43 2013 +0530
Add subcommand semaphore
rtems semaphore <index(s)> : prints rtems semaphores by index number
---
tools/gdb/python/rtems.py | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/tools/gdb/python/rtems.py b/tools/gdb/python/rtems.py
index 20f44a2..cf1ae07 100644
--- a/tools/gdb/python/rtems.py
+++ b/tools/gdb/python/rtems.py
@@ -85,7 +85,7 @@ class rtems_object(gdb.Command):
}
def __init__(self):
- self.__doc__ = 'Display the RTEMS object given a numeric ID.'
+ self.__doc__ = 'Display the RTEMS object given a numeric ID (Or a reference to rtems_object).'
super(rtems_object, self).__init__('rtems object',
gdb.COMMAND_STATUS)
@@ -112,6 +112,32 @@ class rtems_object(gdb.Command):
object.show(from_tty)
objects.information.invalidate()
+class rtems_semaphore(gdb.Command):
+ '''Semaphore subcommand for rtems'''
+
+ api = 'classic'
+ _class = 'semaphores'
+
+ def __init__(self):
+ self.__doc__ = 'Display the RTEMS semaphores by index'
+ super(rtems_semaphore, self).__init__('rtems semaphore',
+ gdb.COMMAND_STATUS)
+
+ def invoke(self, arg, from_tty):
+ for val in arg.split():
+ try:
+ index = int(val)
+ except ValueError:
+ print "error: %s is not an index" % (val)
+ return
+
+ obj = objects.information.object_return( self.api,
+ self._class,
+ int(index)).dereference()
+ instance = classic.semaphore(obj)
+ instance.show(from_tty)
+ objects.information.invalidate()
+
#
# Main
#
@@ -120,4 +146,5 @@ build_rtems_dict()
gdb.pretty_printers = []
gdb.pretty_printers.append (lookup_function)
rtems()
-rtems_object()
\ No newline at end of file
+rtems_object()
+rtems_semaphore()
\ No newline at end of file
More information about the vc
mailing list