Changeset a245635 in rtems-tools for tools/gdb


Ignore:
Timestamp:
Aug 24, 2013, 9:38:16 AM (6 years ago)
Author:
Dhananjay Balan <mb.dhananjay@…>
Branches:
4.10, 4.11, e9f48e9face6c4dea62712d73b35412c0fe10332
Children:
7a415d4
Parents:
a0bf9f2
git-author:
Dhananjay Balan <mb.dhananjay@…> (08/24/13 09:38:16)
git-committer:
Chris Johns <chrisj@…> (08/24/14 23:52:41)
Message:

Add subcommand

rtems tod - prints the time of day.

Location:
tools/gdb/python
Files:
4 edited

Legend:

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

    ra0bf9f2 ra245635  
    1818rtems.rtems_task()
    1919rtems.rtems_message_queue()
     20rtems.rtems_tod()
  • tools/gdb/python/objects.py

    ra0bf9f2 ra245635  
    1414
    1515    tables_types = {
     16        'internal/time'          : ('TOD_Control',           '_TOD'),
     17
    1618        'classic/tasks'          : ('Thread_Control',        '_RTEMS_tasks_Information'),
    1719        'classic/timers'         : ('Timer_Control',         '_Timer_Information'),
     
    6567        return self.object_return(api, _class, index)
    6668
    67     def object_return(self, api, _class, index):
    68         n = self.name(api, _class)
    69         self.load(n)
    70         max = self.maximum(api, _class)
    71         if index > max:
    72             raise IndexError('object index out of range (%d)' % (max))
     69    def object_return(self, api, _class, index=-1):
     70        n = self.name(api, _class)
     71        self.load(n)
     72
    7373        table_type = self.tables_types[n]
    74         expr = '(' + table_type[0] + '*)' + \
    75             table_type[1] + '.local_table[' + str(index) + ']'
     74
     75        if api == 'internal':
     76            expr = '(' + table_type[0] + ')' + table_type[1]
     77
     78        else:
     79            max = self.maximum(api, _class)
     80            if index > max:
     81                raise IndexError('object index out of range (%d)' % (max))
     82            expr = '(' + table_type[0] + '*)' + \
     83                table_type[1] + '.local_table[' + str(index) + ']'
    7684        return gdb.parse_and_eval(expr)
    7785
  • tools/gdb/python/rtems.py

    ra0bf9f2 ra245635  
    1111import objects
    1212import threads
     13import supercore
    1314import classic
    1415
     
    185186        return classic.barrier(obj)
    186187
     188class rtems_tod(gdb.Command):
     189    '''Print rtems time of day'''
     190
     191    api = 'internal'
     192    _class = 'time'
     193
     194    def __init__(self):
     195        self.__doc__ = 'Display RTEMS time of day'
     196        super(rtems_tod, self).__init__ \
     197                    ('rtems tod', gdb.COMMAND_STATUS,gdb.COMPLETE_NONE)
     198
     199    def invoke(self, arg, from_tty):
     200
     201        if arg:
     202            print "warning: commad takes no arguments!"
     203
     204        obj = objects.information.object_return(self.api,self._class)
     205        instance = supercore.time_of_day(obj)
     206        instance.show()
     207        objects.information.invalidate()
  • tools/gdb/python/supercore.py

    ra0bf9f2 ra245635  
    55import threads
    66import helper
     7
     8class time_of_day:
     9    '''Manage time of day object'''
     10
     11    def __init__(self, tod):
     12        self.tod = tod
     13
     14    def now(self):
     15        return self.tod['now']
     16
     17    def timer(self):
     18        return self.tod['uptime']
     19
     20    def is_set(self):
     21        return bool(self.tod['is_set'])
     22
     23    def show(self):
     24        print ' Time Of Day'
     25
     26        if not self.is_set():
     27            print ' Application has not set a TOD'
     28
     29        print '      Now:', self.now()
     30        print '   Uptime:', self.timer()
     31
    732
    833class message_queue:
Note: See TracChangeset for help on using the changeset viewer.