diff options
author | Dhananjay Balan <mb.dhananjay@gmail.com> | 2013-08-09 14:07:43 +0530 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-08-25 09:52:41 +1000 |
commit | 479717912afe27705874805f3a3786dd9d665bb6 (patch) | |
tree | 133ea47dd9adfc923cdfad09d3b0c44dc5861426 | |
parent | 559bd50d27023ccd7d65f1c023e075fe965dcbfd (diff) |
Add subcommand semaphore
rtems semaphore <index(s)> : prints rtems semaphores by index number
-rw-r--r-- | 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 |