Re: [PATCH v2] kbuild: add configurable debug info level
From: Dmitrii Bundin
Date: Sun Aug 14 2022 - 15:17:59 EST
> We already have CONFIG_DEBUG_INFO_NONE to
> disable the debug info.
Thanks for pointing this out. Indeed providing another way of
disabling debug info does not look reasonable to me.
So only it makes sense to set only 1, 2 or 3 debug levels.
> Using 'int' does not look sensible to me.
Could you please give a hint why?
My intention to choose int was to provide a boundary with range on the
DEBUG_INFO_LEVEL option to choose only acceptable ones.
On Sun, Aug 14, 2022 at 8:31 AM Fangrui Song <maskray@xxxxxxxxxx> wrote:
> In Clang, -g = -g2 = -g3. To generate macro information,
> specify -fdebug-macro.
Thanks.
I would propose to add another config option like
DEBUG_MACRO_DEFINITIONS to turn on macro information for GCC/Clang.
For GCC it would be -g3, for Clang -fdebug-macro.
> Before GCC 11 and Clang 12, -gsplit-dwarf implied -g2 (older
> -gsplit-dwarf is like today's `-gsplit-dwarf -g2`).
>
> GCC 11 and Clang 12 (https://reviews.llvm.org/D80391) have changed
> -gsplit-dwarf to not imply -g2.
>
> For a group of -g0 -g1 -g2, the last option wins. Therefore,
>
> -g0 -gsplit-dwarf => debug info in GCC<11 and Clang<12
> -g0 -gsplit-dwarf => no debug info in GCC>=11 and Clang>=12
I would add a note that when selecting -gdwarf-<level> gcc also
implicitly sets -g2 (at least in older versions).
It seems reasonable to me to put the DEBUG_LEVEL_INFO setting at the
very bottom to prevent it from overriding implicitly.
What do you think?