Changeset b061a67 in rtems-tools for tools/gdb/python/objects.py


Ignore:
Timestamp:
Jul 12, 2013, 1:34:37 PM (6 years ago)
Author:
Dhananjay Balan <mb.dhananjay@…>
Branches:
4.10, 4.11, master
Children:
a785e25
Parents:
6e75f4e
git-author:
Dhananjay Balan <mb.dhananjay@…> (07/12/13 13:34:37)
git-committer:
Chris Johns <chrisj@…> (08/24/14 23:52:40)
Message:

Heavy refactoring + Improved mesege queu printing.

  • pretty printers moved to the corresponding api_printer module
  • object abstractions moved to
    • their own name for core modules
    • supercore for other supercore objects
    • classic for classic api objects
File:
1 edited

Legend:

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

    r6e75f4e rb061a67  
    248248        return str(name(self.object['name'], is_string))
    249249
    250 class id_printer:
    251     """Print an object given the ID. Print using the struct display hint and an
    252     iterator."""
    253 
    254     class iterator:
    255         """Use an iterator for each field expanded from the id so GDB output
    256         is formatted correctly."""
    257 
    258         def __init__(self, id):
    259             self.id = id
    260             self.count = 0
    261 
    262         def __iter__(self):
    263             return self
    264 
    265         def next(self):
    266             self.count += 1
    267             if self.count == 1:
    268                 return int(self.id.value())
    269             elif self.count == 2:
    270                 return self.id.node()
    271             elif self.count == 3:
    272                 return self.id.api()
    273             elif self.count == 4:
    274                 return self.id._class()
    275             elif self.count == 5:
    276                 return self.id.index()
    277             raise StopIteration
    278 
    279     def __init__(self, id):
    280         self.id = ident(id)
    281 
    282     def to_string(self):
    283         return ''
    284 
    285     @staticmethod
    286     def key(i):
    287         if i == 0:
    288             return 'id'
    289         elif i == 1:
    290             return 'node'
    291         elif i == 2:
    292             return 'api'
    293         elif i == 3:
    294             return 'class'
    295         elif i == 4:
    296             return 'index'
    297         return 'bad'
    298 
    299     def children(self):
    300         counter = itertools.imap (self.key, itertools.count())
    301         return itertools.izip (counter, self.iterator(self.id))
    302 
    303     def display_hint (self):
    304         return 'struct'
    305 
    306 class name_printer:
    307     """Pretty printer for an object's name. It has to guess the type as no
    308     information is available to help determine it."""
    309 
    310     def __init__(self, nameval):
    311         self.name = name(nameval)
    312 
    313     def to_string(self):
    314         return gdb.Value(str(self.name))
     250
     251
    315252
    316253class control_printer:
Note: See TracChangeset for help on using the changeset viewer.