Use gdbserver from external toolchain.
PATCH 1/1 Use gdbserver from external toolchain.
Allow the user to copy the pre-compiled gdbserver from the external toolchain to the rootfs.
It is assumed that the external toolchain has been generated with crosstool-NG, as there is no generic way to find the location of gdbserver.
--- toolchain/external-toolchain/Config.in | 9 +++++++ toolchain/external-toolchain/ext-tool.mk | 35 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 0 deletions(-)
toolchain/external-toolchain/Config.in +9 -0
@@ -19,4 +19,13 @@ config BR2_TOOLCHAIN_EXTERNAL_STRIP prompt "Strip shared libraries" help Strip shared libraries copied from the external toolchain. + +config BR2_TOOLCHAIN_EXTERNAL_GDBSERVER + bool + prompt "Install the gdbserver" + help + Install the gdbserver from the external toolchain. + It is assumed that the external toolchain has been generated + by crosstool-NG, as there is no generic mechanism available + to find the location of the gdbserver. endif
toolchain/external-toolchain/ext-tool.mk +35 -0
@@ -72,6 +72,37 @@ copy_toolchain_lib_root = \ echo -n # +# Copy selected files from the toolchain debug-root to the target dir. +# +# $1: The sysroot-feature (this is used for the base of the debug-root) +# $2: The file to be installed +# $3: Destination folder on the rootfs. +# $4: strip (y|n), default is to strip +# +copy_toolchain_debugroot = \ + DEBUGROOT_DIR="$(strip $1)"/../debug-root; \ + FILE="$(strip $2)"; \ + DST="$(strip $3)"; \ + STRIP="$(strip $4)"; \ +\ + if $$($(TARGET_CROSS)cc -v 2>&1 | grep crosstool-NG 2>&1 1>/dev/null) ; then \ + echo "A Crosstool-NG generated toolchain is detected."; \ + if test -f $${DEBUGROOT_DIR}/usr/bin/$${FILE}; then \ + $(INSTALL) -m0755 $${DEBUGROOT_DIR}/usr/bin/$${FILE} $(TARGET_DIR)/$${DST}/$${FILE}; \ + case "$${STRIP}" in \ + (+ | n | no) \ +;; \ + (*) \ + $(TARGET_CROSS)strip $(TARGET_DIR)/$${DST}/$${FILE}; \ +;; \ + esac \ + fi \ + else \ + echo "Error: Not a known toolchain!"; \ + exit 1; \ + fi + +# # Copy the full external toolchain sysroot directory to the staging # dir #
@@ -227,6 +258,10 @@ endif $(Q)for libs in $(EXTERNAL_LIBS); do \ $(call copy_toolchain_lib_root,$(SYSROOT_DIR),$$libs,/lib,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \ done +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDBSERVER),y) + @echo "Copy gdbserver from the external toolchain to target..." + $(Q) $(call copy_toolchain_debugroot,$(SYSROOT_DIR),gdbserver,/usr/bin,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)) +endif @echo "Copy external toolchain sysroot to staging..." $(Q)$(call copy_toolchain_sysroot,$(SYSROOT_DIR)) @touch $@
Signature · 1 line
1.6.5.2
PATCH 1/1 Use gdbserver from external toolchain.
Hi all,
I'm resending the patch in the parent mail, this time without the RFC in the subject.
As there was hardly any comments on the patch version 2 in my previous mail thread "[RFC PATCH] Use gdbserver from external toolchain", I hope that this patch can be applied.
As is stated in the help section of the Config.in-part, this patch is only intended to be used together with an external toolchain built by crosstool-NG. The path to the gdbserver is derived as a relative path compared to the sysroot. This is done as there is no API to find neither the debug-root, nor the gdbserver binary.
Regards,
Anders Darander
Quoted 87 lines · Anders Darander
Allow the user to copy the pre-compiled gdbserver from the external toolchain to the rootfs.
It is assumed that the external toolchain has been generated with crosstool-NG, as there is no generic way to find the location of gdbserver.
Signed-off-by Anders Darander <[email protected]>---
?toolchain/external-toolchain/Config.in ? | ? ?9 +++++++ ?toolchain/external-toolchain/ext-tool.mk | ? 35 ++++++++++++++++++++++++++++++ ?2 files changed, 44 insertions(+), 0 deletions(-)toolchain/external-toolchain/Config.in +0
-0@@ -19,4 +19,13 @@ config BR2_TOOLCHAIN_EXTERNAL_STRIP? ? ? ? prompt "Strip shared libraries"
? ? ? ?help
? ? ? ? ?Strip shared libraries copied from the external toolchain.toolchain/external-toolchain/Config.in +9
-0+ +config BR2_TOOLCHAIN_EXTERNAL_GDBSERVER + ? ? ? bool + ? ? ? prompt "Install the gdbserver" + ? ? ? help + ? ? ? ? Install the gdbserver from the external toolchain. + ? ? ? ? It is assumed that the external toolchain has been generated + ? ? ? ? ?by crosstool-NG, as there is no generic mechanism available + ? ? ? ? ?to find the location of the gdbserver.?endif
toolchain/external-toolchain/ext-tool.mk +0
-0@@ -72,6 +72,37 @@ copy_toolchain_lib_root = \? ? ? ?echo -n
?#
toolchain/external-toolchain/ext-tool.mk +31
-0+# Copy selected files from the toolchain debug-root to the target dir. +# +# $1: The sysroot-feature (this is used for the base of the debug-root) +# $2: The file to be installed +# $3: Destination folder on the rootfs. +# $4: strip (y|n), default is to strip +# +copy_toolchain_debugroot = \ + ? ? ? DEBUGROOT_DIR="$(strip $1)"/../debug-root; \ + ? ? ? FILE="$(strip $2)"; \ + ? ? ? DST="$(strip $3)"; \ + ? ? ? STRIP="$(strip $4)"; \ +\ + ? ? ? if $$($(TARGET_CROSS)cc -v 2>&1 | grep crosstool-NG 2>&1 1>/dev/null) ; then \ + ? ? ? ? ? ? ? echo "A Crosstool-NG generated toolchain is detected."; \ + ? ? ? ? ? ? ? if test -f $${DEBUGROOT_DIR}/usr/bin/$${FILE}; then \ + ? ? ? ? ? ? ? ? ? ? ? $(INSTALL) -m0755 $${DEBUGROOT_DIR}/usr/bin/$${FILE} $(TARGET_DIR)/$${DST}/$${FILE}; \ + ? ? ? ? ? ? ? ? ? ? ? case "$${STRIP}" in \ + ? ? ? ? ? ? ? ? ? ? ? (+ | n | no) \ +;; \ + ? ? ? ? ? ? ? ? ? ? ? (*) \ + ? ? ? ? ? ? ? ? ? ? ? $(TARGET_CROSS)strip $(TARGET_DIR)/$${DST}/$${FILE}; \ +;; \ + ? ? ? ? ? ? ? ? ? ? ? esac \ + ? ? ? ? ? ? ? fi \ + ? ? ? else \ + ? ? ? ? ? ? ? echo "Error: Not a known toolchain!"; \ + ? ? ? ? ? ? ? exit 1; \ + ? ? ? fi + +#?# Copy the full external toolchain sysroot directory to the staging ?# dir
?#toolchain/external-toolchain/ext-tool.mk +0
-0@@ -227,6 +258,10 @@ endif ? ? ? ?$(Q)for libs in $(EXTERNAL_LIBS); do \ ? ? ? ? ? ? ? ?$(call copy_toolchain_lib_root,$(SYSROOT_DIR),$$libs,/lib,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \? ? ? ?done
toolchain/external-toolchain/ext-tool.mk +4
-0+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GDBSERVER),y) + ? ? ? @echo "Copy gdbserver from the external toolchain to target..." + ? ? ? $(Q) $(call copy_toolchain_debugroot,$(SYSROOT_DIR),gdbserver,/usr/bin,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)) +endif? ? ? ?@echo "Copy external toolchain sysroot to staging..." ? ? ? ?$(Q)$(call copy_toolchain_sysroot,$(SYSROOT_DIR)) ? ? ? ?@touch $@
--
1.6.5.2
Signature · 4 lines
Anders Darander EPO guidelines 1978: "If the contribution to the known art resides solely in a computer program then the subject matter is not patentable in whatever manner it may be presented in the claims."