All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3)
@ 2020-12-31  9:53 Yann E. MORIN
  2020-12-31  9:53 ` [Buildroot] [PATCH 1/3] package/gdb: cleanup in gdb-python-config Yann E. MORIN
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yann E. MORIN @ 2020-12-31  9:53 UTC (permalink / raw)
  To: buildroot

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(-)

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/3] package/gdb: cleanup in gdb-python-config
  2020-12-31  9:53 [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3) Yann E. MORIN
@ 2020-12-31  9:53 ` Yann E. MORIN
  2020-12-31  9:53 ` [Buildroot] [PATCH 2/3] package/gdb: do not hard-code python version " Yann E. MORIN
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2020-12-31  9:53 UTC (permalink / raw)
  To: buildroot

There was a mix of leading spaces and TABs. Szitch to using only spaces.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/gdb/gdb-python-config | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/package/gdb/gdb-python-config b/package/gdb/gdb-python-config
index 0f002281d7..222f1cf6ba 100755
--- a/package/gdb/gdb-python-config
+++ b/package/gdb/gdb-python-config
@@ -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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/3] package/gdb: do not hard-code python version in gdb-python-config
  2020-12-31  9:53 [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3) Yann E. MORIN
  2020-12-31  9:53 ` [Buildroot] [PATCH 1/3] package/gdb: cleanup in gdb-python-config Yann E. MORIN
@ 2020-12-31  9:53 ` Yann E. MORIN
  2020-12-31  9:53 ` [Buildroot] [PATCH 3/3] package/gdb: enable python3 support Yann E. MORIN
  2020-12-31 13:44 ` [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3) Thomas Petazzoni
  3 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2020-12-31  9:53 UTC (permalink / raw)
  To: buildroot

The 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.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/gdb/gdb-python-config | 9 +++++++--
 package/gdb/gdb.mk            | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/package/gdb/gdb-python-config b/package/gdb/gdb-python-config
index 222f1cf6ba..640c358305 100755
--- a/package/gdb/gdb-python-config
+++ b/package/gdb/gdb-python-config
@@ -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"
diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
index c74279a43e..e35ece0153 100644
--- a/package/gdb/gdb.mk
+++ b/package/gdb/gdb.mk
@@ -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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 3/3] package/gdb: enable python3 support
  2020-12-31  9:53 [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3) Yann E. MORIN
  2020-12-31  9:53 ` [Buildroot] [PATCH 1/3] package/gdb: cleanup in gdb-python-config Yann E. MORIN
  2020-12-31  9:53 ` [Buildroot] [PATCH 2/3] package/gdb: do not hard-code python version " Yann E. MORIN
@ 2020-12-31  9:53 ` Yann E. MORIN
  2020-12-31 13:44 ` [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3) Thomas Petazzoni
  3 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2020-12-31  9:53 UTC (permalink / raw)
  To: buildroot

From: Titouan Christophe <titouan.christophe@railnova.eu>

gdb python support now uses Python3 if python3 is selected, otherwise
uses python(2) as before.

Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
[yann.morin.1998 at free.fr: drop the gdb-python-config duplication]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
 package/gdb/Config.in | 3 +--
 package/gdb/gdb.mk    | 9 ++++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/package/gdb/Config.in b/package/gdb/Config.in
index 48ec3e0202..b1aa5e47d9 100644
--- a/package/gdb/Config.in
+++ b/package/gdb/Config.in
@@ -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.
 
diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
index e35ece0153..b0d0b5fb19 100644
--- a/package/gdb/gdb.mk
+++ b/package/gdb/gdb.mk
@@ -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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3)
  2020-12-31  9:53 [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3) Yann E. MORIN
                   ` (2 preceding siblings ...)
  2020-12-31  9:53 ` [Buildroot] [PATCH 3/3] package/gdb: enable python3 support Yann E. MORIN
@ 2020-12-31 13:44 ` Thomas Petazzoni
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2020-12-31 13:44 UTC (permalink / raw)
  To: buildroot

On Thu, 31 Dec 2020 10:53:09 +0100
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> 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

Series applied. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-31 13:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-31  9:53 [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3) Yann E. MORIN
2020-12-31  9:53 ` [Buildroot] [PATCH 1/3] package/gdb: cleanup in gdb-python-config Yann E. MORIN
2020-12-31  9:53 ` [Buildroot] [PATCH 2/3] package/gdb: do not hard-code python version " Yann E. MORIN
2020-12-31  9:53 ` [Buildroot] [PATCH 3/3] package/gdb: enable python3 support Yann E. MORIN
2020-12-31 13:44 ` [Buildroot] [PATCH 0/3] package/gdb: add support for python3 (branch yem/gdb-py3) Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.