source: rtems-tools/tools/gdb/python/chains.py @ 10bcd5d

4.104.115
Last change on this file since 10bcd5d was 10bcd5d, checked in by Dhananjay Balan <mb.dhananjay@…>, on 06/24/13 at 04:10:59

Update chains structures

  • Fixes chains structure parsing
  • Fix Semaphore node parsing
  • Property mode set to 100644
File size: 941 bytes
Line 
1#
2# RTEMS Chains Support
3# Copyright 2010 Chris Johns (chrisj@rtems.org)
4#
5# $Id$
6#
7
8import gdb
9
10class node:
11    """Manage the Chain_Node."""
12
13    def __init__(self, node_val):
14        self.node_val = node_val
15
16    def null(self):
17        if not self.node_val:
18            return True
19        return False
20
21    def next(self):
22        if not self.null():
23            self.node_val = self.node_val['next']
24
25    def previous(self):
26        if not self.null():
27            self.node_val = self.node_val['previous']
28
29    def cast(self, typename):
30        if not self.null():
31            nodetype = gdb.lookup_type(typename)
32            return self.node_val.cast(nodetype)
33        return None
34
35
36class control:
37    """Manage the Chain_Control."""
38
39    def __init__(self, ctrl):
40        self.ctrl = ctrl
41
42    def first(self):
43        t = node(self.ctrl['Head']['Node'])
44        return t
45
46    def last(self):
47        return node(self.ctrl['first'])
Note: See TracBrowser for help on using the repository browser.