summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhananjay Balan <mb.dhananjay@gmail.com>2013-07-29 10:25:38 +0530
committerChris Johns <chrisj@rtems.org>2014-08-25 09:52:40 +1000
commit8e0de06b2bc6fecf8e055361590176698d0a648b (patch)
tree48da111ac76bc7a8e985e4401fb6e257fde8abda
parentc63080ddb2231ca0577514e393f4e793f1819d19 (diff)
Add classic barrier.
- Add support for classic barrier object. - Drop CORE_ from names in supercore
-rw-r--r--tools/gdb/python/classic.py30
-rw-r--r--tools/gdb/python/rtems.py3
-rw-r--r--tools/gdb/python/supercore.py37
3 files changed, 63 insertions, 7 deletions
diff --git a/tools/gdb/python/classic.py b/tools/gdb/python/classic.py
index e2ecfaa..617a0db 100644
--- a/tools/gdb/python/classic.py
+++ b/tools/gdb/python/classic.py
@@ -39,9 +39,7 @@ class attribute:
'semaphore-type',
'semaphore-pri',
'semaphore-pri-ceiling'],
- 'barrier' : ['scope',
- 'priority',
- 'barrier'],
+ 'barrier' : ['barrier'],
'message_queue' : ['priority',
'scope'],
'partition' : ['scope'],
@@ -149,7 +147,7 @@ class semaphore:
print 'semaphore'
class task:
- "Print a classic tasks."
+ "Print a classic task"
def __init__(self, id):
self.id = id;
@@ -179,7 +177,7 @@ class message_queue:
self.wait_queue = threads.queue( \
self.object['message_queue']['Wait_queue'])
- self.core_control = supercore.CORE_message_queue(self.object['message_queue'])
+ self.core_control = supercore.message_queue(self.object['message_queue'])
def show(self, from_tty):
print ' Name:', self.object_control.name()
@@ -238,3 +236,25 @@ class region:
helper.tasks_printer_routine(self.wait_queue)
print ' Memory:'
self.heap.show()
+
+class barrier:
+ '''classic barrier abstraction'''
+
+ 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'],'barrier')
+ self.core_b_control = supercore.barrier_control(self.object['Barrier'])
+
+ def show(self,from_tty):
+ print ' Name:',self.object_control.name()
+ print ' Attr:',self.attr.to_string()
+
+ if self.attr.test('barrier','barrier-auto-release'):
+ max_count = self.core_b_control.max_count()
+ print 'Aut Count:', max_count
+
+ print ' Waiting:',self.core_b_control.waiting_threads()
+ helper.tasks_printer_routine(self.core_b_control.tasks())
+
diff --git a/tools/gdb/python/rtems.py b/tools/gdb/python/rtems.py
index 8738736..adab86d 100644
--- a/tools/gdb/python/rtems.py
+++ b/tools/gdb/python/rtems.py
@@ -80,7 +80,8 @@ class rtems_object(gdb.Command):
'classic/message_queues': lambda id: classic.message_queue(id),
'classic/timers' : lambda id: classic.timer(id),
'classic/partitions' : lambda id: classic.partition(id),
- 'classic/regions' : lambda id: classic.region(id)
+ 'classic/regions' : lambda id: classic.region(id),
+ 'classic/barriers' : lambda id: classic.barrier(id)
}
def __init__(self):
diff --git a/tools/gdb/python/supercore.py b/tools/gdb/python/supercore.py
index 073bbd0..e60813a 100644
--- a/tools/gdb/python/supercore.py
+++ b/tools/gdb/python/supercore.py
@@ -5,7 +5,7 @@
import threads
import helper
-class CORE_message_queue:
+class message_queue:
'''Manage a Supercore message_queue'''
def __init__(self, message_queue):
@@ -16,3 +16,38 @@ class CORE_message_queue:
def show(self):
helper.tasks_printer_routine(self.wait_queue)
+
+class barrier_attributes:
+ '''supercore bbarrier attribute'''
+
+ def __init__(self,attr):
+ self.attr = attr
+
+ def max_count(self):
+ c = self.attr['maximum_count']
+ return c
+
+ def discipline(self):
+ d = self.attr['discipline']
+ return d
+
+class barrier_control:
+ '''Manage a Supercore barrier'''
+
+ def __init__(self, barrier):
+ self.barrier = barrier
+ self.wait_queue = threads.queue(self.barrier['Wait_queue'])
+ self.attr = barrier_attributes(self.barrier['Attributes'])
+
+ def waiting_threads(self):
+ wt = self.barrier['number_of_waiting_threads']
+ return wt
+
+ def max_count(self):
+ return self.attr.max_count()
+
+ def discipline(self):
+ return self.attr.discipline()
+
+ def tasks(self):
+ return self.wait_queue