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

4.104.115
Last change on this file since 4dbd0db was a7176a8, checked in by Dhananjay Balan <mb.dhananjay@…>, on 08/25/13 at 17:33:44

Add watchdog ticks command.

  • ToDo? : Fix watchdog states.
  • Property mode set to 100644
File size: 1.1 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
51    def empty(self):
52        if self.last() == self.first().next():
53            return True
Note: See TracBrowser for help on using the repository browser.