All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] toolchain: generate a gdbinit file
Date: Wed, 5 Mar 2014 09:24:07 +0200	[thread overview]
Message-ID: <20140305072407.GD4238@tarshish> (raw)
In-Reply-To: <1393969285-13984-1-git-send-email-thomas.petazzoni@free-electrons.com>

Hi Thomas,

On Tue, Mar 04, 2014 at 10:41:24PM +0100, Thomas Petazzoni wrote:
> 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 <OHanson@xsightsys.com>, 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 that giving a gdbinit file, it makes sense to

s/that/than/

baurch

> have Buildroot generate a gdbinit file (which was 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 <thomas.petazzoni@free-electrons.com>
> ---
>  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
> index 69fb3ba..678c17c 100644
> --- 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
> index 64d5095..668a737 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -356,3 +356,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
> index 378e7b2..b45504b 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -617,6 +617,12 @@ define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
>  		-o $(HOST_DIR)/usr/bin/ext-toolchain-wrapper
>  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.
> @@ -625,6 +631,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
>  	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC)
>  	$(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT)
>  	$(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER)
> +	$(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT)
>  endef
>  
>  $(eval $(generic-package))
> -- 
> 1.8.3.2

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

      parent reply	other threads:[~2014-03-05  7:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04 21:41 [Buildroot] [PATCH 1/2] toolchain: generate a gdbinit file Thomas Petazzoni
2014-03-04 21:41 ` [Buildroot] [PATCH 2/2] docs/manual: document how to use the cross debugger Thomas Petazzoni
2014-03-05  7:19   ` Baruch Siach
2014-03-05  7:24 ` Baruch Siach [this message]

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=20140305072407.GD4238@tarshish \
    --to=baruch@tkos.co.il \
    --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.