aboutsummaryrefslogtreecommitdiff
path: root/contrib/scripts/gdb-iterate-dll.py
diff options
context:
space:
mode:
authorNils Gillmann <ng0@n0.is>2018-05-19 14:43:13 +0000
committerNils Gillmann <ng0@n0.is>2018-05-19 14:43:13 +0000
commit6ab60d4920bb3199aee8cd872b930e9e3e808ba7 (patch)
tree3d761dbf8793a1d2422fbd14667255c7e0292ea4 /contrib/scripts/gdb-iterate-dll.py
parentc2f27dfe8218545c327ab49d225a49910347c5c6 (diff)
downloadgnunet-6ab60d4920bb3199aee8cd872b930e9e3e808ba7.tar.gz
gnunet-6ab60d4920bb3199aee8cd872b930e9e3e808ba7.zip
Restructure contrib folder.
contrib/pogen.sh -> bin/pogen.sh bootstrap: Use new pogen location and execute it. contrib/openvpn-tap32: Move to contrib/3rdparty/Windows/openvpn-tap32. contrib/gnunet-logo*: Move to contrib/branding/logo/ Delete old patches in contrib, predating git. Move buildbot data to contrib/ci/buildbot, move docker data to contrib/ci/docker. Create contrib/conf and populate it with config files found in contrib and bin. Move gns related data to contrib/gns. delete contrib/repeat.sh Move contrib/log.php into contrib/web/log.php. Create folder contrib/scripts and use it for most scripts in contrib. Remove trailing whitespace in doc/Makefile.am Signed-off-by: Nils Gillmann <ng0@n0.is>
Diffstat (limited to 'contrib/scripts/gdb-iterate-dll.py')
-rw-r--r--contrib/scripts/gdb-iterate-dll.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/contrib/scripts/gdb-iterate-dll.py b/contrib/scripts/gdb-iterate-dll.py
new file mode 100644
index 000000000..79d46aa96
--- /dev/null
+++ b/contrib/scripts/gdb-iterate-dll.py
@@ -0,0 +1,40 @@
1from gdb import *
2
3
4def search_dll(head, field, match, pfield):
5 """
6 Search in a DLL by iterates over it.
7
8 head: name of the symbol denoting the head of the DLL
9 field: the field that should be search for match
10 match: the mathing value for field
11 pfield: the field whose value is to be printed for matched elements; None to
12 print all fields of the matched elemented
13 """
14
15 (symbol, _) = lookup_symbol(head)
16 if symbol is None:
17 print("Can't find symbol: " + head)
18 return
19 symbol_val = symbol.value()
20 while symbol_val:
21 symbol_val_def = symbol_val.dereference()
22 field_val = symbol_val_def[field]
23 if field_val.type.code == gdb.TYPE_CODE_INT:
24 val = int(field_val)
25 res = (match == val)
26 elif (field_val.type.code == gdb.TYPE_CODE_STRING) or (field_val.type.code == gdb.TYPE_CODE_ARRAY):
27 val = str(field_val)
28 res = (match == val)
29 elif (field_val.type.code == gdb.TYPE_CODE_TYPEDEF):
30 val = str(field_val)
31 res = match in val
32 else:
33 continue
34
35 if res:
36 if pfield is None:
37 print(symbol_val_def)
38 else:
39 print(symbol_val_def[pfield])
40 symbol_val = symbol_val_def["next"]