[rtems-tools commit] Add watchdog ticks command.

Chris Johns chrisj at rtems.org
Sun Aug 24 23:45:35 UTC 2014


Module:    rtems-tools
Branch:    master
Commit:    a7176a8a7e5542d9371026b135a864f15d79e1b5
Changeset: http://git.rtems.org/rtems-tools/commit/?id=a7176a8a7e5542d9371026b135a864f15d79e1b5

Author:    Dhananjay Balan <mb.dhananjay at gmail.com>
Date:      Sun Aug 25 23:21:44 2013 +0530

Add watchdog ticks command.
 - ToDo : Fix watchdog states.

---

 tools/gdb/python/chains.py   |    3 +++
 tools/gdb/python/main.py     |    3 ++-
 tools/gdb/python/rtems.py    |   35 +++++++++++++++++++++++++++++++++++
 tools/gdb/python/watchdog.py |   10 +++-------
 4 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/tools/gdb/python/chains.py b/tools/gdb/python/chains.py
index 0826ba9..ef33ed6 100644
--- a/tools/gdb/python/chains.py
+++ b/tools/gdb/python/chains.py
@@ -48,3 +48,6 @@ class control:
     def last(self):
         return node(self.ctrl['Tail']['Node'])
 
+    def empty(self):
+        if self.last() == self.first().next():
+            return True
diff --git a/tools/gdb/python/main.py b/tools/gdb/python/main.py
index 0ec4a28..a0ff7dc 100644
--- a/tools/gdb/python/main.py
+++ b/tools/gdb/python/main.py
@@ -17,4 +17,5 @@ rtems.rtems_object()
 rtems.rtems_semaphore()
 rtems.rtems_task()
 rtems.rtems_message_queue()
-rtems.rtems_tod()
\ No newline at end of file
+rtems.rtems_tod()
+rtems.rtems_wdt()
\ No newline at end of file
diff --git a/tools/gdb/python/rtems.py b/tools/gdb/python/rtems.py
index cf2000a..64c7f1a 100644
--- a/tools/gdb/python/rtems.py
+++ b/tools/gdb/python/rtems.py
@@ -10,6 +10,7 @@ import re
 
 import objects
 import threads
+import chains
 import supercore
 import classic
 
@@ -205,3 +206,37 @@ class rtems_tod(gdb.Command):
         instance = supercore.time_of_day(obj)
         instance.show()
         objects.information.invalidate()
+
+class rtems_watchdog_chain(gdb.Command):
+    '''Print watchdog ticks chain'''
+
+    api = 'internal'
+    _class = ''
+
+    def __init__(self,command):
+        super(rtems_watchdog_chain, self).__init__ \
+                                (command, gdb.COMMAND_DATA, gdb.COMPLETE_NONE)
+
+    def invoke(self, arg, from_tty):
+        obj = objects.information.object_return(self.api, self._class)
+
+        inst = chains.control(obj)
+
+        if inst.empty():
+            print '     error: empty chain'
+            return
+
+        nd = inst.first()
+        while not nd.null():
+            wd = watchdog.control(nd.cast('Watchdog_Control'))
+            wd.show()
+            nd = nd.next()
+
+class rtems_wdt(rtems_watchdog_chain):
+
+    _class = 'wdticks'
+
+    def __init__(self):
+        self.__doc__ = 'Display watchdog ticks chain'
+        super(rtems_wdt, self).__init__('rtems wdticks')
+
diff --git a/tools/gdb/python/watchdog.py b/tools/gdb/python/watchdog.py
index 3678550..fef2f39 100644
--- a/tools/gdb/python/watchdog.py
+++ b/tools/gdb/python/watchdog.py
@@ -12,11 +12,6 @@ import objects
 
 class state:
 
-    INACTIVE = 0
-    BEING_INSERTED = 1
-    ACTIVE = 2
-    REMOVE_IT = 3
-
     states = {
         0: 'inactive',
         1: 'being-inserted',
@@ -35,9 +30,10 @@ class control:
     def __init__(self, ctrl):
         self.ctrl = ctrl
 
-    # Not sure if an extra class is needed.
+    # ToDo: fix this.1
     def state(self):
-        return state(int(self.ctrl['state'])).to_string()
+        return state(1).to_string()
+        #return state(int(self.ctrl['state'])).to_string()
 
     def initial(self):
         return self.ctrl['initial']



More information about the vc mailing list