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

From: Dmitrii Bundin
Date: Mon Aug 22 2022 - 18:42:59 EST


On Tue, Aug 23, 2022 at 12:36 AM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> or perhaps that simply needs to be `-g -gsplit-dwarf`? In which case,
> that if/else could just be re-arranged.

How about simply assigning DEBUG_CFLAGS := -g at the very beginning
without any conditions? This would provide the default with the
possibility of overriding later and -gsplit-dwarf does not necessarily
come with -g implicitly.

> Honestly, I really don't think we need to be wrapping every compiler
> command line flag under the sun in a kconfig option.

This indeed sounds reasonable to me. So the key point here is to not
bloat the kconfig with options related to every compiler flag. But I
think it still might be useful to provide some option that would
include sort of full debug information compilers may produce. With
this approach there would be, in fact 3 different levels of debug
information supported by Kconfig: reduced, default and full. The full
level would increase everything like -g3, and -fdebug-macro for Clang,
and probably others.

> Or add -g1 to CONFIG_DEBUG_INFO_REDUCED.

I ran some tests and there was indeed some decrease in size. That
combination probably might be useful.

Any thoughts?

Regards
Dmitrii