GNUnet 0.21.1
gdb-iterate-dll Namespace Reference

Functions

def search_dll (head, field, match, pfield)
 

Function Documentation

◆ search_dll()

def gdb-iterate-dll.search_dll (   head,
  field,
  match,
  pfield 
)
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
match: the matching value for field
pfield: the field whose value is to be printed for matched elements; None to
  print all fields of the matched elemented

Definition at line 4 of file gdb-iterate-dll.py.

4def search_dll(head, field, match, pfield):
5 """
6 Search in a DLL by iterates over it.
7
8 head: name of the symbol denoting the head of the DLL
9 field: the field that should be search for match
10 match: the matching value for field
11 pfield: the field whose value is to be printed for matched elements; None to
12 print all fields of the matched elemented
13 """
14
15 (symbol, _) = lookup_symbol(head)
16 if symbol is None:
17 print("Can't find symbol: " + head)
18 return
19 symbol_val = symbol.value()
20 while symbol_val:
21 symbol_val_def = symbol_val.dereference()
22 field_val = symbol_val_def[field]
23 if field_val.type.code == gdb.TYPE_CODE_INT:
24 val = int(field_val)
25 res = (match == val)
26 elif (field_val.type.code == gdb.TYPE_CODE_STRING
27 ) or (field_val.type.code == gdb.TYPE_CODE_ARRAY):
28 val = str(field_val)
29 res = (match == val)
30 elif (field_val.type.code == gdb.TYPE_CODE_TYPEDEF):
31 val = str(field_val)
32 res = match in val
33 else:
34 continue
35
36 if res:
37 if pfield is None:
38 print(symbol_val_def)
39 else:
40 print(symbol_val_def[pfield])
41 symbol_val = symbol_val_def["next"]
def search_dll(head, field, match, pfield)

References consensus-simulation.int.