diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-09-17 15:18:25 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-09-17 15:18:25 +0000 |
commit | 707001a1dd7b734b04e1bcb6293c6a4a59bce03e (patch) | |
tree | 5ae121f7bf791b346c6089ec48f4f14763d1fc8b | |
parent | 729eee2e184550d3d94a8a964f265f5c4ce001cc (diff) | |
download | gnunet-707001a1dd7b734b04e1bcb6293c6a4a59bce03e.tar.gz gnunet-707001a1dd7b734b04e1bcb6293c6a4a59bce03e.zip |
- fixes
-rw-r--r-- | contrib/gdb-iterate-dll.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/contrib/gdb-iterate-dll.py b/contrib/gdb-iterate-dll.py index 728747363..2132b5e34 100644 --- a/contrib/gdb-iterate-dll.py +++ b/contrib/gdb-iterate-dll.py | |||
@@ -1,8 +1,8 @@ | |||
1 | from gdb import * | 1 | from gdb import * |
2 | 2 | ||
3 | def iterate_dll (head, field, match, pfield): | 3 | def search_dll (head, field, match, pfield): |
4 | """ | 4 | """ |
5 | Iterates over a DLL data structure | 5 | Search in a DLL by iterates over it. |
6 | 6 | ||
7 | head: name of the symbol denoting the head of the DLL | 7 | head: name of the symbol denoting the head of the DLL |
8 | field: the field that should be search for match | 8 | field: the field that should be search for match |
@@ -14,26 +14,28 @@ def iterate_dll (head, field, match, pfield): | |||
14 | (symbol, _) = lookup_symbol (head) | 14 | (symbol, _) = lookup_symbol (head) |
15 | if symbol is None: | 15 | if symbol is None: |
16 | print "Can't find symbol: " + head | 16 | print "Can't find symbol: " + head |
17 | return | 17 | return |
18 | while symbol: | 18 | symbol_val = symbol.value() |
19 | symbol_val = symbol.value().derefence | 19 | while symbol_val: |
20 | field_val = symbol_val[field] | 20 | symbol_val_def = symbol_val.dereference() |
21 | field_val = symbol_val_def[field] | ||
21 | if field_val.type.code == gdb.TYPE_CODE_INT: | 22 | if field_val.type.code == gdb.TYPE_CODE_INT: |
22 | val = int(field_val) | 23 | val = int(field_val) |
23 | res = (match == val) | 24 | res = (match == val) |
24 | if (field_val.type.code == gdb.TYPE_CODE_STRING) | 25 | elif (field_val.type.code == gdb.TYPE_CODE_STRING) or (field_val.type.code == gdb.TYPE_CODE_ARRAY): |
25 | or (filed_val.type.code == gdb.TYPE_CODE_ARRAY): | ||
26 | val = str (field_val) | 26 | val = str (field_val) |
27 | res = (match == val) | 27 | res = (match == val) |
28 | if (field_val.type.code == gdb.TYPE_CODE_TYPEDEF): | 28 | elif (field_val.type.code == gdb.TYPE_CODE_TYPEDEF): |
29 | val = str (field_val) | 29 | val = str (field_val) |
30 | res = match in val | 30 | res = match in val |
31 | else: | ||
32 | continue | ||
31 | 33 | ||
32 | if res: | 34 | if res: |
33 | if pfield is None: | 35 | if pfield is None: |
34 | print symbol_val | 36 | print symbol_val_def |
35 | else: | 37 | else: |
36 | print symbol_val[pfield] | 38 | print symbol_val_def[pfield] |
37 | symbol = symbol_val["next"] | 39 | symbol_val = symbol_val_def["next"] |
38 | 40 | ||
39 | 41 | ||