* [PATCH] kbuild: add option to set max level of debug info
@ 2022-08-04 22:35 Dmitrii Bundin
2022-08-11 21:58 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Dmitrii Bundin @ 2022-08-04 22:35 UTC (permalink / raw)
To: masahiroy
Cc: michal.lkml, ndesaulniers, akpm, nathan, peterz, keescook,
jpoimboe, dan.j.williams, isabbasso, edumazet, vbabka, linux,
linux-kernel, linux-kbuild, Dmitrii Bundin
When compiling with -g3 option and debugging with gdb it provides some
extra abilities like macro expand, info macro etc... It's sometimes
useful to unerstand behavior of complicated macros.
Signed-off-by: Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
---
lib/Kconfig.debug | 9 +++++++++
scripts/Makefile.debug | 2 ++
2 files changed, 11 insertions(+)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 2e24db4bff19..1e8bef3e2a95 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -304,6 +304,15 @@ config DEBUG_INFO_REDUCED
DEBUG_INFO build and compile times are reduced too.
Only works with newer gcc versions.
+config DEBUG_INFO_MAXLEVEL
+ bool "Maximum debug information level"
+ depends on !DEBUG_INFO_REDUCED
+ default n
+ help
+ Sets the maximum level of debug information compilers may generate
+ (-g3). Enabling this option will require significantly more disk space
+ and increase built time, but it's useful for debugging purposes.
+
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..7e1d8beecfc4 100644
--- a/scripts/Makefile.debug
+++ b/scripts/Makefile.debug
@@ -2,6 +2,8 @@ DEBUG_CFLAGS :=
ifdef CONFIG_DEBUG_INFO_SPLIT
DEBUG_CFLAGS += -gsplit-dwarf
+else ifdef CONFIG_DEBUG_INFO_MAXLEVEL
+DEBUG_CFLAGS += -g3
else
DEBUG_CFLAGS += -g
endif
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kbuild: add option to set max level of debug info
2022-08-04 22:35 [PATCH] kbuild: add option to set max level of debug info Dmitrii Bundin
@ 2022-08-11 21:58 ` Andrew Morton
2022-08-12 0:33 ` Dmitrii Bundin
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2022-08-11 21:58 UTC (permalink / raw)
To: Dmitrii Bundin
Cc: masahiroy, michal.lkml, ndesaulniers, nathan, peterz, keescook,
jpoimboe, dan.j.williams, isabbasso, edumazet, vbabka, linux,
linux-kernel, linux-kbuild
On Fri, 5 Aug 2022 01:35:04 +0300 Dmitrii Bundin <dmitrii.bundin.a@gmail.com> wrote:
> When compiling with -g3 option and debugging with gdb it provides some
> extra abilities like macro expand, info macro etc... It's sometimes
> useful to unerstand behavior of complicated macros.
>
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -304,6 +304,15 @@ config DEBUG_INFO_REDUCED
> DEBUG_INFO build and compile times are reduced too.
> Only works with newer gcc versions.
>
> +config DEBUG_INFO_MAXLEVEL
> + bool "Maximum debug information level"
> + depends on !DEBUG_INFO_REDUCED
> + default n
> + help
> + Sets the maximum level of debug information compilers may generate
> + (-g3). Enabling this option will require significantly more disk space
> + and increase built time, but it's useful for debugging purposes.
> +
> 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..7e1d8beecfc4 100644
> --- a/scripts/Makefile.debug
> +++ b/scripts/Makefile.debug
> @@ -2,6 +2,8 @@ DEBUG_CFLAGS :=
>
> ifdef CONFIG_DEBUG_INFO_SPLIT
> DEBUG_CFLAGS += -gsplit-dwarf
> +else ifdef CONFIG_DEBUG_INFO_MAXLEVEL
> +DEBUG_CFLAGS += -g3
> else
> DEBUG_CFLAGS += -g
> endif
What happens when the gcc developers add -g4? Or if a user wants -g2?
In other words, can we make this a Kconfig-selectable level, with the
default `1'?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kbuild: add option to set max level of debug info
2022-08-11 21:58 ` Andrew Morton
@ 2022-08-12 0:33 ` Dmitrii Bundin
0 siblings, 0 replies; 3+ messages in thread
From: Dmitrii Bundin @ 2022-08-12 0:33 UTC (permalink / raw)
To: Andrew Morton
Cc: masahiroy, michal.lkml, ndesaulniers, nathan, peterz, keescook,
jpoimboe, dan.j.williams, isabbasso, edumazet, vbabka, linux,
linux-kernel, linux-kbuild
> In other words, can we make this a Kconfig-selectable level, with the
> default `1'?
Thanks for pointing this out.
Here is a little note from my side. According to the GCC documentation
the default level is 2. So I would propose to set the default Kconfig
option value to 2 as well to not change the build behavior.
Does this sound reasonable?
Regards,
Dmitrii
On Fri, Aug 12, 2022 at 12:58 AM Andrew Morton
<akpm@linux-foundation.org> wrote:
>
> On Fri, 5 Aug 2022 01:35:04 +0300 Dmitrii Bundin <dmitrii.bundin.a@gmail.com> wrote:
>
> > When compiling with -g3 option and debugging with gdb it provides some
> > extra abilities like macro expand, info macro etc... It's sometimes
> > useful to unerstand behavior of complicated macros.
> >
> > --- a/lib/Kconfig.debug
> > +++ b/lib/Kconfig.debug
> > @@ -304,6 +304,15 @@ config DEBUG_INFO_REDUCED
> > DEBUG_INFO build and compile times are reduced too.
> > Only works with newer gcc versions.
> >
> > +config DEBUG_INFO_MAXLEVEL
> > + bool "Maximum debug information level"
> > + depends on !DEBUG_INFO_REDUCED
> > + default n
> > + help
> > + Sets the maximum level of debug information compilers may generate
> > + (-g3). Enabling this option will require significantly more disk space
> > + and increase built time, but it's useful for debugging purposes.
> > +
> > 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..7e1d8beecfc4 100644
> > --- a/scripts/Makefile.debug
> > +++ b/scripts/Makefile.debug
> > @@ -2,6 +2,8 @@ DEBUG_CFLAGS :=
> >
> > ifdef CONFIG_DEBUG_INFO_SPLIT
> > DEBUG_CFLAGS += -gsplit-dwarf
> > +else ifdef CONFIG_DEBUG_INFO_MAXLEVEL
> > +DEBUG_CFLAGS += -g3
> > else
> > DEBUG_CFLAGS += -g
> > endif
>
> What happens when the gcc developers add -g4? Or if a user wants -g2?
>
> In other words, can we make this a Kconfig-selectable level, with the
> default `1'?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-12 0:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-04 22:35 [PATCH] kbuild: add option to set max level of debug info Dmitrii Bundin
2022-08-11 21:58 ` Andrew Morton
2022-08-12 0:33 ` Dmitrii Bundin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox