Skip to contentSkip to conversation

gdb support improvements

PATCH New Thomas Petazzoni 2 participants 6 messages Apr 7, 2013 – Apr 11, 2013

lore
Share & tools
lore
#0 lore raw

v4 cover gdb support improvements

Hello,

This patch series makes a number of improvements to gdb handling.

The first patch converts gdb to the package infrastructure and has already been sent to the list in two successive versions.

The second patch implements a suggestion from Yann E. Morin that we should allow to build gdbserver/cross-gdb if the external toolchain gdbserver is copied to the target. The idea is that if the user chooses to copy the external toolchain gdbserver to the target, then (s)he should be using the cross-gdb of the external toolchain in order to avoid any incompatibility.

The third patch makes sure that we install the gdbserver binary somewhere in the SDK, so that the Buildroot toolchain can later be used as an external toolchain. It replaces the patch proposed by Kevin Worth at http://patchwork.ozlabs.org/patch/229438/.

The fourth patch is a patch I had already sent some time ago, but which was lost. It ensures the external toolchain logic finds gdbserver for certain Sourcery CodeBench toolchains.

Changes since v3:

* Added the fourth patch

* Regenerate patches with rename detection, to make the first patch much smaller and easier to review.

* Fix the thread dependency on the first patch. Not only the full gdb depends on thread support, but even gdbserver itself depends on it. So the gdb package as a whole now depends on threads && threads_debug. The full gdb for the target additionally requires wchar support, but gdbserver itself does not.

Thanks.

Thomas Petazzoni (4):
gdb: convert to the package infrastructure
gdb: do not allow gdbserver/cross-gdb build in some cases
gdb: install gdbserver into the SDK
toolchain-external: support more gdbserver locations

 Config.in.legacy                                   |    9 +
 package/Config.in                                  |    1 +
 .../gdb/6.6a/100-uclibc-conf.patch                 |    0
 .../gdb/6.6a/600-fix-compile-flag-mismatch.patch   |    0
 .../gdb/6.6a/gdb-6.6-bfin-gdbserver.patch          |    0
 .../gdb/7.4.1/00_all_ptrace_setsiginfo.patch       |    0
 .../gdb/7.4.1/05_all_readline-headers.patch        |    0
 .../gdb/7.4.1/xtensa-asm-ptrace-h.patch            |    0
 .../gdb/7.4.1/xtensa-gdb-regsize.patch             |    0
 package/gdb/Config.in                              |   46 ++++
 package/gdb/Config.in.host                         |   60 +++++
 package/gdb/gdb.mk                                 |  115 ++++++++++
 toolchain/Config.in                                |    2 -
 toolchain/gdb/Config.in                            |   99 ---------
 toolchain/gdb/gdb.mk                               |  234 --------------------
 toolchain/toolchain-buildroot.mk                   |    1 -
 toolchain/toolchain-buildroot/Config.in.2          |    7 +
 toolchain/toolchain-common.in                      |    7 +-
 toolchain/toolchain-crosstool-ng.mk                |    1 -
 toolchain/toolchain-crosstool-ng/Config.in         |    3 +
 toolchain/toolchain-external.mk                    |    1 -
 toolchain/toolchain-external/Config.in             |    7 +
 toolchain/toolchain-external/ext-tool.mk           |    6 +-
 toolchain/uClibc/Config.in                         |    6 -
 24 files changed, 252 insertions(+), 353 deletions(-)
 rename {toolchain => package}/gdb/6.6a/100-uclibc-conf.patch (100%)
 rename {toolchain => package}/gdb/6.6a/600-fix-compile-flag-mismatch.patch (100%)
 rename {toolchain => package}/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch (100%)
 rename {toolchain => package}/gdb/7.4.1/00_all_ptrace_setsiginfo.patch (100%)
 rename {toolchain => package}/gdb/7.4.1/05_all_readline-headers.patch (100%)
 rename {toolchain => package}/gdb/7.4.1/xtensa-asm-ptrace-h.patch (100%)
 rename {toolchain => package}/gdb/7.4.1/xtensa-gdb-regsize.patch (100%)
 create mode 100644 package/gdb/Config.in
 create mode 100644 package/gdb/Config.in.host
 create mode 100644 package/gdb/gdb.mk
 delete mode 100644 toolchain/gdb/Config.in
 delete mode 100644 toolchain/gdb/gdb.mk
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v4 1/4 gdb: convert to the package infrastructure

