Re: [PATCH] scripts/gdb: fix lx-symbols 'gdb.error' while loading modules

From: Kieran Bingham
Date: Thu Jul 23 2020 - 06:39:10 EST


Hi All,

On 23/07/2020 11:25, Jan Kiszka wrote:
> On 22.07.20 12:22, Stefano Garzarella wrote:
>> Commit ed66f991bb19 ("module: Refactor section attr into bin
>> attribute") removed the 'name' field from 'struct module_sect_attr'
>> triggering the following error when invoking lx-symbols:
>>
>> ÂÂ (gdb) lx-symbols
>> ÂÂ loading vmlinux
>> ÂÂ scanning for modules in linux/build
>> ÂÂ loading @0xffffffffc014f000: linux/build/drivers/net/tun.ko
>> ÂÂ Python Exception <class 'gdb.error'> There is no member named name.:
>> ÂÂ Error occurred in Python: There is no member named name.
>>
>> This patch fixes the issue taking the module name from the 'struct
>> attribute'.
>>

It might not be needed if this gets in to v5.8 in time, but perhaps:

Fixes: ed66f991bb19 ("module: Refactor section attr into bin attribute")

>> Signed-off-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>

Otherwise, also looks fine to me.

Reviewed-by: Kieran Bingham <kbingham@xxxxxxxxxx>

>> ---
>> Â scripts/gdb/linux/symbols.py | 2 +-
>> Â 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py
>> index be984aa29b75..1be9763cf8bb 100644
>> --- a/scripts/gdb/linux/symbols.py
>> +++ b/scripts/gdb/linux/symbols.py
>> @@ -96,7 +96,7 @@ lx-symbols command."""
>> ÂÂÂÂÂÂÂÂÂÂÂÂÂ return ""
>> ÂÂÂÂÂÂÂÂÂ attrs = sect_attrs['attrs']
>> ÂÂÂÂÂÂÂÂÂ section_name_to_address = {
>> -ÂÂÂÂÂÂÂÂÂÂÂ attrs[n]['name'].string(): attrs[n]['address']
>> +ÂÂÂÂÂÂÂÂÂÂÂ attrs[n]['battr']['attr']['name'].string():
>> attrs[n]['address']
>> ÂÂÂÂÂÂÂÂÂÂÂÂÂ for n in range(int(sect_attrs['nsections']))}
>> ÂÂÂÂÂÂÂÂÂ args = []
>> ÂÂÂÂÂÂÂÂÂ for section_name in [".data", ".data..read_mostly",
>> ".rodata", ".bss",
>>
>
> Reviewed-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
>
> Thanks,
> Jan
>


--
--
Kieran