From f814c7629cf5c87f0262ee877116166a02241c84 Mon Sep 17 00:00:00 2001 From: Dhananjay Balan Date: Mon, 8 Jul 2013 21:42:48 +0530 Subject: Messege Queue Objects Added intial support for printing --- tools/gdb/python/classic.py | 29 ++++++++++++++++++++++------- tools/gdb/python/rtems.py | 9 +++++---- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/tools/gdb/python/classic.py b/tools/gdb/python/classic.py index 8748bbf..99d6397 100644 --- a/tools/gdb/python/classic.py +++ b/tools/gdb/python/classic.py @@ -36,7 +36,9 @@ class attribute: 'semaphore-pri-ceiling'], 'barrier' : ['scope', 'priority', - 'barrier'] + 'barrier'], + 'message_queue' : ['priority', + 'scope'] } masks = { @@ -64,7 +66,7 @@ class attribute: (0x00000040, 'inherit-pri')], 'semaphore-pri-ceiling' : [(0x00000000, 'no-pri-ceiling'), (0x00000080, 'pri-ceiling')], - 'barrier' : [(0x00000010, 'barrier-auto-release'), + 'barrier' : [(0x00000010, 'barrier-auto-release'), (0x00000000, 'barrier-manual-release')], 'task' : [(0x00000000, 'app-task'), (0x00008000, 'sys-task')] @@ -97,7 +99,7 @@ class attribute: return False class attribute_printer: - + def __init__(self, attr): self.attr = attr @@ -124,7 +126,7 @@ class semaphore_printer: if self.count == 1: return self.semaphore['Object'] elif self.count == 2: - attr = attribute(self.semaphore['attribute_set'], + attr = attribute(self.semaphore['attribute_set'], 'semaphore') return attr.to_string() elif self.count == 3: @@ -162,7 +164,7 @@ class semaphore: self.object = objects.information.object(self.id).dereference() self.object_control = objects.control(self.object['Object']) self.attr = attribute(self.object['attribute_set'], 'semaphore') - + def show(self, from_tty): print ' Name:', self.object_control.name() print ' Attr:', self.attr.to_string() @@ -202,7 +204,7 @@ class task: self.id = id; self.task = \ threads.control(objects.information.object(self.id).dereference()) - + def show(self, from_tty): print ' Name:', self.task.name() print ' State:', self.task.current_state() @@ -213,4 +215,17 @@ class task: print ' Preempt:', self.task.preemptible() print ' T Budget:', self.task.cpu_time_budget() 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() diff --git a/tools/gdb/python/rtems.py b/tools/gdb/python/rtems.py index e227c6f..398f4e5 100644 --- a/tools/gdb/python/rtems.py +++ b/tools/gdb/python/rtems.py @@ -72,12 +72,13 @@ class rtems_object(gdb.Command): objects = { '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): 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) def invoke(self, arg, from_tty): @@ -98,7 +99,7 @@ class rtems_object(gdb.Command): object = self.objects[objectname](id) object.show(from_tty) objects.information.invalidate() - + # # Main # @@ -107,4 +108,4 @@ build_rtems_dict() gdb.pretty_printers = [] gdb.pretty_printers.append (lookup_function) rtems() -rtems_object() +rtems_object() \ No newline at end of file -- cgit v1.2.3