Skip to contentSkip to conversation

scripts/gdb: Print interrupts

PATCH Applied Florian Fainelli 1 participant 1 message Apr 6, 2023 GDB kernel debugging helper scripts

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scripts/gdb: Print interrupts

This GDB script prints the interrupts in the system in the same way that /proc/interrupts does. This does include the architecture specific part done by arch_show_interrupts() for x86, ARM, ARM64 and MIPS. Example output from an ARM64 system:

(gdb) lx-interruptlist
CPU0 CPU1 CPU2 CPU3

 10:       3167      1225      1276      2629     GICv2   30 Level     arch_timer
 13:          0         0         0         0     GICv2   36 Level     arm-pmu
 14:          0         0         0         0     GICv2   37 Level     arm-pmu
 15:          0         0         0         0     GICv2   38 Level     arm-pmu
 16:          0         0         0         0     GICv2   39 Level     arm-pmu
 28:          0         0         0         0  interrupt-controller@8410640    5 Edge      brcmstb-gpio-wake
 30:        125         0         0         0     GICv2  128 Level     ttyS0
 31:          0         0         0         0  interrupt-controller@8416000    0 Level     mspi_done
 32:          0         0         0         0  interrupt-controller@8410640    3 Edge      brcmstb-waketimer
 33:          0         0         0         0  interrupt-controller@8418580    8 Edge      brcmstb-waketimer-rtc
 34:        872         0         0         0     GICv2  230 Level     brcm_scmi@0
 35:          0         0         0         0  interrupt-controller@8410640   10 Edge      8d0f200.usb-phy
 37:          0         0         0         0     GICv2   97 Level     PCIe PME
 42:          0         0         0         0     GICv2  145 Level     xhci-hcd:usb1
 43:         94         0         0         0     GICv2   71 Level     mmc1
 44:          0         0         0         0     GICv2   70 Level     mmc0
IPI0:        23       666       154        98      Rescheduling interrupts
IPI1:       247      1053      1701       634      Function call interrupts
IPI2:         0         0         0         0      CPU stop interrupts
IPI3:         0         0         0         0      CPU stop (for crash dump) interrupts
IPI4:         0         0         0         0      Timer broadcast interrupts
IPI5:         7         9         5         0      IRQ work interrupts
IPI6:         0         0         0         0      CPU wake-up interrupts
ERR:          0

---
Changes in v2:

- fixed typo in commit message and explained that some architectures do get the output of arch_show_interrupts() to be printed out

 scripts/gdb/linux/constants.py.in |  14 ++
 scripts/gdb/linux/interrupts.py   | 232 ++++++++++++++++++++++++++++++
 scripts/gdb/vmlinux-gdb.py        |   1 +
 3 files changed, 247 insertions(+)
 create mode 100644 scripts/gdb/linux/interrupts.py
scripts/gdb/linux/constants.py.in +14 -0
index e484e2e7e4d5..36fd2b145853 100644
@@ -15,6 +15,7 @@
 #include <linux/clk-provider.h>
 #include <linux/fs.h>
 #include <linux/hrtimer.h>
+#include <linux/irq.h>
 #include <linux/mount.h>
 #include <linux/of_fdt.h>
 #include <linux/radix-tree.h>
@@ -57,6 +58,10 @@ LX_VALUE(SB_NODIRATIME)
 /* linux/htimer.h */
 LX_GDBPARSED(hrtimer_resolution)
 
+/* linux/irq.h */
+LX_GDBPARSED(IRQD_LEVEL)
+LX_GDBPARSED(IRQ_HIDDEN)
+
 /* linux/mount.h */
 LX_VALUE(MNT_NOSUID)
 LX_VALUE(MNT_NODEV)
@@ -85,3 +90,12 @@ LX_CONFIG(CONFIG_HIGH_RES_TIMERS)
 LX_CONFIG(CONFIG_NR_CPUS)
 LX_CONFIG(CONFIG_OF)
 LX_CONFIG(CONFIG_TICK_ONESHOT)
+LX_CONFIG(CONFIG_GENERIC_IRQ_SHOW_LEVEL)
+LX_CONFIG(CONFIG_X86_LOCAL_APIC)
+LX_CONFIG(CONFIG_SMP)
+LX_CONFIG(CONFIG_X86_THERMAL_VECTOR)
+LX_CONFIG(CONFIG_X86_MCE_THRESHOLD)
+LX_CONFIG(CONFIG_X86_MCE_AMD)
+LX_CONFIG(CONFIG_X86_MCE)
+LX_CONFIG(CONFIG_X86_IO_APIC)
+LX_CONFIG(CONFIG_HAVE_KVM)
scripts/gdb/linux/interrupts.py new file +232 -0

232 lines not on this page · raw message

scripts/gdb/vmlinux-gdb.py +1 -0
index 2f57adcf3dff..2a72f91059b5 100644
@@ -42,3 +42,4 @@ else:
     import linux.device
     import linux.mm
     import linux.radixtree
+    import linux.interrupts
Signature · 1 line
2.34.1