From: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] toolchain-external: Introduce gdb_copy option
Date: Mon, 18 Nov 2019 11:00:47 +0300 [thread overview]
Message-ID: <20191118080047.22036-1-Evgeniy.Didin@synopsys.com> (raw)
Some prebuilt toolchains provide full gdb debugger for a target as
well as gdbserver. Lets add separate option for gdb the same way as
it was done for gdbserver. With this change there will be no need
to build gdb package, this will reduce build time.
Signed-off-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: arc-buildroot at synopsys.com
---
toolchain/toolchain-external/Config.in | 7 ++++++
.../toolchain-external/pkg-toolchain-external.mk | 25 ++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index 128bea257e..b20ce93100 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -162,4 +162,11 @@ config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
Copy the gdbserver provided by the external toolchain to the
target.
+config BR2_TOOLCHAIN_EXTERNAL_GDB_COPY
+ bool "Copy gdb to the Target"
+ depends on BR2_TOOLCHAIN_EXTERNAL
+ help
+ Copy the gdb debugger provided by the external toolchain
+ to the target.
+
endif # BR2_TOOLCHAIN_EXTERNAL
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 1c43409514..c400b46590 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -430,6 +430,30 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER
endef
endif
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDB_COPY),y)
+define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDB
+
+ $(Q)$(call MESSAGE,"Copying gdb")
+ $(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+ ARCH_LIB_DIR="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+ gdb_found=0 ; \
+ for d in $${ARCH_SYSROOT_DIR}/usr \
+ $${ARCH_SYSROOT_DIR}/../debug-root/usr \
+ $${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} \
+ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR); do \
+ if test -f $${d}/bin/gdb ; then \
+ install -m 0755 -D $${d}/bin/gdb $(TARGET_DIR)/usr/bin/gdb ; \
+ gdb_found=1 ; \
+ break ; \
+ fi ; \
+ done ; \
+ if [ $${gdb_found} -eq 0 ] ; then \
+ echo "Could not find gdb in external toolchain" ; \
+ exit 1 ; \
+ fi
+endef
+endif
+
define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
@@ -591,6 +615,7 @@ define $(2)_INSTALL_TARGET_CMDS
$$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER)
+ $$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDB)
$$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
endef
--
2.16.2
next reply other threads:[~2019-11-18 8:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-18 8:00 Evgeniy Didin [this message]
2019-11-18 8:11 ` [Buildroot] [PATCH] toolchain-external: Introduce gdb_copy option Thomas Petazzoni
2019-11-18 12:01 ` Evgeniy Didin
2019-11-18 13:24 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191118080047.22036-1-Evgeniy.Didin@synopsys.com \
--to=evgeniy.didin@synopsys.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.