Changeset 0967a1b in rtems-tools for tools/gdb


Ignore:
Timestamp:
Jul 13, 2013, 11:01:59 AM (6 years ago)
Author:
Dhananjay Balan <mb.dhananjay@…>
Branches:
4.10, 4.11, e9f48e9face6c4dea62712d73b35412c0fe10332
Children:
591fbf6
Parents:
a785e25
git-author:
Dhananjay Balan <mb.dhananjay@…> (07/13/13 11:01:59)
git-committer:
Chris Johns <chrisj@…> (08/24/14 23:52:40)
Message:

Refactoring

  • drop _printer suffix from printer classes.
Location:
tools/gdb/python
Files:
1 added
7 edited

Legend:

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

    ra785e25 r0967a1b  
    1414    import classic_printer
    1515
    16     # Needed to reload code inside gdb source command
     16    # Needed inorder to reload code from inside gdb
    1717    reload(supercore)
    1818    reload(chains)
     
    2323    reload(supercore_printer)
    2424    reload(classic_printer)
     25
    2526    print 'RTEMS GDB Support loaded'
  • tools/gdb/python/classic.py

    ra785e25 r0967a1b  
    8080        self.attr = attr
    8181
     82    #ToDo: Move this out
    8283    def to_string(self):
    8384        s = '0x%08x,' % (self.attr)
  • tools/gdb/python/classic_printer.py

    ra785e25 r0967a1b  
    33#
    44
    5 class attribute_printer:
     5class attribute:
    66
    77    def __init__(self, attribute):
     
    1212        return gdb.Value(self.attr.to_string())
    1313
    14 class semaphore_printer:
    15     """WIP: Print a Semaphore_Control object. Print using the struct display hint
     14class semaphore:
     15    """ToDo: Print a Semaphore_Control object. Print using the struct display hint
    1616    and an iterator. """
    1717
  • tools/gdb/python/objects.py

    ra785e25 r0967a1b  
    247247        is_string = information.is_string(self._id.api(), self._id._class())
    248248        return str(name(self.object['name'], is_string))
    249 
    250 
    251 
    252 
    253 class control_printer:
    254 
    255     class iterator:
    256         """Use an iterator for each field expanded from the id so GDB output
    257         is formatted correctly."""
    258 
    259         def __init__(self, object):
    260             self.object = object
    261             self.count = 0
    262 
    263         def __iter__(self):
    264             return self
    265 
    266         def next(self):
    267             self.count += 1
    268             if self.count == 1:
    269                 return self.object.node()
    270             elif self.count == 2:
    271                 return self.object.id()
    272             elif self.count == 3:
    273                 return self.object.name()
    274             raise StopIteration
    275 
    276     def to_string(self):
    277         return ''
    278 
    279     def __init__(self, object):
    280         self.object = control(object)
    281 
    282     @staticmethod
    283     def key(i):
    284         if i == 0:
    285             return 'Node'
    286         elif i == 1:
    287             return 'id'
    288         elif i == 2:
    289             return 'name'
    290         return 'bad'
    291 
    292     def children(self):
    293         counter = itertools.imap (self.key, itertools.count())
    294         return itertools.izip (counter, self.iterator(self.object))
    295 
    296     def display_hint (self):
    297         return 'struct'
  • tools/gdb/python/rtems.py

    ra785e25 r0967a1b  
    5555
    5656def build_rtems_dict():
    57     pp_dict[re.compile('^rtems_id$')]   = lambda val: supercore_printer.id_printer(val)
    58     pp_dict[re.compile('^Objects_Id$')] = lambda val: supercore_printer.id_printer(val)
    59     pp_dict[re.compile('^Objects_Name$')] = lambda val: supercore_printer.name_printer(val)
    60     pp_dict[re.compile('^Objects_Control$')] = lambda val: supercore_printer.control_printer(val)
    61     pp_dict[re.compile('^States_Control$')] = lambda val: supercore_printer.state_printer(val)
    62     pp_dict[re.compile('^rtems_attribute$')] = lambda val: classic_printer.attribute_printer(val)
    63     pp_dict[re.compile('^Semaphore_Control$')] = lambda val: classic_printer.semaphore_printer(val)
     57    pp_dict[re.compile('^rtems_id$')]   = lambda val: supercore_printer.id(val)
     58    pp_dict[re.compile('^Objects_Id$')] = lambda val: supercore_printer.id(val)
     59    pp_dict[re.compile('^Objects_Name$')] = lambda val: supercore_printer.name(val)
     60    pp_dict[re.compile('^Objects_Control$')] = lambda val: supercore_printer.control(val)
     61    pp_dict[re.compile('^States_Control$')] = lambda val: supercore_printer.state(val)
     62    pp_dict[re.compile('^rtems_attribute$')] = lambda val: classic_printer.attribute(val)
     63    pp_dict[re.compile('^Semaphore_Control$')] = lambda val: classic_printer.semaphore(val)
    6464
    6565class rtems(gdb.Command):
  • tools/gdb/python/supercore.py

    ra785e25 r0967a1b  
    44
    55import threads
    6 
    7 # ToDo: Move this to helper.
    8 def tasks_printer_rotuine(wait_queue):
    9     tasks = wait_queue.tasks()
    10     print '    Queue: len = %d, state = %s' % (len(tasks),wait_queue.state())
    11     for t in range(0, len(tasks)):
    12         print '      ', tasks[t].brief(), ' (%08x)' % (tasks[t].id())
     6import helper
    137
    148class CORE_message_queue:
     
    2216
    2317    def show(self):
    24         tasks_printer_rotuine(self.wait_queue)
     18        helper.tasks_printer_rotuine(self.wait_queue)
  • tools/gdb/python/supercore_printer.py

    ra785e25 r0967a1b  
    55import itertools
    66
    7 class id_printer:
     7class id:
    88    """Print an object given the ID. Print using the struct display hint and an
    99    iterator."""
     
    6161        return 'struct'
    6262
    63 class name_printer:
     63class name:
    6464    """Pretty printer for an object's name. It has to guess the type as no
    6565    information is available to help determine it."""
     
    7171        return str(self.name)
    7272
    73 class control_printer:
     73class control:
    7474
    7575    class iterator:
     
    118118
    119119
    120 class state_printer:
     120class state:
    121121
    122122    def __init__(self, state):
     
    125125        return self.state.to_string()
    126126
    127 class chains_printer:
     127class chains:
    128128
    129129    def __init__(self,chain):
     
    133133        return "First:"+str(self.chain.first())+"\n Last:"+str(self.chain.last())
    134134
    135 class node_printer:
     135class node:
    136136    def __init__(self, node):
    137137        self.node = chains.node(node)
Note: See TracChangeset for help on using the changeset viewer.