aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/gdb-iterate-dll.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/gdb-iterate-dll.py b/contrib/gdb-iterate-dll.py
new file mode 100644
index 000000000..23b4b5fc7
--- /dev/null
+++ b/contrib/gdb-iterate-dll.py
@@ -0,0 +1,27 @@
1from gdb import *
2
3def iterate_dll (head, field, match, pfield):
4 """
5 Iterates over a DLL data structure
6
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
12 """
13
14 (symbol, _) = lookup_symbol (head)
15 if symbol is None:
16 print "Can't find symbol: " + head
17 return
18 while not symbol:
19 symbol_val = symbol.value().derefence
20 if match == symbol_val[field]:
21 if pfield is None:
22 print symbol_val
23 else:
24 print symbol_val[pfield]
25 symbol = symbol_val["next"]
26
27