From patchwork Sat May 3 14:09:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 345321 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 2B35D140170 for ; Sun, 4 May 2014 00:12:18 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 751E99250A; Sat, 3 May 2014 14:12:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EpjFOt0_zDCu; Sat, 3 May 2014 14:12:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 21DEF92723; Sat, 3 May 2014 14:12:16 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id A558D1C22FB for ; Sat, 3 May 2014 14:12:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id A1400320E7 for ; Sat, 3 May 2014 14:12:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3DyknfXSuZ+r for ; Sat, 3 May 2014 14:12:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by silver.osuosl.org (Postfix) with ESMTPS id DE5C82E972 for ; Sat, 3 May 2014 14:12:12 +0000 (UTC) Received: by mail-ee0-f49.google.com with SMTP id e53so3945167eek.8 for ; Sat, 03 May 2014 07:12:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:content-transfer-encoding:subject :message-id:in-reply-to:references:user-agent:date:from:to:cc; bh=3BTaG4rZXNJNilCVj//RGOZRrl3xB2lQw3HnbfemQJQ=; b=dnwttfCQpGL+vtFH/G+zkYrFVVCOzNnc43M3i8vWVgVsmvmadBr9YAPKOYq3YNr8YC 9W9lT5A9a0rKPiMk/jH+cdIXCF4eelhq+fh1M/w0nYUQg1z4tWTP3pNqNNIP7wq0pSHs I6Lf8BVVZLcWq8PHA89BBV+3R2s8gnRkzE7JClnswRaJqdhQh/XHwAWwrELHj+5CLWze 1XEdg3SjCENNNnYNNjyBWCKKGLkToijbpDrHx3SSiHiy6Olw/c7hhRRYCpQ7USO9tY0j eVrhDRyEBJ5+f1AUx9q1tkX6A1wGpjv7os9J/1J3rSfU+r5J5zsFb6topMrGaqcKu8It wnow== X-Received: by 10.15.83.68 with SMTP id b44mr20751856eez.11.1399126331306; Sat, 03 May 2014 07:12:11 -0700 (PDT) Received: from [127.0.1.1] (d54C62EEB.access.telenet.be. [84.198.46.235]) by mx.google.com with ESMTPSA id 48sm13157033eee.2.2014.05.03.07.12.09 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 03 May 2014 07:12:10 -0700 (PDT) MIME-Version: 1.0 X-Mercurial-Node: 27dc1ac8ec611337e29ff9a3a297d7d4c6eb3a1d Message-Id: <27dc1ac8ec611337e29f.1399126192@argentina> In-Reply-To: References: User-Agent: Mercurial-patchbomb/2.2.2 Date: Sat, 03 May 2014 16:09:52 +0200 From: Thomas De Schampheleire To: buildroot@buildroot.org Cc: thomas.petazzoni@free-electrons.com, Melanie Bats , Oded Hanson Subject: [Buildroot] [PATCH 1 of 2 v2] toolchain: generate a gdbinit file X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net This commit slightly improves the external toolchain backend, and the gdb build logic to create a file named $(STAGING_DIR)/usr/share/buildroot/gdbinit which can be used as a gdbinit file using gdb -x option. This allows gdb to automatically use the proper sysroot to find libraries. The initial insight for this patch comes from the report of Oded Hanson , who found an issue with the Eclipse Buildroot plugin, which was setting a solib-path in gdb, but not a sysroot. Setting a solib-path was enough to find shared libraries, but not the dynamic linker. And since Eclipse doesn't allow to set the sysroot in any other way than giving a gdbinit file, it makes sense to have Buildroot generate a gdbinit file (which can be used in other situations than Eclipse). To achieve this, this commit introduces a gen_gdbinit_file helper in toolchain/helpers.mk, and uses it for the internal toolchain and external toolchain backends. Signed-off-by: Thomas Petazzoni [ThomasDS: minor updates in commit message] Signed-off-by: Thomas De Schampheleire --- package/gdb/gdb.mk | 2 ++ toolchain/helpers.mk | 7 +++++++ toolchain/toolchain-external/toolchain-external.mk | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk --- a/package/gdb/gdb.mk +++ b/package/gdb/gdb.mk @@ -126,5 +126,7 @@ endef HOST_GDB_POST_INSTALL_HOOKS += HOST_GDB_ADD_SYMLINK +HOST_GDB_POST_INSTALL_HOOKS += gen_gdbinit_file + $(eval $(autotools-package)) $(eval $(host-autotools-package)) diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -355,3 +355,10 @@ check_unusable_toolchain = \ echo "such as Buildroot." ; \ exit 1 ; \ fi + +# +# Generate gdbinit file for use with Buildroot +# +gen_gdbinit_file = \ + mkdir -p $(STAGING_DIR)/usr/share/buildroot/ ; \ + echo "set sysroot $(STAGING_DIR)" > $(STAGING_DIR)/usr/share/buildroot/gdbinit diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -651,6 +651,12 @@ define TOOLCHAIN_EXTERNAL_SANITIZE_KERNE -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' endef +define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT + if test -f $(TARGET_CROSS)gdb ; then \ + $(call gen_gdbinit_file) ; \ + fi +endef + # Even though we're installing things in both the staging, the host # and the target directory, we do everything within the # install-staging step, arbitrarily. @@ -659,6 +665,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_STAGIN $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC) $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT) $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER) + $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) endef $(eval $(generic-package))