GDB's '--with-lzma=auto/yes/no' option defaults to 'auto' but it would
be better to configure it to 'yes' or 'no' explicitly.  GDB's lzma
support is required to read the .gnu_debuginfo sections in binaries (if
they have been built to include those sections), so call the
configuration option GDB_DEBUGINFO_SUPPORT.

The '--with-lzma' option was added in GDB 7.6, but that is quite old, so
assume it is supported.

While we are at it, change the test `ifneq ($(filter
1%,$(GDBSERVER_VERSION)),)` to use `$(GDB_VERSION)` instead, and add the
'--without-python' configure command line option.

Signed-off-by: Ian Abbott <[email protected]>
---
 rules/gdb.in   | 12 ++++++++++++
 rules/gdb.make |  9 ++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/rules/gdb.in b/rules/gdb.in
index 3014271de..9e76307e3 100644
--- a/rules/gdb.in
+++ b/rules/gdb.in
@@ -8,6 +8,7 @@ menuconfig GDB
        select GCCLIBS_GCC_S
        select NCURSES
        select LIBGMP           if GDB_11_1
+       select XZ               if GDB_DEBUGINFO_SUPPORT
        help
          The GNU Debugger
 
@@ -26,6 +27,17 @@ config GDB_SHARED
          If not set, the build option
          LDFLAGS=-static will be activated.
 
+config GDB_DEBUGINFO_SUPPORT
+       bool
+       prompt "support reading .gnu_debuginfo sections"
+       help
+         Configures whether to link with liblzma to support reading the
+         .gnu_debuginfo sections in binaries.
+
+         Note: This is useful if TARGET_MINI_DEBUGINFO has been enabled
+         in the platform configuration to add .gnu_debuginfo sections
+         to all the binaries.
+
 config GDB_11_1
        bool
        prompt "gdb-11.1 or later"
diff --git a/rules/gdb.make b/rules/gdb.make
index 6c9f05fab..c1337427b 100644
--- a/rules/gdb.make
+++ b/rules/gdb.make
@@ -40,10 +40,12 @@ endif
 GDB_CONF_OPT_HOST      := \
        --disable-tui \
        --disable-rpath \
+       --with-lzma=$(call ptx/yesno, PTXCONF_GDB_DEBUGINFO_SUPPORT) \
        --without-expat \
-       --without-mpfr
+       --without-mpfr \
+       --without-python
 
-ifneq ($(filter 1%,$(GDBSERVER_VERSION)),)
+ifneq ($(filter 1%,$(GDB_VERSION)),)
 # version >= 10
 GDB_CONF_OPT_HOST      += \
        --without-xxhash
@@ -72,7 +74,8 @@ GDB_BUILD_OOT := YES
 
 # for gdb subdir configure
 GDB_MAKE_ENV           := \
-       with_libgmp_prefix=no
+       with_libgmp_prefix=no \
+       with_liblzma_prefix=no
 
 # ----------------------------------------------------------------------------
 # Install
-- 
2.43.0


Reply via email to