scripts/gdb: also allow list_head pointer as lx-list-check paramter
authorJan Kiszka <jan.kiszka@siemens.com>
Tue, 30 Jun 2015 21:58:10 +0000 (14:58 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Jul 2015 02:44:58 +0000 (19:44 -0700)
This makes the usage more flexible.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: ThiƩbaud Weksteen <thiebaud@weksteen.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/gdb/linux/lists.py

index 2a94b5462d063a126b066fa1d41b65062132965c..71fba6afcb5586bffea3b8d383a3be965deb41a1 100644 (file)
@@ -20,9 +20,11 @@ list_head = utils.CachedType("struct list_head")
 
 def list_check(head):
     nb = 0
+    if (head.type == list_head.get_type().pointer()):
+        head = head.dereference()
+    elif (head.type != list_head.get_type()):
+        raise gdb.GdbError('argument must be of type (struct list_head [*])')
     c = head
-    if (c.type != list_head.get_type()):
-        raise gdb.GdbError('The argument should be of type (struct list_head)')
     try:
         gdb.write("Starting with: {}\n".format(c))
     except gdb.MemoryError: