Changeset b061a67 in rtems-tools for tools/gdb/python/classic.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/classic.py

    r6e75f4e rb061a67  
    1212import objects
    1313import threads
     14import supercore
    1415
    1516class attribute:
     
    99100        return False
    100101
    101 class attribute_printer:
    102 
    103     def __init__(self, attr):
    104         self.attr = attribute(attr,'all')
    105 
    106     def to_string(self):
    107         return gdb.Value(self.attr.to_string())
    108 
    109 class semaphore_printer:
    110     """Print a Semaphore_Control object. Print using the struct display hint
    111     and an iterator."""
    112 
    113     class iterator:
    114         """Use an iterator for each field expanded from the id so GDB output
    115         is formatted correctly."""
    116 
    117         def __init__(self, semaphore):
    118             self.semaphore = semaphore
    119             self.count = 0
    120 
    121         def __iter__(self):
    122             return self
    123 
    124         def next(self):
    125             self.count += 1
    126             if self.count == 1:
    127                 return self.semaphore['Object']
    128             elif self.count == 2:
    129                 attr = attribute(self.semaphore['attribute_set'],
    130                                  'semaphore')
    131                 return attr.to_string()
    132             elif self.count == 3:
    133                 return self.semaphore['Core_control']
    134             raise StopIteration
    135 
    136     def __init__(self, semaphore):
    137         self.semaphore = semaphore
    138 
    139     def to_string(self):
    140         return ''
    141 
    142     @staticmethod
    143     def key(i):
    144         if i == 0:
    145             return 'Object'
    146         elif i == 1:
    147             return 'attribute_set'
    148         elif i == 2:
    149             return 'Core_control'
    150         return 'bad'
    151 
    152     def children(self):
    153         counter = itertools.imap (self.key, itertools.count())
    154         return itertools.izip (counter, self.iterator(self.semaphore))
    155 
    156     def display_hint (self):
    157         return 'struct'
    158102
    159103class semaphore:
     
    226170        self.attr = attribute(self.object['attribute_set'], \
    227171            'message_queue')
     172        self.wait_queue = threads.queue( \
     173            self.object['message_queue']['Wait_queue'])
     174
     175        self.core_control = supercore.CORE_message_queue(self.object['message_queue'])
    228176
    229177    def show(self, from_tty):
     
    231179        print '     Attr:', self.attr.to_string()
    232180
    233 
     181        self.core_control.show()
Note: See TracChangeset for help on using the changeset viewer.