Skip to contentSkip to conversation

gdb updates

PATCH New Thomas Petazzoni 2 participants 10 messages Sep 15, 2014 – Sep 16, 2014

lore
Share & tools
lore
#0 lore raw

cover gdb updates

Hello,

Here are a bunch of gdb updates:

* Addition of version 7.8, switch to 7.7 as the default one, removal of version 7.6.

* Addition of the missing host-ncurses dependency to host-gdb.

* Addition of TUI support for the target gdb (patch from Vincent Stehl?).

* Addition of Python support for the host and target gdb.

Best regards,

Thomas

Thomas Petazzoni (7):
gdb: add version 7.8
gdb: switch to 7.7 as the default version
gdb: remove version 7.6
gdb: needs host-ncurses on the host
gdb: reword prompt for host TUI option
gdb: add support for Python in host gdb
gdb: add support for Python in target gdb

Vincent Stehl? (1):
gdb: enable tui support for target package

 package/gdb/Config.in         | 23 +++++++++++++++++++++++
 package/gdb/Config.in.host    | 21 ++++++++++++---------
 package/gdb/gdb-python-config | 36 ++++++++++++++++++++++++++++++++++++
 package/gdb/gdb.mk            | 31 +++++++++++++++++++++++++++----
 4 files changed, 98 insertions(+), 13 deletions(-)
 create mode 100755 package/gdb/gdb-python-config
Signature · 1 line
2.0.0
#1 lore raw

PATCH 1/8 gdb: add version 7.8

This commit adds support for the 7.8 version of gdb. Note that the tarball of this version is not available as a .tar.bz2, so we have to add a special case and download the .tar.xz for this version.

---
 package/gdb/Config.in.host | 4 ++++
 package/gdb/gdb.mk         | 4 ++++
 2 files changed, 8 insertions(+)
package/gdb/Config.in.host +4 -0
index 10d16b9..f51b5b1 100644
@@ -39,6 +39,9 @@ choice
 	config BR2_GDB_VERSION_7_7
 		bool "gdb 7.7.x"
 
+	config BR2_GDB_VERSION_7_8
+		bool "gdb 7.8.x"
+
 endchoice
 
 endif
@@ -53,3 +56,4 @@ config BR2_GDB_VERSION
 	default "6be65fb56ea6694a9260733a536a023a1e2d4d57" if BR2_microblaze
 	default "7.6.2"    if BR2_GDB_VERSION_7_6 || !BR2_PACKAGE_HOST_GDB
 	default "7.7.1"    if BR2_GDB_VERSION_7_7 || BR2_powerpc64le
+	default "7.8"	   if BR2_GDB_VERSION_7_8
package/gdb/gdb.mk +4 -0
index 85b7883..07f6ba3 100644
@@ -23,6 +23,10 @@ ifeq ($(GDB_VERSION),6.7.1-avr32-2.1.5)
 GDB_SITE = ftp://www.at91.com/pub/buildroot
 endif
 
+ifeq ($(GDB_VERSION),7.8)
+GDB_SOURCE = gdb-$(GDB_VERSION).tar.xz
+endif
+
 GDB_SOURCE ?= gdb-$(GDB_VERSION).tar.bz2
 GDB_LICENSE = GPLv2+ LGPLv2+ GPLv3+ LGPLv3+
 GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
Signature · 1 line
2.0.0
#2 lore raw

PATCH 2/8 gdb: switch to 7.7 as the default version

In reply to Thomas Petazzoni

Now that gdb 7.8 is out, it's time to move to 7.7 as the default version instead of 7.6.

---
 package/gdb/Config.in.host | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
package/gdb/Config.in.host +3 -4
index f51b5b1..d34aec6 100644
@@ -23,8 +23,7 @@ choice
 	depends on !BR2_arc
 	depends on !BR2_microblaze
 	default BR2_GDB_VERSION_6_7_1_AVR32_2_1_5 if BR2_avr32
-	default BR2_GDB_VERSION_7_7 if BR2_powerpc64le
-	default BR2_GDB_VERSION_7_6
+	default BR2_GDB_VERSION_7_7
 	help
 	  Select the version of gdb you wish to use.
 
