From 09086b415db7bb08cca41fc3fff212bbaece327a Mon Sep 17 00:00:00 2001 From: Dhananjay Balan Date: Sat, 27 Jul 2013 14:11:19 +0530 Subject: Support classic/partitions Added support for partition object. --- tools/gdb/python/classic.py | 29 ++++++++++++++++++++++++++--- tools/gdb/python/classic_printer.py | 4 +++- tools/gdb/python/rtems.py | 3 ++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/tools/gdb/python/classic.py b/tools/gdb/python/classic.py index 1f5daf2..f7d4dfc 100644 --- a/tools/gdb/python/classic.py +++ b/tools/gdb/python/classic.py @@ -40,7 +40,8 @@ class attribute: 'priority', 'barrier'], 'message_queue' : ['priority', - 'scope'] + 'scope'], + 'partition' : ['scope'] } masks = { @@ -163,7 +164,7 @@ class task: wait_info = self.task.wait_info() class message_queue: - "Print a classic messege queue" + "Print classic messege queue" def __init__(self,id): self.id = id @@ -193,4 +194,26 @@ class timer: def show(self, from_tty): print ' Name:', self.object_control.name() - self.watchdog.show() \ No newline at end of file + self.watchdog.show() + +class partition: + ''' Print a rtems partition ''' + + 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'], 'partition') + self.starting_addr = self.object['starting_address'] + self.length = self.object['length'] + self.buffer_size = self.object['buffer_size'] + self.used_blocks = self.object['number_of_used_blocks'] + + def show(self, from_tty): + # ToDo: the printing still somewhat crude. + print ' Name:', self.object_control.name() + print ' Attr:', self.attr.to_string() + print ' Length:', self.length + print 'Buffer Size:', self.buffer_size + print 'Used Blocks:', self.used_blocks + diff --git a/tools/gdb/python/classic_printer.py b/tools/gdb/python/classic_printer.py index a25d756..86e0eeb 100644 --- a/tools/gdb/python/classic_printer.py +++ b/tools/gdb/python/classic_printer.py @@ -1,6 +1,8 @@ # # RTEMS Classic pretty printers for GDB # +import classic +import gdb class attribute: @@ -12,7 +14,7 @@ class attribute: return gdb.Value(self.attr.to_string()) class semaphore: - """ToDo: Print a Semaphore_Control object. Print using the struct display hint + """Print a Semaphore_Control object. Print using the struct display hint and an iterator. """ class iterator: diff --git a/tools/gdb/python/rtems.py b/tools/gdb/python/rtems.py index bd2d8e4..eac5042 100644 --- a/tools/gdb/python/rtems.py +++ b/tools/gdb/python/rtems.py @@ -78,7 +78,8 @@ class rtems_object(gdb.Command): 'classic/semaphores': lambda id: classic.semaphore(id), 'classic/tasks': lambda id: classic.task(id), 'classic/message_queues': lambda id: classic.message_queue(id), - 'classic/timers' : lambda id: classic.timer(id) + 'classic/timers' : lambda id: classic.timer(id), + 'classic/partitions' : lambda id: classic.partition(id) } def __init__(self): -- cgit v1.2.3