This commit converts gdb to the package infrastructure, and therefore moves it from toolchain/gdb to package/gdb.

The target package is now visible in "Package selection for the target" => "Debugging, profiling and benchmark". The main option, "gdb", forcefully selects the "gdbserver" sub-option by default. Another sub-option, "full debugger" allows to install the complete gdb on the target. When this option is enabled, then "gdbserver" is no longer forcefully selected. This ensures that at least gdbserver or the full debugger gets built/installed, so that the package is not a no-op.

The host debugger is still enabled through a configuration option in "Toolchain". It is now visible regardless of the toolchain type (it used to be hidden for External Toolchains). The configuration options relative to the host debugger are now in package/gdb/Config.in.host, similar to how we have package/binutils/Config.in.host.

Since gdb is now a proper package, it is no longer allowed to 'select BR2_PTHREADS_DEBUG' to ensure thread debugging is available when needed. Instead, it now 'depends on BR2_TOOLCHAIN_HAS_THREADS_DEBUG'. This option, in turn, is selected by the different toolchain backends when appropriate. The 'BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED' option is removed, since we no longer need to know when it is allowed to 'select BR2_PTHREADS_DEBUG'. Also, the 'BR2_PTHREADS_DEBUG' option is moved to appear right below the thread implementation selection (in the case of the Buildroot toolchain backend).

---
Changes from v3 to v4:

* Fixed the dependency logic to require thread support, because it is actually required in all cases for gdb 7.x.

Changes from v2 to v3:

* Fixed the dependency logic to ensure that thread debugging support is available when building gdbserver on a toolchain that has thread support. Spotted by Gustavo's testing, and by Peter's review.

Strictly speaking, this is only needed for 7.x gdb versions, but 6.x versions are now only used on bfin and avr32. And while the only bfin version selectable is 6.6, avr32 is not restricted to its default 6.7 version, so we can't really on the architecture selection to decide whether we're building a 6.x or a 7.x gdb version.

Changes from v1 to v2:

* Fixup the help text of BR2_PACKAGE_GDB to mention in which menu the cross-gdb can be enable, and the fact that external toolchains often provide their own pre-built versions of cross-gdb and gdbserver. Suggested by Arnout.

* No longer 'select BR2_PTHREAD_DEBUG' from the gdb package. As Arnout noticed, now that gdb is a normal package, it should not forcefully select a toolchain configuration option. Instead, it should depend on it being available. This allows to remove the BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED option: we now only have the BR2_TOOLCHAIN_HAS_THREADS_DEBUG, which gets selected by the various toolchain backends when appropriate, and the gdb package depends on it.

* Factorize the definition of GDB_SITE. Suggested by Arnout.

* Add a small comment that explains why we remove /usr/share/gdb from the target. Suggested by Arnout.

---
 Config.in.legacy                                   |    9 +
 package/Config.in                                  |    1 +
 .../gdb/6.6a/100-uclibc-conf.patch                 |    0
 .../gdb/6.6a/600-fix-compile-flag-mismatch.patch   |    0
 .../gdb/6.6a/gdb-6.6-bfin-gdbserver.patch          |    0
 .../gdb/7.4.1/00_all_ptrace_setsiginfo.patch       |    0
 .../gdb/7.4.1/05_all_readline-headers.patch        |    0
 .../gdb/7.4.1/xtensa-asm-ptrace-h.patch            |    0
 .../gdb/7.4.1/xtensa-gdb-regsize.patch             |    0
 package/gdb/Config.in                              |   41 ++++
 package/gdb/Config.in.host                         |   56 +++++
 package/gdb/gdb.mk                                 |  101 +++++++++
 toolchain/Config.in                                |    2 -
 toolchain/gdb/Config.in                            |   99 ---------
 toolchain/gdb/gdb.mk                               |  234 --------------------
 toolchain/toolchain-buildroot.mk                   |    1 -
 toolchain/toolchain-buildroot/Config.in.2          |    7 +
 toolchain/toolchain-common.in                      |    7 +-
 toolchain/toolchain-crosstool-ng.mk                |    1 -
 toolchain/toolchain-crosstool-ng/Config.in         |    3 +
 toolchain/toolchain-external.mk                    |    1 -
 toolchain/toolchain-external/Config.in             |    7 +
 toolchain/uClibc/Config.in                         |    6 -
 23 files changed, 226 insertions(+), 350 deletions(-)
 rename {toolchain => package}/gdb/6.6a/100-uclibc-conf.patch (100%)
 rename {toolchain => package}/gdb/6.6a/600-fix-compile-flag-mismatch.patch (100%)
 rename {toolchain => package}/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch (100%)
 rename {toolchain => package}/gdb/7.4.1/00_all_ptrace_setsiginfo.patch (100%)
 rename {toolchain => package}/gdb/7.4.1/05_all_readline-headers.patch (100%)
 rename {toolchain => package}/gdb/7.4.1/xtensa-asm-ptrace-h.patch (100%)
 rename {toolchain => package}/gdb/7.4.1/xtensa-gdb-regsize.patch (100%)
 create mode 100644 package/gdb/Config.in
 create mode 100644 package/gdb/Config.in.host
 create mode 100644 package/gdb/gdb.mk
 delete mode 100644 toolchain/gdb/Config.in
 delete mode 100644 toolchain/gdb/gdb.mk