@@ -54,6 +53,6 @@ config BR2_GDB_VERSION
                                    (!BR2_PACKAGE_HOST_GDB && BR2_avr32)
 	default "arc-2014.08-gdb" if BR2_arc
 	default "6be65fb56ea6694a9260733a536a023a1e2d4d57" if BR2_microblaze
-	default "7.6.2"    if BR2_GDB_VERSION_7_6 || !BR2_PACKAGE_HOST_GDB
-	default "7.7.1"    if BR2_GDB_VERSION_7_7 || BR2_powerpc64le
+	default "7.6.2"    if BR2_GDB_VERSION_7_6
+	default "7.7.1"    if BR2_GDB_VERSION_7_7 || !BR2_PACKAGE_HOST_GDB
 	default "7.8"	   if BR2_GDB_VERSION_7_8
Signature · 1 line
2.0.0
#3 lore raw

PATCH 3/8 gdb: remove version 7.6

In reply to Thomas Petazzoni

Now that the default version has changed to 7.7, we can get rid of the older gdb 7.6 version.

---
 package/gdb/Config.in.host | 5 -----
 1 file changed, 5 deletions(-)
package/gdb/Config.in.host +0 -5
index d34aec6..fe3f90e 100644
@@ -31,10 +31,6 @@ choice
 		depends on BR2_avr32
 		bool "gdb 6.7.1-avr32-2.1.5"
 
-	config BR2_GDB_VERSION_7_6
-		bool "gdb 7.6.x"
-		depends on !BR2_powerpc64le
-
 	config BR2_GDB_VERSION_7_7
 		bool "gdb 7.7.x"
 
@@ -53,6 +49,5 @@ config BR2_GDB_VERSION
                                    (!BR2_PACKAGE_HOST_GDB && BR2_avr32)
 	default "arc-2014.08-gdb" if BR2_arc
 	default "6be65fb56ea6694a9260733a536a023a1e2d4d57" if BR2_microblaze
-	default "7.6.2"    if BR2_GDB_VERSION_7_6
 	default "7.7.1"    if BR2_GDB_VERSION_7_7 || !BR2_PACKAGE_HOST_GDB
 	default "7.8"	   if BR2_GDB_VERSION_7_8
Signature · 1 line
2.0.0
#4 lore raw

PATCH 4/8 gdb: needs host-ncurses on the host

In reply to Thomas Petazzoni

Commit 2474fb0bf1a786f3a170631f3dbce8b38092f986 ("host-gdb: enable terminal user interface support") has added TUI support to host gdb, and therefore added a dependency on host-ncurses when TUI support is enabled.

However, host-ncurses is not only needed for TUI support, it is needed for gdb in all cases as well, so this commit adds a dependency of host-gdb to host-ncurses.

Fixes:

http://autobuild.buildroot.org/results/153/153dbdc42103074f7a0895e8871e2eee4eae3325/

---
 package/gdb/gdb.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/gdb/gdb.mk +3 -3
index 07f6ba3..41d3689 100644
@@ -40,8 +40,9 @@ GDB_DEPENDENCIES = ncurses
 endif
 
 # For the host variant, we really want to build with XML support,
-# which is needed to read XML descriptions of target architectures.
-HOST_GDB_DEPENDENCIES = host-expat
+# which is needed to read XML descriptions of target architectures. We
+# also need ncurses.
+HOST_GDB_DEPENDENCIES = host-expat host-ncurses
 
 # Apply the Xtensa specific patches
 XTENSA_CORE_NAME = $(call qstrip, $(BR2_XTENSA_CORE_NAME))
@@ -127,7 +128,6 @@ HOST_GDB_CONF_OPT = \
 	--disable-sim
 
 ifeq ($(BR2_PACKAGE_HOST_GDB_TUI),y)
-	HOST_GDB_DEPENDENCIES += host-ncurses
 	HOST_GDB_CONF_OPT += --enable-tui
 else
 	HOST_GDB_CONF_OPT += --disable-tui
Signature · 1 line
2.0.0
#5 lore raw

PATCH 5/8 gdb: enable tui support for target package

In reply to Thomas Petazzoni

From: Vincent Stehl? <[email protected]>

Add a configuration option to compile the gdb target package with the --enable-tui switch.

