All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Marek <michal.lkml@markovi.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nathan Chancellor <nathan@kernel.org>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Kees Cook <keescook@chromium.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Isabella Basso <isabbasso@riseup.net>,
	Eric Dumazet <edumazet@google.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
	Fangrui Song <maskray@google.com>
Subject: Re: [PATCH v2] kbuild: add configurable debug info level
Date: Sun, 14 Aug 2022 11:01:36 +0900	[thread overview]
Message-ID: <CAK7LNARPAmsJD5XKAw7m_X2g7Fi-CAAsWDQiP7+ANBjkg7R7ng@mail.gmail.com> (raw)
In-Reply-To: <20220814002021.16990-1-dmitrii.bundin.a@gmail.com>

+CC: Fangrui Song <maskray@google.com>




On Sun, Aug 14, 2022 at 9:25 AM Dmitrii Bundin
<dmitrii.bundin.a@gmail.com> wrote:
>
> Provides a way to configure debug info level (-glevel).
> Debug level 3 includes extra information such as macro definitions. With
> level 3 enabled it's possible to expand macros right from the debugging
> session in gdb simplifying debugging when complicated macros involved.
> The default level is set to 2 to not change the default build behavior.
>
> Signed-off-by: Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
> ---
>
> Changes in v2: https://lore.kernel.org/all/20220804223504.4739-1-dmitrii.bundin.a@gmail.com/
>   - Replace hardcoded -g3 with a configurable debug info level
>
>  lib/Kconfig.debug      | 11 +++++++++++
>  scripts/Makefile.debug |  2 +-
>  2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 2e24db4bff19..a17c12c20290 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -304,6 +304,17 @@ config DEBUG_INFO_REDUCED
>           DEBUG_INFO build and compile times are reduced too.
>           Only works with newer gcc versions.
>
> +config DEBUG_INFO_LEVEL
> +       int "Debug info level"
> +       range 0 3
> +       default "2"
> +       help
> +         Sets the level of how much debug information to generate (-glevel).
> +         Level 1 produces minimal debug information without including information
> +         about local variables. Level 3 includes extra information like macro
> +         definitions. Setting up level 3 will require significantly more disk
> +         space and increase built time. Level 0 produces no debug information.
> +



We already have CONFIG_DEBUG_INFO_NONE to
disable the debug info.


The combination of CONFIG_DEBUG_INFO=y and
CONFIG_DEBUG_INFO_LEVEL=0  (-g0)
would emulate CONFIG_DEBUG_INFO_NONE ?



Using 'int' does not look sensible to me.





>  config DEBUG_INFO_COMPRESSED
>         bool "Compressed debugging information"
>         depends on $(cc-option,-gz=zlib)
> diff --git a/scripts/Makefile.debug b/scripts/Makefile.debug
> index 9f39b0130551..28beffc42e71 100644
> --- a/scripts/Makefile.debug
> +++ b/scripts/Makefile.debug
> @@ -3,7 +3,7 @@ DEBUG_CFLAGS    :=
>  ifdef CONFIG_DEBUG_INFO_SPLIT
>  DEBUG_CFLAGS   += -gsplit-dwarf
>  else
> -DEBUG_CFLAGS   += -g
> +DEBUG_CFLAGS   += -g$(CONFIG_DEBUG_INFO_LEVEL)
>  endif
>
>  ifndef CONFIG_AS_IS_LLVM
> --
> 2.17.1
>


I want to consult Fangrui Song for this part.


With this Makefile code, CONFIG_DEBUG_INFO_SPLIT
takes the presidency over CONFIG_DEBUG_INFO_LEVEL.


When CONFIG_DEBUG_INFO_SPLIT is enabled (-gsplit-dwarf),
it always uses the default -g2 level.
CONFIG_DEBUG_INFO_LEVEL is just ignored silently.



It might be sensible in older GCC/Clang behavior because
-gsplit-dwarf implied -g2.


But, with this commit:
https://reviews.llvm.org/D80391

-gsplit-dwarf and -g<level> are orthogonal
for GCC 11+/Clang 12+, correct?


I think "splitting debug files" and "debug level"
should be controlled independently.
(but it depends on the compiler version, if I understood correctly)






--
Best Regards
Masahiro Yamada

  reply	other threads:[~2022-08-14  2:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-14  0:20 [PATCH v2] kbuild: add configurable debug info level Dmitrii Bundin
2022-08-14  2:01 ` Masahiro Yamada [this message]
2022-08-14  5:31   ` Fangrui Song
2022-08-14 18:58     ` Masahiro Yamada
2022-08-14 19:17     ` Dmitrii Bundin
2022-08-15  1:33       ` [PATCH v3] kbuild: add debug level and macro defs options Dmitrii Bundin
2022-08-18  4:13         ` Masahiro Yamada
2022-08-18 18:57           ` Dmitrii Bundin
2022-08-19 17:42         ` Nick Desaulniers
2022-08-19 22:52           ` Dmitrii Bundin
2022-08-22 16:45             ` Nick Desaulniers
2022-08-22 21:36               ` Nick Desaulniers
2022-08-22 22:42                 ` Dmitrii Bundin
2022-08-24 23:25                   ` Nick Desaulniers
2022-09-29 21:06                   ` Masahiro Yamada
2022-09-30  9:11                     ` Masahiro Yamada
2022-10-08  7:24                       ` Dmitrii Bundin
2022-08-23  6:06             ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNARPAmsJD5XKAw7m_X2g7Fi-CAAsWDQiP7+ANBjkg7R7ng@mail.gmail.com \
    --to=masahiroy@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=dmitrii.bundin.a@gmail.com \
    --cc=edumazet@google.com \
    --cc=isabbasso@riseup.net \
    --cc=jpoimboe@kernel.org \
    --cc=keescook@chromium.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=maskray@google.com \
    --cc=michal.lkml@markovi.net \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.