summaryrefslogtreecommitdiffstats
path: root/scripts/gdb/vmlinux-gdb.py
diff options
context:
space:
mode:
authorLeonard Crestez2019-07-17 01:30:15 +0200
committerLinus Torvalds2019-07-17 04:23:24 +0200
commit778c1f5ccbd95722cf84d2233c6acbf4d01a3ec7 (patch)
tree7a9c17a17417f89dcb0fd9a993312b874a2ddea0 /scripts/gdb/vmlinux-gdb.py
parentscripts/gdb: add lx-genpd-summary command (diff)
downloadkernel-qcow2-linux-778c1f5ccbd95722cf84d2233c6acbf4d01a3ec7.tar.gz
kernel-qcow2-linux-778c1f5ccbd95722cf84d2233c6acbf4d01a3ec7.tar.xz
kernel-qcow2-linux-778c1f5ccbd95722cf84d2233c6acbf4d01a3ec7.zip
scripts/gdb: add helpers to find and list devices
Add helper commands and functions for finding pointers to struct device by enumerating linux device bus/class infrastructure. This can be used to fetch subsystem and driver-specific structs: (gdb) p *$container_of($lx_device_find_by_class_name("net", "eth0"), "struct net_device", "dev") (gdb) p *$container_of($lx_device_find_by_bus_name("i2c", "0-004b"), "struct i2c_client", "dev") (gdb) p *(struct imx_port*)$lx_device_find_by_class_name("tty", "ttymxc1")->parent->driver_data Several generic "lx-device-list" functions are included to enumerate devices by bus and class: (gdb) lx-device-list-bus usb (gdb) lx-device-list-class (gdb) lx-device-list-tree &platform_bus Similar information is available in /sys but pointer values are deliberately hidden. Link: http://lkml.kernel.org/r/c948628041311cbf1b9b4cff3dda7d2073cb3eaa.1561492937.git.leonard.crestez@nxp.com Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com> Reviewed-by: Stephen Boyd <sboyd@kernel.org> Cc: Kieran Bingham <kbingham@kernel.org> Cc: Jan Kiszka <jan.kiszka@siemens.com> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/gdb/vmlinux-gdb.py')
-rw-r--r--scripts/gdb/vmlinux-gdb.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py
index a504f511e752..4136dc2c59df 100644
--- a/scripts/gdb/vmlinux-gdb.py
+++ b/scripts/gdb/vmlinux-gdb.py
@@ -36,3 +36,4 @@ else:
import linux.timerlist
import linux.clk
import linux.genpd
+ import linux.device