Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
To: masahiroy@kernel.org
Cc: michal.lkml@markovi.net, ndesaulniers@google.com,
	akpm@linux-foundation.org, nathan@kernel.org,
	peterz@infradead.org, keescook@chromium.org, jpoimboe@kernel.org,
	dan.j.williams@intel.com, isabbasso@riseup.net,
	edumazet@google.com, vbabka@suse.cz, linux@rasmusvillemoes.dk,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
Subject: [PATCH] kbuild: add option to set max level of debug info
Date: Fri,  5 Aug 2022 01:35:04 +0300	[thread overview]
Message-ID: <20220804223504.4739-1-dmitrii.bundin.a@gmail.com> (raw)

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


             reply	other threads:[~2022-08-04 22:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 22:35 Dmitrii Bundin [this message]
2022-08-11 21:58 ` [PATCH] kbuild: add option to set max level of debug info Andrew Morton
2022-08-12  0:33   ` Dmitrii Bundin

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=20220804223504.4739-1-dmitrii.bundin.a@gmail.com \
    --to=dmitrii.bundin.a@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.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=masahiroy@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox