Re: [PATCH] Kconfig.debug: Make DEBUG_INFO selectable from a choice

From: Masahiro Yamada
Date: Tue Dec 21 2021 - 18:23:46 EST


On Fri, Dec 10, 2021 at 6:40 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> On Fri, Dec 10, 2021 at 1:09 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
> >
> > Currently it's not possible to enable DEBUG_INFO for an all*config
> > build, since it is marked as "depends on !COMPILE_TEST". This generally
> > makes sense because a debug build of an all*config target ends up taking
> > much longer and the output is much larger. Having this be "default off"
> > makes sense. However, there are cases where enabling DEBUG_INFO for such
> > builds is useful for doing treewide A/B comparisons of build options,
> > etc.
> >
> > Make DEBUG_INFO selectable from any of the DWARF version choice options,
> > with DEBUG_INFO_NONE being the default for COMPILE_TEST. The mutually
> > exclusive relationship between DWARF5 and BTF must be inverted, but the
> > result remains the same. Additionally moves DEBUG_KERNEL and DEBUG_MISC
> > up to the top of the menu because was enabling features _above_ it,
> > making it weird to navigate menuconfig.
> >
> > Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>
> > Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
>
> Looks good to me,
>
> Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>
>
> One detail:
>
> > +choice
> > + prompt "Debug information"
> > + depends on DEBUG_KERNEL
> > + default DEBUG_INFO_NONE if COMPILE_TEST
> > + default DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT if DEBUG_KERNEL
>
> I think this line should be simplified to
>
> default DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT

Indeed.

It can be simplified into:

default DEBUG_INFO_NONE if COMPILE_TEST
default DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT

The first entry of the choice is the default.
So, it can be further simplified to:

default DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT if !COMPILE_TEST



Another way is to move DEBUG_INFO_NONE to the last entry of the choice,
then

default DEBUG_INFO_NONE if COMPILE_TEST





> since DEBUG_KERNEL is always enabled at this point. You can also consider
> turning the 'menu' into 'menuconfig DEBUG_KERNEL' and dropping the 'depends
> on DEBUG_KERNEL' in favor of the implied dependency.
>
> Arnd



--
Best Regards
Masahiro Yamada