Messege Queue Objects

Added intial support for printing
This commit is contained in:
Dhananjay Balan
2013-07-08 21:42:48 +05:30
committed by Chris Johns
parent ce55b57c4c
commit f814c7629c
2 changed files with 27 additions and 11 deletions

View File

@@ -36,7 +36,9 @@ class attribute:
'semaphore-pri-ceiling'], 'semaphore-pri-ceiling'],
'barrier' : ['scope', 'barrier' : ['scope',
'priority', 'priority',
'barrier'] 'barrier'],
'message_queue' : ['priority',
'scope']
} }
masks = { masks = {
@@ -64,7 +66,7 @@ class attribute:
(0x00000040, 'inherit-pri')], (0x00000040, 'inherit-pri')],
'semaphore-pri-ceiling' : [(0x00000000, 'no-pri-ceiling'), 'semaphore-pri-ceiling' : [(0x00000000, 'no-pri-ceiling'),
(0x00000080, 'pri-ceiling')], (0x00000080, 'pri-ceiling')],
'barrier' : [(0x00000010, 'barrier-auto-release'), 'barrier' : [(0x00000010, 'barrier-auto-release'),
(0x00000000, 'barrier-manual-release')], (0x00000000, 'barrier-manual-release')],
'task' : [(0x00000000, 'app-task'), 'task' : [(0x00000000, 'app-task'),
(0x00008000, 'sys-task')] (0x00008000, 'sys-task')]
@@ -97,7 +99,7 @@ class attribute:
return False return False
class attribute_printer: class attribute_printer:
def __init__(self, attr): def __init__(self, attr):
self.attr = attr self.attr = attr
@@ -124,7 +126,7 @@ class semaphore_printer:
if self.count == 1: if self.count == 1:
return self.semaphore['Object'] return self.semaphore['Object']
elif self.count == 2: elif self.count == 2:
attr = attribute(self.semaphore['attribute_set'], attr = attribute(self.semaphore['attribute_set'],
'semaphore') 'semaphore')
return attr.to_string() return attr.to_string()
elif self.count == 3: elif self.count == 3:
@@ -162,7 +164,7 @@ class semaphore:
self.object = objects.information.object(self.id).dereference() self.object = objects.information.object(self.id).dereference()
self.object_control = objects.control(self.object['Object']) self.object_control = objects.control(self.object['Object'])
self.attr = attribute(self.object['attribute_set'], 'semaphore') self.attr = attribute(self.object['attribute_set'], 'semaphore')
def show(self, from_tty): def show(self, from_tty):
print ' Name:', self.object_control.name() print ' Name:', self.object_control.name()
print ' Attr:', self.attr.to_string() print ' Attr:', self.attr.to_string()
@@ -202,7 +204,7 @@ class task:
self.id = id; self.id = id;
self.task = \ self.task = \
threads.control(objects.information.object(self.id).dereference()) threads.control(objects.information.object(self.id).dereference())
def show(self, from_tty): def show(self, from_tty):
print ' Name:', self.task.name() print ' Name:', self.task.name()
print ' State:', self.task.current_state() print ' State:', self.task.current_state()
@@ -213,4 +215,17 @@ class task:
print ' Preempt:', self.task.preemptible() print ' Preempt:', self.task.preemptible()
print ' T Budget:', self.task.cpu_time_budget() print ' T Budget:', self.task.cpu_time_budget()
wait_info = self.task.wait_info() wait_info = self.task.wait_info()
class message_queue:
"Print a classic messege queue"
def __init__(self,id):
self.id = id
self.object = objects.information.object(self.id).dereference()
self.object_control = objects.control(self.object['Object'])
self.attr = attribute(self.object['attribute_set'], \
'message_queue')
def show(self, from_tty):
print ' Name:', self.object_control.name()
print ' Attr:', self.attr.to_string()

View File

@@ -72,12 +72,13 @@ class rtems_object(gdb.Command):
objects = { objects = {
'classic/semaphores': lambda id: classic.semaphore(id), 'classic/semaphores': lambda id: classic.semaphore(id),
'classic/tasks': lambda id: classic.task(id) 'classic/tasks': lambda id: classic.task(id),
'classic/message_queues': lambda id: classic.message_queue(id)
} }
def __init__(self): def __init__(self):
self.__doc__ = 'Display the RTEMS object given a numeric ID.' self.__doc__ = 'Display the RTEMS object given a numeric ID.'
super(rtems_object, self).__init__('rtems object', super(rtems_object, self).__init__('rtems object',
gdb.COMMAND_STATUS) gdb.COMMAND_STATUS)
def invoke(self, arg, from_tty): def invoke(self, arg, from_tty):
@@ -98,7 +99,7 @@ class rtems_object(gdb.Command):
object = self.objects[objectname](id) object = self.objects[objectname](id)
object.show(from_tty) object.show(from_tty)
objects.information.invalidate() objects.information.invalidate()
# #
# Main # Main
# #
@@ -107,4 +108,4 @@ build_rtems_dict()
gdb.pretty_printers = [] gdb.pretty_printers = []
gdb.pretty_printers.append (lookup_function) gdb.pretty_printers.append (lookup_function)
rtems() rtems()
rtems_object() rtems_object()