diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-09-17 14:30:46 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-09-17 14:30:46 +0000 |
commit | 86bfb1ddbff2bd7b45d9927b24e50f5afb063feb (patch) | |
tree | f8e4a1abc47dd4987215b2c8277840fbda8a3597 /contrib | |
parent | 0ac8167bf788134f942c72e0deea6f22af382e87 (diff) | |
download | gnunet-86bfb1ddbff2bd7b45d9927b24e50f5afb063feb.tar.gz gnunet-86bfb1ddbff2bd7b45d9927b24e50f5afb063feb.zip |
- gdb python code for DLL iteration
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/gdb-iterate-dll.py | 27 |
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 @@ | |||
1 | from gdb import * | ||
2 | |||
3 | def 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 | |||