mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-16 16:33:04 +08:00
Update chains structures
- Fixes chains structure parsing - Fix Semaphore node parsing
This commit is contained in:

committed by
Chris Johns

parent
56a70aec55
commit
10bcd5d4dc
@@ -14,15 +14,17 @@ class node:
|
|||||||
self.node_val = node_val
|
self.node_val = node_val
|
||||||
|
|
||||||
def null(self):
|
def null(self):
|
||||||
return self.node_val['next'] == 0
|
if not self.node_val:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
if not self.null():
|
if not self.null():
|
||||||
self.node_val = self.node_val['next'].dereference()
|
self.node_val = self.node_val['next']
|
||||||
|
|
||||||
def previous(self):
|
def previous(self):
|
||||||
if not self.null():
|
if not self.null():
|
||||||
self.node_val = self.node_val['previous'].dereference()
|
self.node_val = self.node_val['previous']
|
||||||
|
|
||||||
def cast(self, typename):
|
def cast(self, typename):
|
||||||
if not self.null():
|
if not self.null():
|
||||||
@@ -30,6 +32,7 @@ class node:
|
|||||||
return self.node_val.cast(nodetype)
|
return self.node_val.cast(nodetype)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class control:
|
class control:
|
||||||
"""Manage the Chain_Control."""
|
"""Manage the Chain_Control."""
|
||||||
|
|
||||||
@@ -37,7 +40,8 @@ class control:
|
|||||||
self.ctrl = ctrl
|
self.ctrl = ctrl
|
||||||
|
|
||||||
def first(self):
|
def first(self):
|
||||||
return node(self.ctrl['first'].dereference())
|
t = node(self.ctrl['Head']['Node'])
|
||||||
|
return t
|
||||||
|
|
||||||
def last(self):
|
def last(self):
|
||||||
return node(self.ctrl['first'])
|
return node(self.ctrl['first'])
|
||||||
|
@@ -62,6 +62,9 @@ class infotables:
|
|||||||
api = id.api()
|
api = id.api()
|
||||||
_class = id._class()
|
_class = id._class()
|
||||||
index = id.index()
|
index = id.index()
|
||||||
|
return self.object_return(api, _class, index)
|
||||||
|
|
||||||
|
def object_return(self, api, _class, index):
|
||||||
n = self.name(api, _class)
|
n = self.name(api, _class)
|
||||||
self.load(n)
|
self.load(n)
|
||||||
max = self.maximum(api, _class)
|
max = self.maximum(api, _class)
|
||||||
@@ -96,7 +99,7 @@ class ident:
|
|||||||
{ 'index': (0, 15),
|
{ 'index': (0, 15),
|
||||||
'node': (16, 23),
|
'node': (16, 23),
|
||||||
'api': (24, 26),
|
'api': (24, 26),
|
||||||
'class': (27, 31) }
|
'class': (27, 31) }
|
||||||
]
|
]
|
||||||
|
|
||||||
OBJECT_16_BITS = 0
|
OBJECT_16_BITS = 0
|
||||||
@@ -147,7 +150,7 @@ class ident:
|
|||||||
'variable_memory_pools',
|
'variable_memory_pools',
|
||||||
'fixed_memory_pools')
|
'fixed_memory_pools')
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, id):
|
def __init__(self, id):
|
||||||
if type(id) != gdb.Value and type(id) != int and type(id) != unicode:
|
if type(id) != gdb.Value and type(id) != int and type(id) != unicode:
|
||||||
raise TypeError('%s: must be gdb.Value, int, unicoded int' % (type(id)))
|
raise TypeError('%s: must be gdb.Value, int, unicoded int' % (type(id)))
|
||||||
|
@@ -14,7 +14,6 @@ def task_chain(chain):
|
|||||||
tasks = []
|
tasks = []
|
||||||
node = chain.first()
|
node = chain.first()
|
||||||
while not node.null():
|
while not node.null():
|
||||||
print node.addr
|
|
||||||
tasks.append(control(node.cast('Thread_Control')))
|
tasks.append(control(node.cast('Thread_Control')))
|
||||||
node.next()
|
node.next()
|
||||||
return tasks
|
return tasks
|
||||||
@@ -62,7 +61,7 @@ class state:
|
|||||||
WAITING_FOR_EVENT | \
|
WAITING_FOR_EVENT | \
|
||||||
WAITING_ON_THREAD_QUEUE | \
|
WAITING_ON_THREAD_QUEUE | \
|
||||||
INTERRUPTIBLE_BY_SIGNAL
|
INTERRUPTIBLE_BY_SIGNAL
|
||||||
|
|
||||||
masks = {
|
masks = {
|
||||||
ALL_SET : 'all-set',
|
ALL_SET : 'all-set',
|
||||||
READY : 'ready',
|
READY : 'ready',
|
||||||
@@ -85,7 +84,7 @@ class state:
|
|||||||
WAITING_FOR_BARRIER : 'waiting-for-barrier',
|
WAITING_FOR_BARRIER : 'waiting-for-barrier',
|
||||||
WAITING_FOR_RWLOCK : 'waiting-for-rwlock'
|
WAITING_FOR_RWLOCK : 'waiting-for-rwlock'
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, s):
|
def __init__(self, s):
|
||||||
self.s = s
|
self.s = s
|
||||||
|
|
||||||
@@ -121,16 +120,16 @@ class wait_info:
|
|||||||
|
|
||||||
def block2n(self):
|
def block2n(self):
|
||||||
return task_chain(chains.control(self.info['Block2n']))
|
return task_chain(chains.control(self.info['Block2n']))
|
||||||
|
|
||||||
def queue(self):
|
def queue(self):
|
||||||
return task_chain(chains.control(self.info['queue']))
|
return task_chain(chains.control(self.info['queue']))
|
||||||
|
|
||||||
class control:
|
class control:
|
||||||
|
|
||||||
def __init__(self, ctrl):
|
def __init__(self, ctrl):
|
||||||
self.ctrl = ctrl
|
self.ctrl = ctrl
|
||||||
self.object = objects.control(ctrl['Object'])
|
self.object = objects.control(ctrl['Object'])
|
||||||
|
|
||||||
def id(self):
|
def id(self):
|
||||||
return self.object.id()
|
return self.object.id()
|
||||||
|
|
||||||
@@ -181,14 +180,15 @@ class queue:
|
|||||||
|
|
||||||
def state(self):
|
def state(self):
|
||||||
return state(self.que['state']).to_string()
|
return state(self.que['state']).to_string()
|
||||||
|
|
||||||
def tasks(self):
|
def tasks(self):
|
||||||
if self.fifo():
|
if self.fifo():
|
||||||
t = task_chain(chains.control(self.que['Queues']['Fifo']))
|
t = task_chain(chains.control(self.que['Queues']['Fifo']))
|
||||||
else:
|
else:
|
||||||
t = []
|
t = []
|
||||||
for ph in range(0, self.priority_headers):
|
for ph in range(0, self.priority_headers):
|
||||||
t.extend(task_chain(chains.control(self.que['Queues']['Fifo'])))
|
t.extend(task_chain(chains.control( \
|
||||||
|
self.que['Queues']['Priority'][ph])))
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def to_string(self):
|
def to_string(self):
|
||||||
|
Reference in New Issue
Block a user