summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-09-17 15:18:25 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-09-17 15:18:25 +0000
commit707001a1dd7b734b04e1bcb6293c6a4a59bce03e (patch)
tree5ae121f7bf791b346c6089ec48f4f14763d1fc8b /contrib
parent729eee2e184550d3d94a8a964f265f5c4ce001cc (diff)
- fixes
Diffstat (limited to 'contrib')
-rw-r--r--contrib/gdb-iterate-dll.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/contrib/gdb-iterate-dll.py b/contrib/gdb-iterate-dll.py
index 728747363..2132b5e34 100644
--- a/contrib/gdb-iterate-dll.py
+++ b/contrib/gdb-iterate-dll.py
@@ -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 @@ def iterate_dll (head, field, match, pfield):
(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"]