diff mbox series

toolchain: gdb: Add optional python support

Message ID mailman.1463.1622219869.434944.openwrt-devel@lists.openwrt.org
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series toolchain: gdb: Add optional python support | expand

Commit Message

Hauke Mehrtens May 28, 2021, 4:35 p.m. UTC
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
Compile gdb with python support optionally.

To use the Python support in gdb some extra python files are needed,
install them too. While at it also install other shared files which we
did not install before.

If gdb is built without Python support the python folder does not

Signed-off-by: Hauke Mehrtens <hmehrtens@maxlinear.com>
 toolchain/Config.in    |  8 ++++++++
 toolchain/gdb/Makefile | 11 ++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/toolchain/Config.in b/toolchain/Config.in
index 6dda9af92d..8ff5438d79 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -259,6 +259,14 @@  config GDB
 	  Enable if you want to build the gdb.
+config GDB_PYTHON
+	bool
+	depends on GDB
+	prompt "Build gdb with python binding"
+	help
+	  Enable the python bindings for GDB to allow using python in the gdb shell.
 config USE_GLIBC
diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile
index 05e3c7de3c..2708eff869 100644
--- a/toolchain/gdb/Makefile
+++ b/toolchain/gdb/Makefile
@@ -36,7 +36,6 @@  HOST_CONFIGURE_ARGS = \
 	--without-included-gettext \
 	--enable-threads \
 	--with-expat \
-	--without-python \
 	--disable-unit-tests \
 	--disable-ubsan \
 	--disable-binutils \
@@ -44,11 +43,21 @@  HOST_CONFIGURE_ARGS = \
 	--disable-gas \
+ifneq ($(CONFIG_GDB_PYTHON),)
+  HOST_CONFIGURE_ARGS+= --with-python
+  HOST_CONFIGURE_ARGS:= --without-python
 define Host/Install
 	mkdir -p $(TOOLCHAIN_DIR)/bin
 	strip $(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)gdb
+	mkdir -p $(TOOLCHAIN_DIR)/share/gdb
+	-cp -R $(HOST_BUILD_DIR)/gdb/data-directory/python $(TOOLCHAIN_DIR)/share/gdb/
+	cp -R $(HOST_BUILD_DIR)/gdb/data-directory/syscalls $(TOOLCHAIN_DIR)/share/gdb/
+	cp -R $(HOST_BUILD_DIR)/gdb/data-directory/system-gdbinit $(TOOLCHAIN_DIR)/share/gdb/
 define Host/Clean