mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-17 06:37:43 +08:00
Refactor
- The objects are intialized using the objects rather than the ID.
This commit is contained in:

committed by
Chris Johns

parent
e60a5eec0b
commit
6d89e3c34e
@@ -108,9 +108,8 @@ class attribute:
|
|||||||
class semaphore:
|
class semaphore:
|
||||||
"Print a classic semaphore."
|
"Print a classic semaphore."
|
||||||
|
|
||||||
def __init__(self, id):
|
def __init__(self, obj):
|
||||||
self.id = id;
|
self.object = obj
|
||||||
self.object = objects.information.object(self.id).dereference()
|
|
||||||
self.object_control = objects.control(self.object['Object'])
|
self.object_control = objects.control(self.object['Object'])
|
||||||
self.attr = attribute(self.object['attribute_set'], 'semaphore')
|
self.attr = attribute(self.object['attribute_set'], 'semaphore')
|
||||||
|
|
||||||
@@ -149,10 +148,10 @@ class semaphore:
|
|||||||
class task:
|
class task:
|
||||||
"Print a classic task"
|
"Print a classic task"
|
||||||
|
|
||||||
def __init__(self, id):
|
def __init__(self, obj):
|
||||||
self.id = id;
|
self.object = obj
|
||||||
self.task = \
|
self.task = \
|
||||||
threads.control(objects.information.object(self.id).dereference())
|
threads.control(self.object)
|
||||||
self.wait_info = self.task.wait_info()
|
self.wait_info = self.task.wait_info()
|
||||||
|
|
||||||
def show(self, from_tty):
|
def show(self, from_tty):
|
||||||
@@ -167,9 +166,8 @@ class task:
|
|||||||
class message_queue:
|
class message_queue:
|
||||||
"Print classic messege queue"
|
"Print classic messege queue"
|
||||||
|
|
||||||
def __init__(self,id):
|
def __init__(self,obj):
|
||||||
self.id = id
|
self.object = obj
|
||||||
self.object = objects.information.object(self.id).dereference()
|
|
||||||
self.object_control = objects.control(self.object['Object'])
|
self.object_control = objects.control(self.object['Object'])
|
||||||
self.attr = attribute(self.object['attribute_set'], \
|
self.attr = attribute(self.object['attribute_set'], \
|
||||||
'message_queue')
|
'message_queue')
|
||||||
@@ -187,9 +185,8 @@ class message_queue:
|
|||||||
class timer:
|
class timer:
|
||||||
'''Print a classic timer'''
|
'''Print a classic timer'''
|
||||||
|
|
||||||
def __init__(self, id):
|
def __init__(self, obj):
|
||||||
self.id = id
|
self.object = obj
|
||||||
self.object = objects.information.object(self.id).dereference()
|
|
||||||
self.object_control = objects.control(self.object['Object'])
|
self.object_control = objects.control(self.object['Object'])
|
||||||
self.watchdog = watchdog.control(self.object['Ticker'])
|
self.watchdog = watchdog.control(self.object['Ticker'])
|
||||||
|
|
||||||
@@ -200,9 +197,8 @@ class timer:
|
|||||||
class partition:
|
class partition:
|
||||||
''' Print a rtems partition '''
|
''' Print a rtems partition '''
|
||||||
|
|
||||||
def __init__(self, id):
|
def __init__(self, obj):
|
||||||
self.id = id
|
self.object = obj
|
||||||
self.object = objects.information.object(self.id).dereference()
|
|
||||||
self.object_control = objects.control(self.object['Object'])
|
self.object_control = objects.control(self.object['Object'])
|
||||||
self.attr = attribute(self.object['attribute_set'], 'partition')
|
self.attr = attribute(self.object['attribute_set'], 'partition')
|
||||||
self.starting_addr = self.object['starting_address']
|
self.starting_addr = self.object['starting_address']
|
||||||
@@ -221,9 +217,8 @@ class partition:
|
|||||||
class region:
|
class region:
|
||||||
"prints a classic region"
|
"prints a classic region"
|
||||||
|
|
||||||
def __init__(self,id):
|
def __init__(self,obj):
|
||||||
self.id = id
|
self.object = obj
|
||||||
self.object = objects.information.object(self.id).dereference()
|
|
||||||
self.object_control = objects.control(self.object['Object'])
|
self.object_control = objects.control(self.object['Object'])
|
||||||
self.attr = attribute(self.object['attribute_set'], 'region')
|
self.attr = attribute(self.object['attribute_set'], 'region')
|
||||||
self.wait_queue = threads.queue(self.object['Wait_queue'])
|
self.wait_queue = threads.queue(self.object['Wait_queue'])
|
||||||
@@ -239,9 +234,8 @@ class region:
|
|||||||
class barrier:
|
class barrier:
|
||||||
'''classic barrier abstraction'''
|
'''classic barrier abstraction'''
|
||||||
|
|
||||||
def __init__(self,id):
|
def __init__(self,obj):
|
||||||
self.id = id
|
self.object = obj
|
||||||
self.object = objects.information.object(self.id).dereference()
|
|
||||||
self.object_control = objects.control(self.object['Object'])
|
self.object_control = objects.control(self.object['Object'])
|
||||||
self.attr = attribute(self.object['attribute_set'],'barrier')
|
self.attr = attribute(self.object['attribute_set'],'barrier')
|
||||||
self.core_b_control = supercore.barrier_control(self.object['Barrier'])
|
self.core_b_control = supercore.barrier_control(self.object['Barrier'])
|
||||||
|
@@ -75,13 +75,13 @@ class rtems_object(gdb.Command):
|
|||||||
"""Object sub-command for RTEMS"""
|
"""Object sub-command for RTEMS"""
|
||||||
|
|
||||||
objects = {
|
objects = {
|
||||||
'classic/semaphores': lambda id: classic.semaphore(id),
|
'classic/semaphores': lambda obj: classic.semaphore(obj),
|
||||||
'classic/tasks': lambda id: classic.task(id),
|
'classic/tasks': lambda obj: classic.task(obj),
|
||||||
'classic/message_queues': lambda id: classic.message_queue(id),
|
'classic/message_queues': lambda obj: classic.message_queue(obj),
|
||||||
'classic/timers' : lambda id: classic.timer(id),
|
'classic/timers' : lambda obj: classic.timer(obj),
|
||||||
'classic/partitions' : lambda id: classic.partition(id),
|
'classic/partitions' : lambda obj: classic.partition(obj),
|
||||||
'classic/regions' : lambda id: classic.region(id),
|
'classic/regions' : lambda obj: classic.region(obj),
|
||||||
'classic/barriers' : lambda id: classic.barrier(id)
|
'classic/barriers' : lambda obj: classic.barrier(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -103,8 +103,10 @@ class rtems_object(gdb.Command):
|
|||||||
print 'API:%s Class:%s Node:%d Index:%d Id:%08X' % \
|
print 'API:%s Class:%s Node:%d Index:%d Id:%08X' % \
|
||||||
(id.api(), id._class(), id.node(), id.index(), id.value())
|
(id.api(), id._class(), id.node(), id.index(), id.value())
|
||||||
objectname = id.api() + '/' + id._class()
|
objectname = id.api() + '/' + id._class()
|
||||||
|
|
||||||
|
obj = objects.information.object(id).dereference()
|
||||||
if objectname in self.objects:
|
if objectname in self.objects:
|
||||||
object = self.objects[objectname](id)
|
object = self.objects[objectname](obj)
|
||||||
object.show(from_tty)
|
object.show(from_tty)
|
||||||
objects.information.invalidate()
|
objects.information.invalidate()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user