Re: [PATCH v1] scripts/gdb: fix parsing of MNT_* constants

Florian Fainelli <[email protected]> Tue, 3 Jun 2025 09:17:27 -0700
Newsgroups org.kernel.vger.linux-debuggers,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 6/2/25 21:42, Stephen Brennan wrote:
> On 5/31/25 22:50, Tony Ambardar wrote:
>> Recently, constants in linux/mount.h were changed from integer macros
>> parsable by LX_VALUE() to enums which are not, thus breaking gdb python
>> scripts:
>>
>>    Reading symbols from vmlinux...
>>    Traceback (most recent call last):
>>      File ".../linux/vmlinux-gdb.py", line 25, in <module>
>>        import linux.constants
>>      File ".../linux/scripts/gdb/linux/constants.py", line 19, in <module>
>>        LX_MNT_NOSUID = MNT_NOSUID
>>    NameError: name 'MNT_NOSUID' is not defined
>>
>> Update to parse with LX_GDBPARSED(), which correctly handles enums.
>>
>> Fixes: 101f2bbab541 ("fs: convert mount flags to enum")
>> Signed-off-by: Tony Ambardar <[email protected]>
> 
> Hi Tony,
> 
> I was totally unaware that these constants were being consumed by
> another debugger, and having fixed them for one, I broke them for another!
> 
> Thanks for the fix. Having read through the preprocessor magic and this
> change, they make sense to me. In the future, I'll be sure to make an
> extra check for GDB users when updating enums.
> 
> Reviewed-by: Stephen Brennan <[email protected]>

Not targeted to anyone in particular but this is a recurring problem, 
the GDB scripts are typically not part of any CI and it is not natural 
to grep for constant names outside of the C/Rust code where they are 
being used...

I suppose that QEMU it should be much easier to ensure that GDB scripts 
are being exercised than with my current set-up using OpenOCD + real 
hardware...

Thanks
-- 
Florian