[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56A41799.2040309@linaro.org>
Date: Sun, 24 Jan 2016 00:15:21 +0000
From: Kieran Bingham <kieran.bingham@...aro.org>
To: Jan Kiszka <jan.kiszka@...mens.com>
Cc: linux-kernel@...r.kernel.org, maxime.coquelin@...com,
peter.griffin@...aro.org, lee.jones@...aro.org
Subject: Re: [PATCH 2/5] scripts/gdb: Provide a kernel list item generator
On 23/01/16 15:08, Jan Kiszka wrote:
> On 2016-01-20 12:15, Kieran Bingham wrote:
>> Facilitate linked-list items by providing a generator to return
>> the dereferenced, and type-cast objects from a kernel linked list
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham@...aro.org>
>> ---
>>
>> This is quite a useful wrapper to faciliate looping on lists.
>> It is sort of equivalent to the list_for_each_entry macro.
>>
>> Let me know if it should be renamed, or live elsewhere.
>
> Location is fine. Maybe call it list_items?
>
>>
>> scripts/gdb/linux/lists.py | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/scripts/gdb/linux/lists.py b/scripts/gdb/linux/lists.py
>> index 3a3775bc162b..d2c6ce165cb1 100644
>> --- a/scripts/gdb/linux/lists.py
>> +++ b/scripts/gdb/linux/lists.py
>> @@ -18,6 +18,15 @@ from linux import utils
>> list_head = utils.CachedType("struct list_head")
>>
>>
>> +def items(list_type, list_location, item_list):
>> + """items Generator return items from a kernel linked list"""
>> + item_list_head = item_list
>> + next_item = item_list_head['next'].dereference()
>> + while next_item != item_list_head:
>> + yield utils.container_of(next_item, list_type, list_location)
>> + next_item = next_item['next'].dereference()
>> +
>> +
>> def list_check(head):
>> nb = 0
>> if (head.type == list_head.get_type().pointer()):
>>
>
> Could you apply it on existing list iterations? module_list() seems like
> a candidate, e.g.
Yes, It probably is. I'll update, and add a patch to my series, and
check to see if there are any more.
--
Kieran
>
> Jan
>
Powered by blists - more mailing lists