]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: Allow building with debug enabled
authorSimon Glass <sjg@chromium.org>
Thu, 30 Jun 2016 16:52:20 +0000 (10:52 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 14 Jul 2016 22:22:31 +0000 (18:22 -0400)
Sometimes it is useful to build tools with debugging information included so
that line-number information is available when run under gdb. Add a Kconfig
option to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Kconfig
Makefile

diff --git a/Kconfig b/Kconfig
index 2afbaaf801ad5117d9e74da99a56bea4c292395a..ef12f9fbee403c2e9786764f64ff2070f6e336cb 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -114,6 +114,15 @@ if EXPERT
          Warning:
          When disabling this, please check if malloc calls, maybe
          should be replaced by calloc - if one expects zeroed memory.
+
+config TOOLS_DEBUG
+       bool "Enable debug information for tools"
+       help
+         Enable generation of debug information for tools such as mkimage.
+         This can be used for debugging purposes. With debug information
+         it is possible to set breakpoints on particular lines, single-step
+         debug through the source code, etc.
+
 endif
 endmenu                # General setup
 
index 88128ec72a26878740dc3ac0719252819654bea4..7eaa392839142b272ffa7e54b75ef46529745c2e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -256,7 +256,8 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 
 HOSTCC       = cc
 HOSTCXX      = c++
-HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCFLAGS   = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
+               $(if $(CONFIG_TOOLS_DEBUG),-g)
 HOSTCXXFLAGS = -O2
 
 ifeq ($(HOSTOS),cygwin)