Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] docs/manual: document how to use the cross debugger
Date: Wed, 5 Mar 2014 09:19:43 +0200	[thread overview]
Message-ID: <20140305071943.GC4238@tarshish> (raw)
In-Reply-To: <1393969285-13984-2-git-send-email-thomas.petazzoni@free-electrons.com>

Hi Thomas,

On Tue, Mar 04, 2014 at 10:41:25PM +0100, Thomas Petazzoni wrote:
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  docs/manual/advanced.txt                 |  2 ++
>  docs/manual/using-buildroot-debugger.txt | 47 ++++++++++++++++++++++++++++++++
>  2 files changed, 49 insertions(+)
>  create mode 100644 docs/manual/using-buildroot-debugger.txt
> 
> diff --git a/docs/manual/advanced.txt b/docs/manual/advanced.txt
> index fb337f5..ba74a93 100644
> --- a/docs/manual/advanced.txt
> +++ b/docs/manual/advanced.txt
> @@ -6,6 +6,8 @@ Advanced usage
>  
>  include::using-buildroot-toolchain.txt[]
>  
> +include::using-buildroot-debugger.txt[]
> +
>  include::ccache-support.txt[]
>  
>  include::download-location.txt[]
> diff --git a/docs/manual/using-buildroot-debugger.txt b/docs/manual/using-buildroot-debugger.txt
> new file mode 100644
> index 0000000..816addb
> --- /dev/null
> +++ b/docs/manual/using-buildroot-debugger.txt
> @@ -0,0 +1,47 @@
> +// -*- mode:doc; -*-
> +// vim: set syntax=asciidoc:
> +
> +Using gdb in Buildroot
> +~~~~~~~~~~~~~~~~~~~~~~
> +
> +Buildroot allows to do cross-debugging, where the debugger runs on the
> +build machine and communicates with _gdbserver_ on the target to
> +control the execution of the program.
> +
> +To achieve this:
> +
> +* In the _internal toolchain backend_, you must enable
> +  +BR2_PACKAGE_HOST_GDB+, +BR2_PACKAGE_GDB+ and
> +  +BR2_PACKAGE_GDB_SERVER+. This ensures that both the cross gdb and
> +  gdbserver gets built, and that the gdbserver gets installed to your
> +  target.
> +
> +* In the _external toolchain backend_, you should enable
> +  +BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY+, which will copy the
> +  external toolchain gdbserver to the target. If your external
> +  toolchain does not have cross gdb and gdbserver, it is also possible
> +  to build them using the same options as for the _internal toolchain
> +  backend_.

I'd rephrase to make it explicit that this is either/or. Something like "In 
case you use the {internal,external} toolchain backend ...". Users trying to 
get gdb running are quite often Buildroot beginners, so this point might not 
be apparent to them.

baruch

> +
> +Now, to start debugging a program called +foo+, you should run on the
> +target:
> +
> +----------------------------
> +gdbserver :2345 foo
> +----------------------------
> +
> +This will make +gdbserver+ listen on TCP port 2345 for a connection
> +for the cross gdb.
> +
> +Then, you should start the cross gdb using the following command line:
> +
> +----------------------------
> +./output/host/usr/bin/<tuple>-gdb -x ./output/staging/usr/share/buildroot/gdbinit foo
> +----------------------------
> +
> +Of course, +foo+ must be available in the current directory, built
> +with debugging symbols.
> +
> +The +./output/staging/usr/share/buildroot/gdbinit+ file will tell the
> +cross gdb where to find the libraries of the target.
> +
> -- 
> 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 -

  reply	other threads:[~2014-03-05  7:19 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 [this message]
2014-03-05  7:24 ` [Buildroot] [PATCH 1/2] toolchain: generate a gdbinit file Baruch Siach

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=20140305071943.GC4238@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox