Skip to content

Commit bfaf2dd

Browse files
Andi Kleenmichal42
authored andcommitted
Kbuild: Add a option to enable dwarf4 v2
I found that a lot of unresolvable variables when using gdb on the kernel become resolvable when dwarf4 is enabled. So add a Kconfig flag to enable it. It definitely increases the debug information size, but on the other hand this isn't so bad when debug fusion is used. v2: Use cc-option Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent 866ced9 commit bfaf2dd

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,9 @@ KBUILD_CFLAGS += -g
691691
endif
692692
KBUILD_AFLAGS += -Wa,-gdwarf-2
693693
endif
694+
ifdef CONFIG_DEBUG_INFO_DWARF4
695+
KBUILD_CFLAGS += $(call cc-option, -gdwarf-4,)
696+
endif
694697

695698
ifdef CONFIG_DEBUG_INFO_REDUCED
696699
KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly) \

‎lib/Kconfig.debug‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ config DEBUG_INFO_SPLIT
158158
to know about the .dwo files and include them.
159159
Incompatible with older versions of ccache.
160160

161+
config DEBUG_INFO_DWARF4
162+
bool "Generate dwarf4 debuginfo"
163+
depends on DEBUG_INFO
164+
help
165+
Generate dwarf4 debug info. This requires recent versions
166+
of gcc and gdb. It makes the debug information larger.
167+
But it significantly improves the success of resolving
168+
variables in gdb on optimized code.
169+
161170
config ENABLE_WARN_DEPRECATED
162171
bool "Enable __deprecated logic"
163172
default y

0 commit comments

Comments
 (0)