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

4.104.11
Last change on this file since b061a67 was b061a67, checked in by Dhananjay Balan <mb.dhananjay@…>, on Jul 12, 2013 at 1:34:37 PM

Heavy refactoring + Improved mesege queu printing.

  • pretty printers moved to the corresponding api_printer module
  • object abstractions moved to
    • their own name for core modules
    • supercore for other supercore objects
    • classic for classic api objects
  • Property mode set to 100644
File size: 1.0 KB
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    def to_string(self):
36        return self.node_val['next'] + "Prev: "+self.node_val['previous']
37
38class control:
39    """Manage the Chain_Control."""
40
41    def __init__(self, ctrl):
42        self.ctrl = ctrl
43
44    def first(self):
45        t = node(self.ctrl['Head']['Node'])
46        return t
47
48    def last(self):
49        return node(self.ctrl['Tail']['Node'])
50
Note: See TracBrowser for help on using the repository browser.