Changeset 4797179 in rtems-tools for tools/gdb


Ignore:
Timestamp:
Aug 9, 2013, 8:37:43 AM (6 years ago)
Author:
Dhananjay Balan <mb.dhananjay@…>
Branches:
4.10, 4.11, master
Children:
a713688
Parents:
559bd50
git-author:
Dhananjay Balan <mb.dhananjay@…> (08/09/13 08:37:43)
git-committer:
Chris Johns <chrisj@…> (08/24/14 23:52:41)
Message:

Add subcommand semaphore
rtems semaphore <index(s)> : prints rtems semaphores by index number

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gdb/python/rtems.py

    r559bd50 r4797179  
    8686
    8787    def __init__(self):
    88         self.__doc__ = 'Display the RTEMS object given a numeric ID.'
     88        self.__doc__ = 'Display the RTEMS object given a numeric ID (Or a reference to rtems_object).'
    8989        super(rtems_object, self).__init__('rtems object',
    9090                                           gdb.COMMAND_STATUS)
     
    113113        objects.information.invalidate()
    114114
     115class rtems_semaphore(gdb.Command):
     116    '''Semaphore subcommand for rtems'''
     117
     118    api = 'classic'
     119    _class = 'semaphores'
     120
     121    def __init__(self):
     122        self.__doc__ = 'Display the RTEMS semaphores by index'
     123        super(rtems_semaphore, self).__init__('rtems semaphore',
     124                                           gdb.COMMAND_STATUS)
     125
     126    def invoke(self, arg, from_tty):
     127        for val in arg.split():
     128            try:
     129                index = int(val)
     130            except ValueError:
     131                print "error: %s is not an index" % (val)
     132                return
     133
     134            obj = objects.information.object_return( self.api,
     135                                                 self._class,
     136                                                 int(index)).dereference()
     137            instance = classic.semaphore(obj)
     138            instance.show(from_tty)
     139        objects.information.invalidate()
     140
    115141#
    116142# Main
     
    122148rtems()
    123149rtems_object()
     150rtems_semaphore()
Note: See TracChangeset for help on using the changeset viewer.