Config.in.legacy +9 -0
index 43e2afe..2bdef1f 100644
@@ -67,6 +67,15 @@ config BR2_PACKAGE_GDISK_SGDISK
 	help
 	  The option has been renamed BR2_PACKAGE_GPTFDISK_SGDISK.
 
+config BR2_PACKAGE_GDB_HOST
+	bool "gdb for the host option has been renamed"
+	select BR2_PACKAGE_HOST_GDB
+	select BR2_LEGACY
+	help
+	  Due to the conversion of gdb to the package infrastructure,
+	  the BR2_PACKAGE_GDB_HOST option has been renamed
+	  BR2_PACKAGE_HOST_GDB.
+
 #
 # Legacy options since 2012.11
 #
package/Config.in +1 -0
index 69d87f0..97ba790 100644
@@ -22,6 +22,7 @@ source "package/cache-calibrator/Config.in"
 source "package/dhrystone/Config.in"
 source "package/dstat/Config.in"
 source "package/dmalloc/Config.in"
+source "package/gdb/Config.in"
 source "package/kexec/Config.in"
 source "package/latencytop/Config.in"
 source "package/lmbench/Config.in"
package/gdb/6.6a/100-uclibc-conf.patch renamed from toolchain/gdb/6.6a/100-uclibc-conf.patch +0 -0
similarity index 100%
rename from toolchain/gdb/6.6a/100-uclibc-conf.patch
rename to package/gdb/6.6a/100-uclibc-conf.patch
package/gdb/6.6a/600-fix-compile-flag-mismatch.patch renamed from toolchain/gdb/6.6a/600-fix-compile-flag-mismatch.patch +0 -0
similarity index 100%
rename from toolchain/gdb/6.6a/600-fix-compile-flag-mismatch.patch
rename to package/gdb/6.6a/600-fix-compile-flag-mismatch.patch
package/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch renamed from toolchain/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch +0 -0
similarity index 100%
rename from toolchain/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch
rename to package/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch
package/gdb/7.4.1/00_all_ptrace_setsiginfo.patch renamed from toolchain/gdb/7.4.1/00_all_ptrace_setsiginfo.patch +0 -0
similarity index 100%
rename from toolchain/gdb/7.4.1/00_all_ptrace_setsiginfo.patch
rename to package/gdb/7.4.1/00_all_ptrace_setsiginfo.patch
package/gdb/7.4.1/05_all_readline-headers.patch renamed from toolchain/gdb/7.4.1/05_all_readline-headers.patch +0 -0
similarity index 100%
rename from toolchain/gdb/7.4.1/05_all_readline-headers.patch
rename to package/gdb/7.4.1/05_all_readline-headers.patch
package/gdb/7.4.1/xtensa-asm-ptrace-h.patch renamed from toolchain/gdb/7.4.1/xtensa-asm-ptrace-h.patch +0 -0
similarity index 100%
rename from toolchain/gdb/7.4.1/xtensa-asm-ptrace-h.patch
rename to package/gdb/7.4.1/xtensa-asm-ptrace-h.patch
package/gdb/7.4.1/xtensa-gdb-regsize.patch renamed from toolchain/gdb/7.4.1/xtensa-gdb-regsize.patch +0 -0
similarity index 100%
rename from toolchain/gdb/7.4.1/xtensa-gdb-regsize.patch
rename to package/gdb/7.4.1/xtensa-gdb-regsize.patch
package/gdb/Config.in new file +41 -0

41 lines not on this page · raw message

package/gdb/Config.in.host new file +56 -0

