kbuild: add option to set max level of debug info
Subsystems (2)
PATCH 1/1 kbuild: add option to set max level of debug info
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.
--- lib/Kconfig.debug | 9 +++++++++ scripts/Makefile.debug | 2 ++ 2 files changed, 11 insertions(+)
lib/Kconfig.debug +9 -0
@@ -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)
scripts/Makefile.debug +2 -0
@@ -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
Signature · 1 line
2.17.1
Andrew Morton
maintainerQuoted 27 lines · On Fri, 5 Aug 2022 01:35:04 +0300 Dmitrii Bundin <[email protected]>…
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.
lib/Kconfig.debug +9
-0@@ -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)scripts/Makefile.debug +0
-0
scripts/Makefile.debug DEBUG_CFLAGS := · line 9
Quoted 8 lines
scripts/Makefile.debug +2
-0@@ -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'?
Quoted 2 lines
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
Quoted 43 lines · Andrew Morton
Quoted 27 lines · On Fri, 5 Aug 2022 01:35:04 +0300 Dmitrii Bundin <[email protected]>…
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.
lib/Kconfig.debug +9
-0@@ -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)scripts/Makefile.debug +0
-0scripts/Makefile.debug DEBUG_CFLAGS := · line 9
Quoted 8 lines
scripts/Makefile.debug +2
-0@@ -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 endifWhat 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'?