diff options
author | Kieran Bingham <kieran@ksquared.org.uk> | 2016-07-14 15:07:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-07-15 01:54:27 -0400 |
commit | b447e02548a3304c47b78b5e2d75a4312a8f17e1 (patch) | |
tree | a4a55111089dfffd84d88404c677776255dd969f /scripts/gdb | |
parent | 552ab2a3eaa4338fa5b33aa4c07ea2c542ddcea5 (diff) |
Revert "scripts/gdb: add a Radix Tree Parser"
This reverts commit e127a73d41ac ("scripts/gdb: add a Radix Tree
Parser")
The python implementation of radix-tree was merged at the same time as
the radix-tree system was heavily reworked from commit e9256efcc8e3
("radix-tree: introduce radix_tree_empty") to 3bcadd6fa6c4 ("radix-tree:
free up the bottom bit of exceptional entries for reuse") and no longer
functions, but also prevents other gdb scripts from loading.
This functionality has not yet hit a release, so simply remove it for
now
Link: http://lkml.kernel.org/r/1467127337-11135-6-git-send-email-kieran@bingham.xyz
Signed-off-by: Kieran Bingham <kieran@bingham.xyz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/gdb')
-rw-r--r-- | scripts/gdb/linux/constants.py.in | 7 | ||||
-rw-r--r-- | scripts/gdb/linux/radixtree.py | 97 | ||||
-rw-r--r-- | scripts/gdb/vmlinux-gdb.py | 1 |
3 files changed, 0 insertions, 105 deletions
diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in index 07e6c2befe36..7986f4e0da12 100644 --- a/scripts/gdb/linux/constants.py.in +++ b/scripts/gdb/linux/constants.py.in | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #include <linux/fs.h> | 15 | #include <linux/fs.h> |
16 | #include <linux/mount.h> | 16 | #include <linux/mount.h> |
17 | #include <linux/radix-tree.h> | ||
18 | 17 | ||
19 | /* We need to stringify expanded macros so that they can be parsed */ | 18 | /* We need to stringify expanded macros so that they can be parsed */ |
20 | 19 | ||
@@ -51,9 +50,3 @@ LX_VALUE(MNT_NOEXEC) | |||
51 | LX_VALUE(MNT_NOATIME) | 50 | LX_VALUE(MNT_NOATIME) |
52 | LX_VALUE(MNT_NODIRATIME) | 51 | LX_VALUE(MNT_NODIRATIME) |
53 | LX_VALUE(MNT_RELATIME) | 52 | LX_VALUE(MNT_RELATIME) |
54 | |||
55 | /* linux/radix-tree.h */ | ||
56 | LX_VALUE(RADIX_TREE_INDIRECT_PTR) | ||
57 | LX_GDBPARSED(RADIX_TREE_HEIGHT_MASK) | ||
58 | LX_GDBPARSED(RADIX_TREE_MAP_SHIFT) | ||
59 | LX_GDBPARSED(RADIX_TREE_MAP_MASK) | ||
diff --git a/scripts/gdb/linux/radixtree.py b/scripts/gdb/linux/radixtree.py deleted file mode 100644 index 0fdef4e2971a..000000000000 --- a/scripts/gdb/linux/radixtree.py +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | # | ||
2 | # gdb helper commands and functions for Linux kernel debugging | ||
3 | # | ||
4 | # Radix Tree Parser | ||
5 | # | ||
6 | # Copyright (c) 2016 Linaro Ltd | ||
7 | # | ||
8 | # Authors: | ||
9 | # Kieran Bingham <kieran.bingham@linaro.org> | ||
10 | # | ||
11 | # This work is licensed under the terms of the GNU GPL version 2. | ||
12 | # | ||
13 | |||
14 | import gdb | ||
15 | |||
16 | from linux import utils | ||
17 | from linux import constants | ||
18 | |||
19 | radix_tree_root_type = utils.CachedType("struct radix_tree_root") | ||
20 | radix_tree_node_type = utils.CachedType("struct radix_tree_node") | ||
21 | |||
22 | |||
23 | def is_indirect_ptr(node): | ||
24 | long_type = utils.get_long_type() | ||
25 | return (node.cast(long_type) & constants.LX_RADIX_TREE_INDIRECT_PTR) | ||
26 | |||
27 | |||
28 | def indirect_to_ptr(node): | ||
29 | long_type = utils.get_long_type() | ||
30 | node_type = node.type | ||
31 | indirect_ptr = node.cast(long_type) & ~constants.LX_RADIX_TREE_INDIRECT_PTR | ||
32 | return indirect_ptr.cast(node_type) | ||
33 | |||
34 | |||
35 | def maxindex(height): | ||
36 | height = height & constants.LX_RADIX_TREE_HEIGHT_MASK | ||
37 | return gdb.parse_and_eval("height_to_maxindex["+str(height)+"]") | ||
38 | |||
39 | |||
40 | def lookup(root, index): | ||
41 | if root.type == radix_tree_root_type.get_type().pointer(): | ||
42 | root = root.dereference() | ||
43 | elif root.type != radix_tree_root_type.get_type(): | ||
44 | raise gdb.GdbError("Must be struct radix_tree_root not {}" | ||
45 | .format(root.type)) | ||
46 | |||
47 | node = root['rnode'] | ||
48 | if node is 0: | ||
49 | return None | ||
50 | |||
51 | if not (is_indirect_ptr(node)): | ||
52 | if (index > 0): | ||
53 | return None | ||
54 | return node | ||
55 | |||
56 | node = indirect_to_ptr(node) | ||
57 | |||
58 | height = node['path'] & constants.LX_RADIX_TREE_HEIGHT_MASK | ||
59 | if (index > maxindex(height)): | ||
60 | return None | ||
61 | |||
62 | shift = (height-1) * constants.LX_RADIX_TREE_MAP_SHIFT | ||
63 | |||
64 | while True: | ||
65 | new_index = (index >> shift) & constants.LX_RADIX_TREE_MAP_MASK | ||
66 | slot = node['slots'][new_index] | ||
67 | |||
68 | node = slot.cast(node.type.pointer()).dereference() | ||
69 | if node is 0: | ||
70 | return None | ||
71 | |||
72 | shift -= constants.LX_RADIX_TREE_MAP_SHIFT | ||
73 | height -= 1 | ||
74 | |||
75 | if (height <= 0): | ||
76 | break | ||
77 | |||
78 | return node | ||
79 | |||
80 | |||
81 | class LxRadixTree(gdb.Function): | ||
82 | """ Lookup and return a node from a RadixTree. | ||
83 | |||
84 | $lx_radix_tree_lookup(root_node [, index]): Return the node at the given index. | ||
85 | If index is omitted, the root node is dereferenced and returned.""" | ||
86 | |||
87 | def __init__(self): | ||
88 | super(LxRadixTree, self).__init__("lx_radix_tree_lookup") | ||
89 | |||
90 | def invoke(self, root, index=0): | ||
91 | result = lookup(root, index) | ||
92 | if result is None: | ||
93 | raise gdb.GdbError("No entry in tree at index {}".format(index)) | ||
94 | |||
95 | return result | ||
96 | |||
97 | LxRadixTree() | ||
diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py index 3a80ad6eecad..6e0b0afd888a 100644 --- a/scripts/gdb/vmlinux-gdb.py +++ b/scripts/gdb/vmlinux-gdb.py | |||
@@ -31,4 +31,3 @@ else: | |||
31 | import linux.lists | 31 | import linux.lists |
32 | import linux.proc | 32 | import linux.proc |
33 | import linux.constants | 33 | import linux.constants |
34 | import linux.radixtree | ||