Commit 022885cb9ce9b22fb62225a21b4eb017a2e8dab5

Authored by Simon Glass
Committed by Tom Rini
1 parent 51f03e6a75

tools: Allow building with debug enabled

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>

Showing 2 changed files with 11 additions and 1 deletions Side-by-side Diff

... ... @@ -114,6 +114,15 @@
114 114 Warning:
115 115 When disabling this, please check if malloc calls, maybe
116 116 should be replaced by calloc - if one expects zeroed memory.
  117 +
  118 +config TOOLS_DEBUG
  119 + bool "Enable debug information for tools"
  120 + help
  121 + Enable generation of debug information for tools such as mkimage.
  122 + This can be used for debugging purposes. With debug information
  123 + it is possible to set breakpoints on particular lines, single-step
  124 + debug through the source code, etc.
  125 +
117 126 endif
118 127 endmenu # General setup
119 128  
... ... @@ -256,7 +256,8 @@
256 256  
257 257 HOSTCC = cc
258 258 HOSTCXX = c++
259   -HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
  259 +HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
  260 + $(if $(CONFIG_TOOLS_DEBUG),-g)
260 261 HOSTCXXFLAGS = -O2
261 262  
262 263 ifeq ($(HOSTOS),cygwin)