Add region support.

Abstractions for classic/region added.
This commit is contained in:
Dhananjay Balan
2013-07-28 14:45:58 +05:30
committed by Chris Johns
parent c3d06d531c
commit b9ee5df588
6 changed files with 54 additions and 10 deletions

View File

@@ -8,10 +8,13 @@
import gdb
import itertools
import re
#ToDo This shouldn't be here
import helper
import objects
import threads
import watchdog
import heaps
import supercore
class attribute:
@@ -41,7 +44,8 @@ class attribute:
'barrier'],
'message_queue' : ['priority',
'scope'],
'partition' : ['scope']
'partition' : ['scope'],
'region' : ['priority']
}
masks = {
@@ -214,6 +218,23 @@ class partition:
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
print ' B Size:', self.buffer_size
print ' U Blocks:', self.used_blocks
class region:
"prints a classic region"
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'], 'region')
self.wait_queue = threads.queue(self.object['Wait_queue'])
self.heap = heaps.control(self.object['Memory'])
def show(self, from_tty):
print ' Name:', self.object_control.name()
print ' Attr:', self.attr.to_string()
helper.tasks_printer_routine(self.wait_queue)
print ' Memory:'
self.heap.show()

View File

@@ -15,6 +15,8 @@ class block:
return False
return True
def val(self):
return str(self.block)
def next(self):
if not self.null():
@@ -25,11 +27,15 @@ class block:
self.block = self.block['prev']
class stats:
''heap statistics''
'''heap statistics'''
def __init__(self,stat):
self.stat = stat
def inst(self):
i = self.stat['instance']
return i
def avail(self):
val = self.stat['size']
return val
@@ -37,9 +43,14 @@ class stats:
def free(self):
return self.stat['free_size']
def show(self):
print ' Instance:',self.inst()
print ' Avail:',self.avail()
print ' Free:',self.free()
# ToDo : incorporate others
def control:
class control:
'''Abstract a heap control structure'''
def __init__(self, ctl):
@@ -59,4 +70,15 @@ def control:
def stat(self):
st = stats(self.ctl['stats'])
return st
return st
def show(self):
fi = self.first()
la = self.last()
print ' First:', fi.val()
print ' Last:', la.val()
stats = self.stat()
print ' stats:'
stats.show()

View File

@@ -1,7 +1,7 @@
#
# RTEMS GDB support helper routins.
def tasks_printer_rotuine(wait_queue):
def tasks_printer_routine(wait_queue):
tasks = wait_queue.tasks()
print ' Queue: len = %d, state = %s' % (len(tasks),wait_queue.state())
for t in range(0, len(tasks)):

View File

@@ -18,7 +18,7 @@ class infotables:
'classic/semaphores' : ('Semaphore_Control', '_Semaphore_Information'),
'classic/message_queues' : ('Message_queue_Control', '_Message_queue_Information'),
'classic/partitions' : ('Partition_Control', '_Partition_Information'),
'classic/regions' : ('Region_Control', '_Regions_Information'),
'classic/regions' : ('Region_Control', '_Region_Information'),
'classic/ports' : ('Port_Control', '_Port_Information'),
'classic/periods' : ('Period_Control', '_Period_Information'),
'classic/extensions' : ('Extension_Control', '_Extension_Information'),

View File

@@ -79,7 +79,8 @@ class rtems_object(gdb.Command):
'classic/tasks': lambda id: classic.task(id),
'classic/message_queues': lambda id: classic.message_queue(id),
'classic/timers' : lambda id: classic.timer(id),
'classic/partitions' : lambda id: classic.partition(id)
'classic/partitions' : lambda id: classic.partition(id),
'classic/regions' : lambda id: classic.region(id)
}
def __init__(self):

View File

@@ -15,4 +15,4 @@ class CORE_message_queue:
# self.buffer
def show(self):
helper.tasks_printer_rotuine(self.wait_queue)
helper.tasks_printer_routine(self.wait_queue)