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

From: Arnd Bergmann
Date: Fri Dec 10 2021 - 04:40:33 EST


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

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