mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-17 12:51:08 +08:00
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
This commit is contained in:

committed by
Chris Johns

parent
6e75f4ebf5
commit
b061a67742
@@ -11,6 +11,7 @@ import re
|
||||
|
||||
import objects
|
||||
import threads
|
||||
import supercore
|
||||
|
||||
class attribute:
|
||||
"""The Classic API attribute."""
|
||||
@@ -98,63 +99,6 @@ class attribute:
|
||||
return True
|
||||
return False
|
||||
|
||||
class attribute_printer:
|
||||
|
||||
def __init__(self, attr):
|
||||
self.attr = attribute(attr,'all')
|
||||
|
||||
def to_string(self):
|
||||
return gdb.Value(self.attr.to_string())
|
||||
|
||||
class semaphore_printer:
|
||||
"""Print a Semaphore_Control object. Print using the struct display hint
|
||||
and an iterator."""
|
||||
|
||||
class iterator:
|
||||
"""Use an iterator for each field expanded from the id so GDB output
|
||||
is formatted correctly."""
|
||||
|
||||
def __init__(self, semaphore):
|
||||
self.semaphore = semaphore
|
||||
self.count = 0
|
||||
|
||||
def __iter__(self):
|
||||
return self
|
||||
|
||||
def next(self):
|
||||
self.count += 1
|
||||
if self.count == 1:
|
||||
return self.semaphore['Object']
|
||||
elif self.count == 2:
|
||||
attr = attribute(self.semaphore['attribute_set'],
|
||||
'semaphore')
|
||||
return attr.to_string()
|
||||
elif self.count == 3:
|
||||
return self.semaphore['Core_control']
|
||||
raise StopIteration
|
||||
|
||||
def __init__(self, semaphore):
|
||||
self.semaphore = semaphore
|
||||
|
||||
def to_string(self):
|
||||
return ''
|
||||
|
||||
@staticmethod
|
||||
def key(i):
|
||||
if i == 0:
|
||||
return 'Object'
|
||||
elif i == 1:
|
||||
return 'attribute_set'
|
||||
elif i == 2:
|
||||
return 'Core_control'
|
||||
return 'bad'
|
||||
|
||||
def children(self):
|
||||
counter = itertools.imap (self.key, itertools.count())
|
||||
return itertools.izip (counter, self.iterator(self.semaphore))
|
||||
|
||||
def display_hint (self):
|
||||
return 'struct'
|
||||
|
||||
class semaphore:
|
||||
"Print a classic semaphore."
|
||||
@@ -225,9 +169,13 @@ class message_queue:
|
||||
self.object_control = objects.control(self.object['Object'])
|
||||
self.attr = attribute(self.object['attribute_set'], \
|
||||
'message_queue')
|
||||
self.wait_queue = threads.queue( \
|
||||
self.object['message_queue']['Wait_queue'])
|
||||
|
||||
self.core_control = supercore.CORE_message_queue(self.object['message_queue'])
|
||||
|
||||
def show(self, from_tty):
|
||||
print ' Name:', self.object_control.name()
|
||||
print ' Attr:', self.attr.to_string()
|
||||
|
||||
|
||||
self.core_control.show()
|
Reference in New Issue
Block a user