gdb: install gdbserver into the SDK
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 7 Apr 2013 00:04:35 +0000 (00:04 +0000)
committerPeter Korsgaard <jacmet@sunsite.dk>
Thu, 11 Apr 2013 19:47:16 +0000 (21:47 +0200)
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.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
package/gdb/gdb.mk

index 24ce9bf2101a9c72a69ebc7aae7f91fde32c29ea..cec64d5c834758b41c0982e0ebe667ad96c81858 100644 (file)
@@ -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.