aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/gdb/linux/lists.py
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2016-06-02 09:54:12 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2016-06-02 09:54:12 +0200
commit5599617ec0719dba3b1f85a4abca2a6c93368ae3 (patch)
tree7d2f9bb6a538ee8ed5cfa391f2cfa72a3e2daa9f /scripts/gdb/linux/lists.py
parentdrm/i915/skl+: Use scaling amount for plane data rate calculation (v4) (diff)
parentMerge branch 'drm-intel-next' of git://anongit.freedesktop.org/drm-intel into drm-next (diff)
downloadlinux-dev-5599617ec0719dba3b1f85a4abca2a6c93368ae3.tar.xz
linux-dev-5599617ec0719dba3b1f85a4abca2a6c93368ae3.zip
Merge remote-tracking branch 'airlied/drm-next' into drm-intel-next-queued
Git got absolutely destroyed with all our cherry-picking from drm-intel-next-queued to various branches. It ended up inserting intel_crtc_page_flip 2x even in intel_display.c. Backmerge to get back to sanity. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'scripts/gdb/linux/lists.py')
-rw-r--r--scripts/gdb/linux/lists.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/gdb/linux/lists.py b/scripts/gdb/linux/lists.py
index 3a3775bc162b..2f335fbd86fd 100644
--- a/scripts/gdb/linux/lists.py
+++ b/scripts/gdb/linux/lists.py
@@ -18,6 +18,27 @@ from linux import utils
list_head = utils.CachedType("struct list_head")
+def list_for_each(head):
+ if head.type == list_head.get_type().pointer():
+ head = head.dereference()
+ elif head.type != list_head.get_type():
+ raise gdb.GdbError("Must be struct list_head not {}"
+ .format(head.type))
+
+ node = head['next'].dereference()
+ while node.address != head.address:
+ yield node.address
+ node = node['next'].dereference()
+
+
+def list_for_each_entry(head, gdbtype, member):
+ for node in list_for_each(head):
+ if node.type != list_head.get_type().pointer():
+ raise TypeError("Type {} found. Expected struct list_head *."
+ .format(node.type))
+ yield utils.container_of(node, gdbtype, member)
+
+
def list_check(head):
nb = 0
if (head.type == list_head.get_type().pointer()):