56 lines not on this page · raw message

package/gdb/gdb.mk new file +101 -0

101 lines not on this page · raw message

toolchain/Config.in +0 -2
index f1cca14..fa78cf4 100644
@@ -12,7 +12,6 @@ config BR2_TOOLCHAIN_BUILDROOT
 	bool "Buildroot toolchain"
 	depends on !BR2_microblaze && !BR2_aarch64
 	select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
-	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED
 
 config BR2_TOOLCHAIN_EXTERNAL
 	bool "External toolchain"
@@ -25,7 +24,6 @@ config BR2_TOOLCHAIN_CTNG
 	bool "Crosstool-NG toolchain"
 	depends on !BR2_microblaze && !BR2_aarch64 && !BR2_xtensa
 	select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
-	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED
 	help
 	  Say 'y' if you want to generate the toolchain with crosstool-NG
 	  (http://crosstool-ng.org).
toolchain/gdb/Config.in deleted +0 -99

99 lines not on this page · raw message

toolchain/gdb/gdb.mk deleted +0 -234

234 lines not on this page · raw message

toolchain/toolchain-buildroot.mk +0 -1
index adab0f7..5493177 100644
@@ -2,6 +2,5 @@
 
 include toolchain/elf2flt/elf2flt.mk
 include toolchain/gcc/gcc-uclibc-4.x.mk
-include toolchain/gdb/gdb.mk
 include toolchain/kernel-headers/kernel-headers.mk
 include toolchain/uClibc/uclibc.mk
toolchain/toolchain-buildroot/Config.in.2 +7 -0
index a713727..7f19b09 100644
@@ -99,6 +99,13 @@ choice
 		depends on !BR2_xtensa
 endchoice
 
+config BR2_PTHREAD_DEBUG
+	bool "Thread library debugging"
+	depends on BR2_PTHREADS || BR2_PTHREADS_OLD || BR2_PTHREADS_NATIVE
+	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
+	help
+	  Build the thread library with debugging enabled.
+
 source "toolchain/elf2flt/Config.in"
 
 config BR2_VFP_FLOAT
toolchain/toolchain-common.in +1 -6
index f6905ae..208ccac 100644
@@ -3,7 +3,7 @@
 # we want gdb config in the middle of both source and external
 # toolchains, but mconf won't let us source the same file twice,
 # so put it here instead
-source "toolchain/gdb/Config.in"
+source "package/gdb/Config.in.host"
 
 config BR2_LARGEFILE
 	bool
@@ -27,11 +27,6 @@ config BR2_TOOLCHAIN_HAS_THREADS
 	bool
 
 config BR2_TOOLCHAIN_HAS_THREADS_DEBUG
-	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED
-	bool
-
-config BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED
-	default y if !BR2_TOOLCHAIN_HAS_THREADS
 	bool
 
 config BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
toolchain/toolchain-crosstool-ng.mk +0 -1
index d677256..d1e7552 100644
@@ -4,6 +4,5 @@
 include toolchain/helpers.mk
 include toolchain/elf2flt/elf2flt.mk
 include toolchain/gcc/gcc-uclibc-4.x.mk
-include toolchain/gdb/gdb.mk
 include toolchain/toolchain-crosstool-ng/crosstool-ng.mk
 include toolchain/uClibc/uclibc.mk
toolchain/toolchain-crosstool-ng/Config.in +3 -0
index df4e9b1..93c12e9 100644
@@ -121,15 +121,18 @@ choice
 	config BR2_TOOLCHAIN_CTNG_THREADS_PTHREADS
 		bool "linuxthreads"
 		select BR2_TOOLCHAIN_HAS_THREADS
+		select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 
 	config BR2_TOOLCHAIN_CTNG_THREADS_PTHREADS_OLD
 		bool "linuxthreads (stable/old)"
 		select BR2_TOOLCHAIN_HAS_THREADS
+		select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 		depends on BR2_TOOLCHAIN_CTNG_uClibc
 
 	config BR2_TOOLCHAIN_CTNG_THREADS_NPTL
 		bool "Native POSIX Threading (NPTL)"
 		select BR2_TOOLCHAIN_HAS_THREADS
+		select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 endchoice
 
 endif # BR2_TOOLCHAIN_CTNG
toolchain/toolchain-external.mk +0 -1
index 4292d85..9999aa2 100644
@@ -3,7 +3,6 @@
 include toolchain/helpers.mk
 include toolchain/elf2flt/elf2flt.mk
 include toolchain/gcc/gcc-uclibc-4.x.mk
-include toolchain/gdb/gdb.mk
 include toolchain/kernel-headers/kernel-headers.mk
 include toolchain/toolchain-external/ext-tool.mk
 include toolchain/uClibc/uclibc.mk
toolchain/toolchain-external/Config.in +7 -0
index d2f3926..e61378b 100644
@@ -913,5 +913,12 @@ config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
 
 endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM
 
+config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
+	bool "Copy gdb server to the Target"
+	depends on BR2_TOOLCHAIN_EXTERNAL
+	help
+	  Copy the gdbserver provided by the external toolchain to the
+	  target.
+
 endif # BR2_TOOLCHAIN_EXTERNAL
 
toolchain/uClibc/Config.in +0 -6
index 57c9933..cebad45 100644
@@ -53,12 +53,6 @@ config BR2_UCLIBC_CONFIG
 	  See also docs/README in this package.
 	  If unsure, use the default.
 
-config BR2_PTHREAD_DEBUG
-	bool "Thread library debugging"
-	depends on BR2_PTHREADS || BR2_PTHREADS_OLD || BR2_PTHREADS_NATIVE
-	help
-	  Build the thread library with debugging enabled.
-
 config BR2_UCLIBC_INSTALL_TEST_SUITE
 	bool "Compile and install uClibc tests"
 	select BR2_PACKAGE_MAKE
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v4 2/4 gdb: do not allow gdbserver/cross-gdb build in some cases

In reply to Thomas Petazzoni

When an external toolchain is used, and the user has chosen to copy the external toolchain gdbserver to the target, then we should allow the user to build a gdbserver and/or a cross-gdb: the ones of the external toolchain should be used.

The reasoning is that one must use a gdbserver and cross-gdb of identical versions to be sure that debugging will work properly.

Change suggested by Yann E. Morin.

---
 package/gdb/Config.in      |    7 ++++++-
 package/gdb/Config.in.host |    4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)
