From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2 of 2 v3] docs/manual: document how to use the cross debugger
Date: Mon, 05 May 2014 08:59:06 +0200 [thread overview]
Message-ID: <4e03735812e47df083a2.1399273146@argentina> (raw)
In-Reply-To: <patchbomb.1399273144@argentina>
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[ThomasDS: some rewording, add <buildroot> path prefix in example]
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
v3: retain proper authorship of ThomasP
v2: some rewording, taking into account the comment of Baruch, also
clarifying the example command (typically foo is not in the buildroot root).
docs/manual/advanced.txt | 2 +
docs/manual/using-buildroot-debugger.txt | 49 +++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)
create mode 100644 docs/manual/using-buildroot-debugger.txt
diff --git a/docs/manual/advanced.txt b/docs/manual/advanced.txt
--- a/docs/manual/advanced.txt
+++ b/docs/manual/advanced.txt
@@ -5,6 +5,8 @@
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
--- /dev/null
+++ b/docs/manual/using-buildroot-debugger.txt
@@ -0,0 +1,48 @@
+// -*- 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:
+
+* If you are using an _internal toolchain_ (built by Buildroot), you
+ must enable +BR2_PACKAGE_HOST_GDB+, +BR2_PACKAGE_GDB+ and
+ +BR2_PACKAGE_GDB_SERVER+. This ensures that both the cross gdb and
+ gdbserver get built, and that gdbserver gets installed to your target.
+
+* If you are using an _external toolchain_, you should enable
+ +BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY+, which will copy the
+ gdbserver included with the external toolchain to the target. If your
+ external toolchain does not have a cross gdb or gdbserver, it is also
+ possible to let Buildroot build them, by enabling the same options as
+ for the _internal toolchain backend_.
+
+Now, to start debugging a program called +foo+, you should run on the
+target:
+
+----------------------------
+gdbserver :2345 foo
+----------------------------
+
+This will cause +gdbserver+ to listen on TCP port 2345 for a connection
+from the cross gdb.
+
+Then, on the host, you should start the cross gdb using the following
+command line:
+
+----------------------------
+<buildroot>/output/host/usr/bin/<tuple>-gdb -x <buildroot>/output/staging/usr/share/buildroot/gdbinit foo
+----------------------------
+
+Of course, +foo+ must be available in the current directory, built
+with debugging symbols. Typically you start this command from the
+directory where +foo+ is built (and not from +output/target/+ as the
+binaries in that directory are stripped).
+
+The +<buildroot>/output/staging/usr/share/buildroot/gdbinit+ file will tell the
+cross gdb where to find the libraries of the target.
+
next prev parent reply other threads:[~2014-05-05 6:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-05 6:59 [Buildroot] [PATCH 0 of 2 v3] Using gdb in buildroot Thomas De Schampheleire
2014-05-05 6:59 ` [Buildroot] [PATCH 1 of 2 v3] toolchain: generate a gdbinit file Thomas De Schampheleire
2014-05-05 6:59 ` Thomas De Schampheleire [this message]
2014-05-05 9:01 ` [Buildroot] [PATCH 2 of 2 v3] docs/manual: document how to use the cross debugger Samuel Martin
-- strict thread matches above, loose matches on Subject: below --
2014-05-05 9:23 [Buildroot] [PATCH 0 of 2 v3] Using gdb in buildroot Thomas De Schampheleire
2014-05-05 9:24 ` [Buildroot] [PATCH 2 of 2 v3] docs/manual: document how to use the cross debugger Thomas De Schampheleire
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=4e03735812e47df083a2.1399273146@argentina \
--to=patrickdepinguin@gmail.com \
--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