Re: [PATCH v3] kbuild: add debug level and macro defs options

From: Nick Desaulniers
Date: Fri Aug 19 2022 - 13:58:11 EST


On Sun, Aug 14, 2022 at 6:34 PM Dmitrii Bundin
<dmitrii.bundin.a@xxxxxxxxx> wrote:
>
> Adds config options to control debug info level and producing of macro
> definitions for GCC/Clang.
>
> Option DEBUG_INFO_LEVEL is responsible for controlling debug info level.
> Before GCC 11 and Clang 12 -gsplit-dwarf implicitly uses -g2. To provide
> a way to override the setting with, e.g. -g1, DEBUG_INFO_LEVEL is set
> independently from DEBUG_INFO_SPLIT.
>
> Option DEBUG_MACRO_DEFINITIONS is responsible for controlling inclusion
> of macro definitions. Since Clang uses -fdebug-macro to control if macro
> definitions are produced which is different from GCC, provides a
> compiler-specific way of handling macro inclusion. The option is handled
> after DEBUG_INFO_LEVEL since -g3 -g2 implies -g2, but -g2 -g3 implies
> -g3 and GCC uses -g3 to produce macro definitions.
>
> Signed-off-by: Dmitrii Bundin <dmitrii.bundin.a@xxxxxxxxx>
> ---
>
> Changes in v2: https://lore.kernel.org/all/20220804223504.4739-1-dmitrii.bundin.a@xxxxxxxxx/

Is any of this really necessary? It seems like a great way to bloat
vmlinux artifacts built with CONFIG_DEBUG_INFO even further. The
above link mentions "when debugging with GDB." In that case, please
don't add new Kconfigs for these; just set -g3 when
CONFIG_GDB_SCRIPTS=y.

--
Thanks,
~Nick Desaulniers