summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhananjay Balan <mb.dhananjay@gmail.com>2013-08-01 12:20:23 +0530
committerChris Johns <chrisj@rtems.org>2014-08-25 09:52:40 +1000
commit6d89e3c34e68e61013abb39ff058bc5715eaa455 (patch)
tree66f72a1a1dbf8f8eebef9890e98836eed2eac773
parente60a5eec0b1e8b16d984e4baf7dccb3323b88928 (diff)
Refactor
- The objects are intialized using the objects rather than the ID.
-rw-r--r--tools/gdb/python/classic.py36
-rw-r--r--tools/gdb/python/rtems.py18
2 files changed, 25 insertions, 29 deletions
diff --git a/tools/gdb/python/classic.py b/tools/gdb/python/classic.py
index 50514ff..29ffab5 100644
--- a/tools/gdb/python/classic.py
+++ b/tools/gdb/python/classic.py
@@ -108,9 +108,8 @@ class attribute:
class semaphore:
"Print a classic semaphore."
- def __init__(self, id):
- self.id = id;
- self.object = objects.information.object(self.id).dereference()
+ def __init__(self, obj):
+ self.object = obj
self.object_control = objects.control(self.object['Object'])
self.attr = attribute(self.object['attribute_set'], 'semaphore')
@@ -149,10 +148,10 @@ class semaphore:
class task:
"Print a classic task"
- def __init__(self, id):
- self.id = id;
+ def __init__(self, obj):
+ self.object = obj
self.task = \
- threads.control(objects.information.object(self.id).dereference())
+ threads.control(self.object)
self.wait_info = self.task.wait_info()
def show(self, from_tty):
@@ -167,9 +166,8 @@ class task:
class message_queue:
"Print classic messege queue"
- def __init__(self,id):
- self.id = id
- self.object = objects.information.object(self.id).dereference()
+ def __init__(self,obj):
+ self.object = obj
self.object_control = objects.control(self.object['Object'])
self.attr = attribute(self.object['attribute_set'], \
'message_queue')
@@ -187,9 +185,8 @@ class message_queue:
class timer:
'''Print a classic timer'''
- def __init__(self, id):
- self.id = id
- self.object = objects.information.object(self.id).dereference()
+ def __init__(self, obj):
+ self.object = obj
self.object_control = objects.control(self.object['Object'])
self.watchdog = watchdog.control(self.object['Ticker'])
@@ -200,9 +197,8 @@ class timer:
class partition:
''' Print a rtems partition '''
- def __init__(self, id):
- self.id = id
- self.object = objects.information.object(self.id).dereference()
+ def __init__(self, obj):
+ self.object = obj
self.object_control = objects.control(self.object['Object'])
self.attr = attribute(self.object['attribute_set'], 'partition')
self.starting_addr = self.object['starting_address']
@@ -221,9 +217,8 @@ class partition:
class region:
"prints a classic region"
- def __init__(self,id):
- self.id = id
- self.object = objects.information.object(self.id).dereference()
+ def __init__(self,obj):
+ self.object = obj
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'])
@@ -239,9 +234,8 @@ class region:
class barrier:
'''classic barrier abstraction'''
- def __init__(self,id):
- self.id = id
- self.object = objects.information.object(self.id).dereference()
+ def __init__(self,obj):
+ self.object = obj
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'])
diff --git a/tools/gdb/python/rtems.py b/tools/gdb/python/rtems.py
index adab86d..b2dc776 100644
--- a/tools/gdb/python/rtems.py
+++ b/tools/gdb/python/rtems.py
@@ -75,13 +75,13 @@ class rtems_object(gdb.Command):
"""Object sub-command for RTEMS"""
objects = {
- '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/partitions' : lambda id: classic.partition(id),
- 'classic/regions' : lambda id: classic.region(id),
- 'classic/barriers' : lambda id: classic.barrier(id)
+ 'classic/semaphores': lambda obj: classic.semaphore(obj),
+ 'classic/tasks': lambda obj: classic.task(obj),
+ 'classic/message_queues': lambda obj: classic.message_queue(obj),
+ 'classic/timers' : lambda obj: classic.timer(obj),
+ 'classic/partitions' : lambda obj: classic.partition(obj),
+ 'classic/regions' : lambda obj: classic.region(obj),
+ 'classic/barriers' : lambda obj: classic.barrier(obj)
}
def __init__(self):
@@ -103,8 +103,10 @@ class rtems_object(gdb.Command):
print 'API:%s Class:%s Node:%d Index:%d Id:%08X' % \
(id.api(), id._class(), id.node(), id.index(), id.value())
objectname = id.api() + '/' + id._class()
+
+ obj = objects.information.object(id).dereference()
if objectname in self.objects:
- object = self.objects[objectname](id)
+ object = self.objects[objectname](obj)
object.show(from_tty)
objects.information.invalidate()