Re: [PATCH 1/3] scripts/gdb: Add hlist utilities

From: Leonard Crestez
Date: Tue Apr 23 2019 - 05:20:52 EST


On 4/22/2019 11:41 PM, Stephen Boyd wrote:
> Quoting Leonard Crestez (2019-04-22 01:26:56)
>> This allows easily examining kernel hlists in python.
>>
>> Signed-off-by: Leonard Crestez <leonard.crestez@xxxxxxx>
>
>> +def hlist_for_each_entry(head, gdbtype, member):
>> + for node in hlist_for_each(head):
>> + if node.type != hlist_node.get_type().pointer():
>> + raise TypeError("Type {} found. Expected struct hlist_head *."
>
> Maybe drop the full-stop? It looks weird to see struct list_head *.

Makes sense, it was copy/pasted from list_for_each_entry. Since this
iterates over items from hlist_for_each the check is only useful as an
assertion anyway so I'll just drop it.

The hlist_for_each/list_for_each raise gdb.GdbError on type mismatch; as
far as I understand the difference is that GdbError won't print a python
backtrace. However these are internal helpers so TypeError makes more sense.