From 86bfb1ddbff2bd7b45d9927b24e50f5afb063feb Mon Sep 17 00:00:00 2001 From: Sree Harsha Totakura Date: Tue, 17 Sep 2013 14:30:46 +0000 Subject: - gdb python code for DLL iteration --- contrib/gdb-iterate-dll.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 contrib/gdb-iterate-dll.py (limited to 'contrib') 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 @@ +from gdb import * + +def iterate_dll (head, field, match, pfield): + """ + Iterates over a DLL data structure + + head: name of the symbol denoting the head of the DLL + field: the field that should be search for match + match: the mathing value for field + pfield: the field whose value is to be printed for matched elements; None to + print all fields of the matched elemented + """ + + (symbol, _) = lookup_symbol (head) + if symbol is None: + print "Can't find symbol: " + head + return + while not symbol: + symbol_val = symbol.value().derefence + if match == symbol_val[field]: + if pfield is None: + print symbol_val + else: + print symbol_val[pfield] + symbol = symbol_val["next"] + + -- cgit v1.2.3