3 def search_dll (head, field, match, pfield):
5 Search in a DLL by iterates over it.
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
18 symbol_val = symbol.value()
20 symbol_val_def = symbol_val.dereference()
21 field_val = symbol_val_def[field]
22 if field_val.type.code == gdb.TYPE_CODE_INT:
25 elif (field_val.type.code == gdb.TYPE_CODE_STRING) or (field_val.type.code == gdb.TYPE_CODE_ARRAY):
28 elif (field_val.type.code == gdb.TYPE_CODE_TYPEDEF):
38 print symbol_val_def[pfield]
39 symbol_val = symbol_val_def["next"]