aboutsummaryrefslogtreecommitdiff
path: root/scripts/gdb/vmlinux-gdb.py
diff options
context:
space:
mode:
authorLeonard Crestez <[email protected]>2019-07-16 16:30:15 -0700
committerLinus Torvalds <[email protected]>2019-07-16 19:23:24 -0700
commit778c1f5ccbd95722cf84d2233c6acbf4d01a3ec7 (patch)
tree7a9c17a17417f89dcb0fd9a993312b874a2ddea0 /scripts/gdb/vmlinux-gdb.py
parent8207d4a88e1ef4ab54f05f2f18edd444a5099099 (diff)
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 <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Cc: Kieran Bingham <[email protected]> Cc: Jan Kiszka <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
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