Skip to contentSkip to conversation

package/gdb: Add support for host-gdb with python3

PATCH New Ramon Fried 2 participants 2 messages Mar 23, 2020 – Apr 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/gdb: Add support for host-gdb with python3

host-gdb was limited to link only with Python 2 although it's possible to build Python 3 for host.
Add the ability to link with Python 3.

---
v2: Add choice menu for mutaly exclusive selection of Python3/2
as suggested by Romain

 package/gdb/Config.in.host | 16 ++++++++++++++--
 package/gdb/gdb.mk         |  3 +++
 2 files changed, 17 insertions(+), 2 deletions(-)
package/gdb/Config.in.host +14 -2
index 5315f10493..e5e8fae5eb 100644
@@ -32,10 +32,22 @@ config BR2_PACKAGE_HOST_GDB_TUI
 	help
 	  This option enables terminal user interface (TUI) for gdb
 
+choice
+	prompt "Python support"
+	help
+	  Select the version of Python you wish to use
+
 config BR2_PACKAGE_HOST_GDB_PYTHON
-	bool "Python support"
+	bool "Python 2 support"
 	help
-	  This option enables the Python support in the cross gdb.
+	  This option enables the Python 2 support in the cross gdb.
+
+config BR2_PACKAGE_HOST_GDB_PYTHON3
+	bool "Python 3 support"
+	help
+	  This option enables the Python 3 support in the cross gdb.
+
+endchoice
 
 config BR2_PACKAGE_HOST_GDB_SIM
 	bool "Simulator support"
package/gdb/gdb.mk +3 -0
index 01f7e14460..8c74a0e2f6 100644
@@ -238,6 +238,9 @@ endif
 ifeq ($(BR2_PACKAGE_HOST_GDB_PYTHON),y)
 HOST_GDB_CONF_OPTS += --with-python=$(HOST_DIR)/bin/python2
 HOST_GDB_DEPENDENCIES += host-python
+else ifeq ($(BR2_PACKAGE_HOST_GDB_PYTHON3),y)
+HOST_GDB_CONF_OPTS += --with-python=$(HOST_DIR)/bin/python3
+HOST_GDB_DEPENDENCIES += host-python3
 else
 HOST_GDB_CONF_OPTS += --without-python
 endif
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 package/gdb: Add support for host-gdb with python3

Quoted 28 lines · On Mon, 23 Mar 2020 08:46:21 +0200 Ramon Fried <[email protected]> wrote:

host-gdb was limited to link only with Python 2 although it's possible to build Python 3 for host.
Add the ability to link with Python 3.

---
v2: Add choice menu for mutaly exclusive selection of Python3/2
as suggested by Romain

 package/gdb/Config.in.host | 16 ++++++++++++++--
 package/gdb/gdb.mk         |  3 +++
 2 files changed, 17 insertions(+), 2 deletions(-)
package/gdb/Config.in.host +5 -1
index 5315f10493..e5e8fae5eb 100644
@@ -32,10 +32,22 @@ config BR2_PACKAGE_HOST_GDB_TUI
 	help
 	  This option enables terminal user interface (TUI) for gdb
 
+choice
+	prompt "Python support"
+	help
+	  Select the version of Python you wish to use
+
 config BR2_PACKAGE_HOST_GDB_PYTHON
-	bool "Python support"

package/gdb/Config.in.host config BR2_PACKAGE_HOST_GDB_TUI · line 49

Quoted 10 lines
package/gdb/Config.in.host +8 -1
+	bool "Python 2 support"
 	help
-	  This option enables the Python support in the cross gdb.
+	  This option enables the Python 2 support in the cross gdb.
+
+config BR2_PACKAGE_HOST_GDB_PYTHON3
+	bool "Python 3 support"
+	help
+	  This option enables the Python 3 support in the cross gdb.
+

With this choice of two options.. you were forced to have either Python2 or Python3 support in gdb, it was no longer possible to *not* have Python support. So I've added a third option, BR2_PACKAGE_HOST_GDB_NOPYTHON, which allows to not have Python support in host-gdb.

Applied with this change. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com