package/gdb/Config.in +6 -1
index 6eb29d5..38f4564 100644
@@ -3,7 +3,11 @@ comment "gdb/gdbserver require a toolchain with thread and thread debug support"
 
 config BR2_PACKAGE_GDB
 	bool "gdb"
-	select BR2_PACKAGE_GDB_SERVER if !BR2_PACKAGE_GDB_DEBUGGER
+	# When the external toolchain gdbserver is copied to the
+	# target, we don't allow building a separate gdbserver. The
+	# one from the external toolchain should be used.
+	select BR2_PACKAGE_GDB_SERVER if \
+	       (!BR2_PACKAGE_GDB_DEBUGGER && !BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)
 	depends on BR2_TOOLCHAIN_HAS_THREADS && BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 	help
 	  GDB, the GNU Project debugger, allows you to see what is
@@ -25,6 +29,7 @@ if BR2_PACKAGE_GDB
 
 config BR2_PACKAGE_GDB_SERVER
 	bool "gdbserver"
+	depends on !BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
 	help
 	  Build the gdbserver stub to run on the target.
 	  A full gdb is needed to debug the progam.
package/gdb/Config.in.host +4 -0
index 223c426..1e09263 100644
@@ -1,5 +1,9 @@
 config BR2_PACKAGE_HOST_GDB
 	bool "Build cross gdb for the host"
+	# When the external toolchain gdbserver is used, we shouldn't
+	# allow to build a cross-gdb, as the one of the external
+	# toolchain should be used.
+	depends on !BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
 	help
 	  Build a cross gdb that runs on the host machine and debugs
 	  programs running on the target. It requires 'gdbserver'
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v4 3/4 gdb: install gdbserver into the SDK

In reply to Thomas Petazzoni

In order for a Buildroot toolchain to be usable as an external toolchain, we should copy the target gdbserver somewhere into $(HOST_DIR). In order to match what Crosstool-NG does (and therefore to match something the external toolchain logic already understands), we install gdbserver in $(HOST_DIR)/usr/<tuple>/debug-root/usr/bin/gdbserver.

---
This replaces http://patchwork.ozlabs.org/patch/229438/

---
 package/gdb/gdb.mk |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
package/gdb/gdb.mk +14 -0
index 24ce9bf..cec64d5 100644
@@ -78,6 +78,20 @@ endef
 
 GDB_POST_INSTALL_TARGET_HOOKS += GDB_REMOVE_UNNEEDED_FILES
 
