summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-09-17 14:30:46 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-09-17 14:30:46 +0000
commit86bfb1ddbff2bd7b45d9927b24e50f5afb063feb (patch)
treef8e4a1abc47dd4987215b2c8277840fbda8a3597 /contrib
parent0ac8167bf788134f942c72e0deea6f22af382e87 (diff)
- gdb python code for DLL iteration
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 @@
+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"]
+
+