[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220814002021.16990-1-dmitrii.bundin.a@gmail.com>
Date: Sun, 14 Aug 2022 03:20:21 +0300
From: Dmitrii Bundin <dmitrii.bundin.a@...il.com>
To: masahiroy@...nel.org, akpm@...ux-foundation.org
Cc: michal.lkml@...kovi.net, ndesaulniers@...gle.com,
nathan@...nel.org, peterz@...radead.org, keescook@...omium.org,
jpoimboe@...nel.org, dan.j.williams@...el.com,
isabbasso@...eup.net, edumazet@...gle.com, vbabka@...e.cz,
linux@...musvillemoes.dk, linux-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org,
Dmitrii Bundin <dmitrii.bundin.a@...il.com>
Subject: [PATCH v2] kbuild: add configurable debug info level
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@...il.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.
+
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
Powered by blists - more mailing lists