+# This installs the gdbserver somewhere into the $(HOST_DIR) so that
+# it becomes an integral part of the SDK, if the toolchain generated
+# by Buildroot is later used as an external toolchain. We install it
+# in debug-root/usr/bin/gdbserver so that it matches what Crosstool-NG
+# does.
+define GDB_SDK_INSTALL_GDBSERVER
+	$(INSTALL) -D -m 0755 $(TARGET_DIR)/usr/bin/gdbserver \
+		$(HOST_DIR)/usr/$(GNU_TARGET_NAME)/debug-root/usr/bin/gdbserver
+endef
+
+ifeq ($(BR2_PACKAGE_GDB_SERVER),y)
+GDB_POST_INSTALL_TARGET_HOOKS += GDB_SDK_INSTALL_GDBSERVER
+endif
+
 # A few notes:
 #  * --target, because we're doing a cross build rather than a real
 #    host build.
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v4 4/4 toolchain-external: support more gdbserver locations

In reply to Thomas Petazzoni

The x86/x86-64 CodeSourcery toolchains use some weird locations for the gdbserver binary:

$ find . -name 'gdbserver'
./i686-pc-linux-gnu/libc/atom/usr/bin/gdbserver
./i686-pc-linux-gnu/libc/atom/usr/lib/bin/gdbserver
./i686-pc-linux-gnu/libc/core2/usr/bin/gdbserver
./i686-pc-linux-gnu/libc/core2/usr/lib64/bin/gdbserver
./i686-pc-linux-gnu/libc/usr/lib/bin/gdbserver
./i686-pc-linux-gnu/libc/usr/lib64/bin/gdbserver

Notice that it's sometimes hidden in a usr/{lib,lib64}/bin directory. This patch changes the gdbserver logic to also try in this location.

Originally based on work done by Daniel Nilsson, visible at
http://patchwork.ozlabs.org/patch/155767/.

---
 toolchain/toolchain-external/ext-tool.mk |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
toolchain/toolchain-external/ext-tool.mk +3 -3
index 5f467b7..911527c 100644
@@ -444,9 +444,9 @@ $(STAMP_DIR)/ext-toolchain-installed: $(STAMP_DIR)/ext-toolchain-checked
 	if test x"$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" == x"y"; then \
 		$(call MESSAGE,"Copying gdbserver") ; \
 		gdbserver_found=0 ; \
-		for d in $${ARCH_SYSROOT_DIR} $${ARCH_SYSROOT_DIR}/../debug-root/ ; do \
-			if test -f $${d}/usr/bin/gdbserver ; then \
-				install -m 0755 -D $${d}/usr/bin/gdbserver $(TARGET_DIR)/usr/bin/gdbserver ; \
+		for d in $${ARCH_SYSROOT_DIR}/usr $${ARCH_SYSROOT_DIR}/../debug-root/usr $${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} ; do \
+			if test -f $${d}/bin/gdbserver ; then \
+				install -m 0755 -D $${d}/bin/gdbserver $(TARGET_DIR)/usr/bin/gdbserver ; \
 				gdbserver_found=1 ; \
 				break ; \
 			fi ; \
Signature · 1 line
1.7.9.5
#5 lore raw

v4 cover gdb support improvements

In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> Hello,
Thomas> This patch series makes a number of improvements to gdb handling.

Thomas> The first patch converts gdb to the package infrastructure and has Thomas> already been sent to the list in two successive versions.

Thomas> The second patch implements a suggestion from Yann E. Morin that we Thomas> should allow to build gdbserver/cross-gdb if the external toolchain Thomas> gdbserver is copied to the target. The idea is that if the user Thomas> chooses to copy the external toolchain gdbserver to the target, then Thomas> (s)he should be using the cross-gdb of the external toolchain in order Thomas> to avoid any incompatibility.

Thomas> The third patch makes sure that we install the gdbserver binary Thomas> somewhere in the SDK, so that the Buildroot toolchain can later be Thomas> used as an external toolchain. It replaces the patch proposed by Kevin Thomas> Worth at http://patchwork.ozlabs.org/patch/229438/.

Thomas> The fourth patch is a patch I had already sent some time ago, but Thomas> which was lost. It ensures the external toolchain logic finds Thomas> gdbserver for certain Sourcery CodeBench toolchains.

Committed series, thanks.

Signature · 1 line
Bye, Peter Korsgaard