package/gdb: add support for python3 (branch yem/gdb-py3)
cover package/gdb: add support for python3 (branch yem/gdb-py3)
Hello All!
This small 3-patch series is based on the RFC by Titouan, to add support for python3 to gdb:
http://lists.busybox.net/pipermail/buildroot/2020-February/273561.html
We first cleanup the script emulating python-config, and then we make it agnostic to the pytthon version. Finally, we enable python3 support in gdb.
Regards,
Yann E. MORIN.
Regards,
Yann E. MORIN.
----------------------------------------------------------------
Titouan Christophe (1):
package/gdb: enable python3 support
Yann E. MORIN (2):
package/gdb: cleanup in gdb-python-config
package/gdb: do not hard-code python version in gdb-python-config
package/gdb/Config.in | 3 +-- package/gdb/gdb-python-config | 23 ++++++++++++++--------- package/gdb/gdb.mk | 12 +++++++++++- 3 files changed, 26 insertions(+), 12 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/3 package/gdb: cleanup in gdb-python-config
There was a mix of leading spaces and TABs. Szitch to using only spaces.
--- package/gdb/gdb-python-config | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
package/gdb/gdb-python-config +9 -9
@@ -21,16 +21,16 @@ fi case "$2" in --includes) - echo "-I${STAGING_DIR}/usr/include/python2.7" - ;; + echo "-I${STAGING_DIR}/usr/include/python2.7" + ;; --ldflags) - echo "-lpthread -ldl -lutil -lm -lpython2.7" - ;; + echo "-lpthread -ldl -lutil -lm -lpython2.7" + ;; --exec-prefix) - echo "/usr" - ;; + echo "/usr" + ;; *) - echo "Bad arg $2." >&2 - exit 1 - ;; + echo "Bad arg $2." >&2 + exit 1 + ;; esac
Signature · 1 line
2.25.1
PATCH 2/3 package/gdb: do not hard-code python version in gdb-python-config
In reply to Yann E. MORINThe gdb-python-config simulates a python-2.7, with a hard-coded 2.7 version.
gdb also supports running with python3 nowadays, so prepare the wrapper to return appropriate values.
--- package/gdb/gdb-python-config | 9 +++++++-- package/gdb/gdb.mk | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-)
package/gdb/gdb-python-config +7 -2
@@ -17,14 +17,19 @@ if [ $# -ne 2 ] ; then exit 1 fi +if [ -z "${BR_PYTHON_VERSION}" ]; then + echo "Environment variable BR_PYTHON_VERSION not set." >&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" + echo "-I${STAGING_DIR}/usr/include/python${BR_PYTHON_VERSION}" ;; --ldflags) - echo "-lpthread -ldl -lutil -lm -lpython2.7" + echo "-lpthread -ldl -lutil -lm -lpython${BR_PYTHON_VERSION}" ;; --exec-prefix) echo "/usr"
package/gdb/gdb.mk +3 -0
@@ -194,6 +194,9 @@ GDB_CONF_OPTS += --disable-tui endif ifeq ($(BR2_PACKAGE_GDB_PYTHON),y) +# CONF_ENV: for top-level configure; MAKE_ENV: for sub-projects' configure. +GDB_CONF_ENV += BR_PYTHON_VERSION=$(PYTHON_VERSION_MAJOR) +GDB_MAKE_ENV += BR_PYTHON_VERSION=$(PYTHON_VERSION_MAJOR) GDB_CONF_OPTS += --with-python=$(TOPDIR)/package/gdb/gdb-python-config GDB_DEPENDENCIES += python else
Signature · 1 line
2.25.1
PATCH 3/3 package/gdb: enable python3 support
In reply to Yann E. MORINFrom: Titouan Christophe <[email protected]>
gdb python support now uses Python3 if python3 is selected, otherwise uses python(2) as before.
--- package/gdb/Config.in | 3 +-- package/gdb/gdb.mk | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-)
package/gdb/Config.in +1 -2
@@ -80,8 +80,7 @@ config BR2_PACKAGE_GDB_TUI config BR2_PACKAGE_GDB_PYTHON bool "Python support" - # Only Python 2.x is supported by gdb for now - depends on BR2_PACKAGE_PYTHON + depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3 help This option enables Python support in the target gdb.
package/gdb/gdb.mk +8 -1
@@ -194,11 +194,18 @@ GDB_CONF_OPTS += --disable-tui endif ifeq ($(BR2_PACKAGE_GDB_PYTHON),y) +ifeq ($(BR2_PACKAGE_PYTHON3),y) +# CONF_ENV: for top-level configure; MAKE_ENV: for sub-projects' configure. +GDB_CONF_ENV += BR_PYTHON_VERSION=$(PYTHON3_VERSION_MAJOR) +GDB_MAKE_ENV += BR_PYTHON_VERSION=$(PYTHON3_VERSION_MAJOR) +GDB_DEPENDENCIES += python3 +else # CONF_ENV: for top-level configure; MAKE_ENV: for sub-projects' configure. GDB_CONF_ENV += BR_PYTHON_VERSION=$(PYTHON_VERSION_MAJOR) GDB_MAKE_ENV += BR_PYTHON_VERSION=$(PYTHON_VERSION_MAJOR) -GDB_CONF_OPTS += --with-python=$(TOPDIR)/package/gdb/gdb-python-config GDB_DEPENDENCIES += python +endif +GDB_CONF_OPTS += --with-python=$(TOPDIR)/package/gdb/gdb-python-config else GDB_CONF_OPTS += --without-python endif
Signature · 1 line
2.25.1
cover package/gdb: add support for python3 (branch yem/gdb-py3)
In reply to Yann E. MORINQuoted 6 lines · On Thu, 31 Dec 2020 10:53:09 +0100 "Yann E. MORIN" <[email protected]>…
Titouan Christophe (1):
package/gdb: enable python3 supportYann E. MORIN (2):
package/gdb: cleanup in gdb-python-config
package/gdb: do not hard-code python version in gdb-python-config
Series applied. Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com