History

scripts/gdb: fix interrupts.py after maple tree conversion

In commit 721255b9826b ("genirq: Use a maple tree for interrupt descriptor management"), the irq_desc_tree was replaced with a sparse_irqs tree using a maple tree structure. Since the script looked for the irq_desc_tree symbol which is no longer available, no interrupts would be printed and the script output would not be useful anymore. In addition to looking up the correct symbol (sparse_irqs), a new module (mapletree.py) is added whose mtree_load() implementation is largely copied after the C version and uses the same variable and intermediate function names wherever possible to ensure that both the C and Python version be updated in the future. This restores the scripts' output to match that of /proc/interrupts.

Florian Fainelli committed 1 year ago

Commit a02b0cd1 parent ea9b77f4 files · +293 −6Browse files

Showing the changes to scripts/gdb/linux/xarray.py (1 of 4 files). Show all

Unified · Split

scripts/gdb/linux/xarray.py+28−0
@@ -0,0 +1,28 @@
1+# SPDX-License-Identifier: GPL-2.0
2+#
3+# Xarray helpers
4+#
5+# Copyright (c) 2025 Broadcom
6+#
7+# Authors:
8+# Florian Fainelli <florian.fainelli@broadcom.com>
9+
10+import gdb
11+
12+from linux import utils
13+from linux import constants
14+
15+def xa_is_internal(entry):
16+ ulong_type = utils.get_ulong_type()
17+ return ((entry.cast(ulong_type) & 3) == 2)
18+
19+def xa_mk_internal(v):
20+ return ((v << 2) | 2)
21+
22+def xa_is_zero(entry):
23+ ulong_type = utils.get_ulong_type()
24+ return entry.cast(ulong_type) == xa_mk_internal(257)
25+
26+def xa_is_node(entry):
27+ ulong_type = utils.get_ulong_type()
28+ return xa_is_internal(entry) and (entry.cast(ulong_type) > 4096)