gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29352 - gnunet/contrib


From: gnunet
Subject: [GNUnet-SVN] r29352 - gnunet/contrib
Date: Tue, 17 Sep 2013 17:18:25 +0200

Author: harsha
Date: 2013-09-17 17:18:25 +0200 (Tue, 17 Sep 2013)
New Revision: 29352

Modified:
   gnunet/contrib/gdb-iterate-dll.py
Log:
- fixes


Modified: gnunet/contrib/gdb-iterate-dll.py
===================================================================
--- gnunet/contrib/gdb-iterate-dll.py   2013-09-17 14:51:41 UTC (rev 29351)
+++ gnunet/contrib/gdb-iterate-dll.py   2013-09-17 15:18:25 UTC (rev 29352)
@@ -1,8 +1,8 @@
 from gdb import *
 
-def iterate_dll (head, field, match, pfield):
+def search_dll (head, field, match, pfield):
     """
-    Iterates over a DLL data structure
+    Search in a DLL by iterates over it.
 
     head: name of the symbol denoting the head of the DLL
     field: the field that should be search for match
@@ -14,26 +14,28 @@
     (symbol, _) = lookup_symbol (head)
     if symbol is None:
         print "Can't find symbol: " + head
-        return    
-    while symbol:
-        symbol_val = symbol.value().derefence
-        field_val = symbol_val[field]
+        return
+    symbol_val = symbol.value()
+    while symbol_val:
+        symbol_val_def = symbol_val.dereference()
+        field_val = symbol_val_def[field]
         if field_val.type.code == gdb.TYPE_CODE_INT:
             val = int(field_val)
             res = (match == val)
-        if (field_val.type.code == gdb.TYPE_CODE_STRING)
-           or (filed_val.type.code == gdb.TYPE_CODE_ARRAY):
+        elif (field_val.type.code == gdb.TYPE_CODE_STRING) or 
(field_val.type.code == gdb.TYPE_CODE_ARRAY):
             val = str (field_val)
             res = (match == val)
-        if (field_val.type.code == gdb.TYPE_CODE_TYPEDEF):
+        elif (field_val.type.code == gdb.TYPE_CODE_TYPEDEF):
             val = str (field_val)
             res = match in val
+        else:
+            continue
 
         if res:
             if pfield is None:
-                print symbol_val
+                print symbol_val_def
             else:
-                print symbol_val[pfield]
-        symbol = symbol_val["next"]
+                print symbol_val_def[pfield]
+        symbol_val = symbol_val_def["next"]
 
     




reply via email to

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