projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
-fix off-by-1
[oweals/gnunet.git]
/
contrib
/
gdb-iterate-dll.py
diff --git
a/contrib/gdb-iterate-dll.py
b/contrib/gdb-iterate-dll.py
index 728747363306fdc97738f943a030114bd8ab8302..2132b5e345f363f2107c14ce079e33ea533057b7 100644
(file)
--- a/
contrib/gdb-iterate-dll.py
+++ b/
contrib/gdb-iterate-dll.py
@@
-1,8
+1,8
@@
from gdb import *
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
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
(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_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)
val = str (field_val)
res = (match == val)
- if (field_val.type.code == gdb.TYPE_CODE_TYPEDEF):
+
el
if (field_val.type.code == gdb.TYPE_CODE_TYPEDEF):
val = str (field_val)
res = match in val
val = str (field_val)
res = match in val
+ else:
+ continue
if res:
if pfield is None:
if res:
if pfield is None:
- print symbol_val
+ print symbol_val
_def
else:
else:
- print symbol_val[pfield]
- symbol
= symbol_val
["next"]
+ print symbol_val
_def
[pfield]
+ symbol
_val = symbol_val_def
["next"]