gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r29349 - gnunet/contrib


From: gnunet
Subject: [GNUnet-SVN] r29349 - gnunet/contrib
Date: Tue, 17 Sep 2013 16:30:46 +0200

Author: harsha
Date: 2013-09-17 16:30:46 +0200 (Tue, 17 Sep 2013)
New Revision: 29349

Added:
   gnunet/contrib/gdb-iterate-dll.py
Log:
- gdb python code for DLL iteration


Added: gnunet/contrib/gdb-iterate-dll.py
===================================================================
--- gnunet/contrib/gdb-iterate-dll.py                           (rev 0)
+++ gnunet/contrib/gdb-iterate-dll.py   2013-09-17 14:30:46 UTC (rev 29349)
@@ -0,0 +1,27 @@
+from gdb import *
+
+def iterate_dll (head, field, match, pfield):
+    """
+    Iterates over a DLL data structure
+
+    head: name of the symbol denoting the head of the DLL
+    field: the field that should be search for match
+    match: the mathing value for field
+    pfield: the field whose value is to be printed for matched elements; None 
to
+      print all fields of the matched elemented
+    """
+
+    (symbol, _) = lookup_symbol (head)
+    if symbol is None:
+        print "Can't find symbol: " + head
+        return    
+    while not symbol:
+        symbol_val = symbol.value().derefence
+        if match == symbol_val[field]:
+            if pfield is None:
+                print symbol_val
+            else:
+                print symbol_val[pfield]
+        symbol = symbol_val["next"]
+
+    




reply via email to

[Prev in Thread] Current Thread [Next in Thread]