Re: [PATCH] scripts/gdb: Fix invocation when CONFIG_COMMON_CLK is not set

From: Leonard Crestez
Date: Thu May 23 2019 - 19:12:20 EST


On 5/24/2019 1:46 AM, Stephen Boyd wrote:
> Quoting Fabiano Rosas (2019-05-23 12:53:11)
>> diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in
>> index 1d73083da6cb..2efbec6b6b8d 100644
>> --- a/scripts/gdb/linux/constants.py.in
>> +++ b/scripts/gdb/linux/constants.py.in
>> @@ -40,7 +40,8 @@
>> import gdb
>>
>> /* linux/clk-provider.h */
>> -LX_GDBPARSED(CLK_GET_RATE_NOCACHE)
>> +if IS_BUILTIN(CONFIG_COMMON_CLK):
>> + LX_GDBPARSED(CLK_GET_RATE_NOCACHE)
>>
>
> Why is this LX_GDBPARSED() instead of LX_VALUE()? From what I can tell
> it doesn't need to be runtime evaluated, just assigned to something that
> is macro expanded by CPP.

Because CLK_GET_RATE_NOCACHE expands to BIT() which expands to a
constant with an UL suffix which python doesn't understand.

Alternatively we could redefine the BIT macros inside constants.py.in
but using gdb features seemed better. We could even try to strip integer
literal suffixes with sed.

Mentioned before: https://lkml.org/lkml/2019/5/3/341

--
Regards,
Leonard