3 def iterate_dll (head, field, match, pfield):
5 Iterates over a DLL data structure
7 head: name of the symbol denoting the head of the DLL
8 field: the field that should be search for match
9 match: the mathing value for field
10 pfield: the field whose value is to be printed for matched elements; None to
11 print all fields of the matched elemented
14 (symbol, _) = lookup_symbol (head)
16 print "Can't find symbol: " + head
19 symbol_val = symbol.value().derefence
20 field_val = symbol_val[field]
21 if field_val.type.code == gdb.TYPE_CODE_INT:
24 if (field_val.type.code == gdb.TYPE_CODE_STRING)
25 or (filed_val.type.code == gdb.TYPE_CODE_ARRAY):
28 if (field_val.type.code == gdb.TYPE_CODE_TYPEDEF):
36 print symbol_val[pfield]
37 symbol = symbol_val["next"]