This is done pretty much in the same way as in commit 2474fb0bf1a7 ("host-gdb:
enable terminal user interface support"), but for the gdb package on target.

This makes sense only when a full debugger is installed on target, not for a gdbserver.

[Thomas: remove "default n" since this is the default, adjust the prompt of the option, and rewrap the help text.]

merge target TUI

---
 package/gdb/Config.in | 16 ++++++++++++++++
 package/gdb/gdb.mk    |  7 ++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
package/gdb/Config.in +16 -0
index bfbc8d8..9622948 100644
@@ -46,4 +46,20 @@ comment "full gdb on target needs a toolchain w/ wchar"
 	depends on !BR2_sh && !BR2_sh64 && !BR2_avr32 && !BR2_microblaze && !BR2_bfin
 	depends on !BR2_USE_WCHAR
 
+if BR2_PACKAGE_GDB_DEBUGGER
+
+config BR2_PACKAGE_GDB_TUI
+	bool "TUI support"
+	help
+	  This option enables terminal user interface (TUI) for gdb
+
+	  "The GDB Text User Interface (TUI) is a terminal interface
+	  which uses the curses library to show the source file, the
+	  assembly output, the program registers and GDB commands in
+	  separate text windows."
+
+	  https://sourceware.org/gdb/current/onlinedocs/gdb/TUI.html
+
+endif
+
 endif
package/gdb/gdb.mk +6 -1
index 41d3689..4a194e2 100644
@@ -76,7 +76,6 @@ GDB_CONF_ENV = \
 
 GDB_CONF_OPT = \
 	--without-uiout \
-	--disable-tui \
 	--disable-gdbtk \
 	--without-x \
 	--disable-sim \
@@ -86,6 +85,12 @@ GDB_CONF_OPT = \
 	--without-included-gettext \
 	--disable-werror
 
+ifeq ($(BR2_PACKAGE_GDB_TUI),y)
+	GDB_CONF_OPT += --enable-tui
+else
+	GDB_CONF_OPT += --disable-tui
+endif
+
 # This removes some unneeded Python scripts and XML target description
 # files that are not useful for a normal usage of the debugger.
 define GDB_REMOVE_UNNEEDED_FILES
Signature · 1 line
2.0.0
#6 lore raw

PATCH 6/8 gdb: reword prompt for host TUI option

In reply to Thomas Petazzoni

There is no need to name the option "GDB TUI support", since this option is already visible "below" GDB in menuconfig/xconfig. Naming it "TUI support" is therefore sufficient.

---
 package/gdb/Config.in.host | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/gdb/Config.in.host +1 -1
index fe3f90e..5d0e1b4 100644
@@ -14,7 +14,7 @@ config BR2_PACKAGE_HOST_GDB
 if BR2_PACKAGE_HOST_GDB
 
 config BR2_PACKAGE_HOST_GDB_TUI
-	bool "GDB TUI support"
+	bool "TUI support"
 	help
 	  This option enables terminal user interface (TUI) for gdb
 
Signature · 1 line
2.0.0
#7 lore raw

PATCH 7/8 gdb: add support for Python in host gdb

In reply to Thomas Petazzoni

This commit adds an option BR2_PACKAGE_HOST_GDB_PYTHON that allows to enable Python support in the cross gdb built by Buildroot.

---
 package/gdb/Config.in.host | 5 +++++
 package/gdb/gdb.mk         | 7 +++++++
 2 files changed, 12 insertions(+)
package/gdb/Config.in.host +5 -0
index 5d0e1b4..1e20cd2 100644
@@ -18,6 +18,11 @@ config BR2_PACKAGE_HOST_GDB_TUI
 	help
 	  This option enables terminal user interface (TUI) for gdb
 
+config BR2_PACKAGE_HOST_GDB_PYTHON
+	bool "Python support"
+	help
+	  This option enables the Python support in the cross gdb.
+
 choice
 	prompt "GDB debugger Version"
 	depends on !BR2_arc
package/gdb/gdb.mk +7 -0
index 4a194e2..e12b12b 100644
@@ -138,6 +138,13 @@ else
 	HOST_GDB_CONF_OPT += --disable-tui
 endif
 
+ifeq ($(BR2_PACKAGE_HOST_GDB_PYTHON),y)
+	HOST_GDB_CONF_OPT += --with-python
+	HOST_GDB_DEPENDENCIES += host-python
+else
+	HOST_GDB_CONF_OPT += --without-python
+endif
+
 ifeq ($(GDB_FROM_GIT),y)
 HOST_GDB_DEPENDENCIES += host-texinfo
 else
Signature · 1 line
2.0.0
#8 lore raw

PATCH 8/8 gdb: add support for Python in target gdb

In reply to Thomas Petazzoni

This commit adds a new option BR2_PACKAGE_GDB_PYTHON to enable Python support in the target gdb. Since we can assume that the user will be aware that Python is needed to get Python support in gdb, we chose to use a "depends on" dependency instead of a "select" dependency.

The other weird thing is the need for a wrapper shell script to replace gdb's provided python-config.py script. See the shell script comment itself for all the details.

---
 package/gdb/Config.in         |  7 +++++++
 package/gdb/gdb-python-config | 36 ++++++++++++++++++++++++++++++++++++
 package/gdb/gdb.mk            |  7 +++++++
 3 files changed, 50 insertions(+)
 create mode 100755 package/gdb/gdb-python-config
package/gdb/Config.in +7 -0
index 9622948..a96df1e 100644
@@ -60,6 +60,13 @@ config BR2_PACKAGE_GDB_TUI
 
 	  https://sourceware.org/gdb/current/onlinedocs/gdb/TUI.html
 
+config BR2_PACKAGE_GDB_PYTHON
+	bool "Python support"
+	# Only Python 2.x is supported by gdb for now
+	depends on BR2_PACKAGE_PYTHON
+	help
+	  This option enables Python support in the target gdb.
+
 endif
 
 endif
package/gdb/gdb-python-config new file +36 -0
new file mode 100755
index 0000000..0f00228
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# This shell script is used to fake Python. Gdb wants to be passed a
+# Python interpreter, to run its own python-config.py program, which
+# uses sysconfig. However, when cross-compiling, this doesn't work
+# well since we would have to use the host Python, whose sysconfig
+# module would return host values.
+#
+# As recommended at
+# https://sourceware.org/gdb/wiki/CrossCompilingWithPythonSupport,
+# this wrapper shell script can be used as a replacement. It ignores
+# the python-config.py script passed as first arguments, and
+# "emulates" its behavior.
+
+if [ $# -ne 2 ] ; then
+    echo "Bad # args." >&2
+    exit 1
+fi
+
+# The first argument is the path to python-config.py, ignore it.
+
+case "$2" in
+    --includes)
+	echo "-I${STAGING_DIR}/usr/include/python2.7"
+	;;
+    --ldflags)
+	echo "-lpthread -ldl -lutil -lm -lpython2.7"
+	;;
+    --exec-prefix)
+	echo "/usr"
+	;;
+    *)
+	echo "Bad arg $2." >&2
+	exit 1
+	;;
+esac
package/gdb/gdb.mk +7 -0
index e12b12b..e01431b 100644
@@ -91,6 +91,13 @@ else
 	GDB_CONF_OPT += --disable-tui
 endif
 
+ifeq ($(BR2_PACKAGE_GDB_PYTHON),y)
+	GDB_CONF_OPT += --with-python=$(TOPDIR)/package/gdb/gdb-python-config
+	GDB_DEPENDENCIES += python
+else
+	GDB_CONF_OPT += --without-python
+endif
+
 # This removes some unneeded Python scripts and XML target description
 # files that are not useful for a normal usage of the debugger.
 define GDB_REMOVE_UNNEEDED_FILES
Signature · 1 line
2.0.0
#9 lore raw

cover gdb updates

In reply to Thomas Petazzoni
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,
Here are a bunch of gdb updates:

* Addition of version 7.8, switch to 7.7 as the default one, removal of version 7.6.

Quoted 6 lines

* Addition of the missing host-ncurses dependency to host-gdb.

* Addition of TUI support for the target gdb (patch from Vincent Stehl?).

* Addition of Python support for the host and target gdb.

Committed series, thanks.

Signature · 1 line
Bye, Peter Korsgaard