From patchwork Mon May 5 09:25:51 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: 345645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id E35F614030A for ; Mon, 5 May 2014 19:28:34 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 20BCA8B2A6; Mon, 5 May 2014 09:28:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ig76SbEr6b0I; Mon, 5 May 2014 09:28:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id E2FDA8B230; Mon, 5 May 2014 09:28:31 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 633601C2434 for ; Mon, 5 May 2014 09:28:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 5F4B28ACE8 for ; Mon, 5 May 2014 09:28:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AVmC1xvpZP+v for ; Mon, 5 May 2014 09:28:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by whitealder.osuosl.org (Postfix) with ESMTPS id 8EA9C8AE5A for ; Mon, 5 May 2014 09:28:27 +0000 (UTC) Received: by mail-wg0-f47.google.com with SMTP id x12so5332671wgg.6 for ; Mon, 05 May 2014 02:28:25 -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=4St9FoJtJRC8lGxoHmxdA+e7sDzPVXLEt4QhMNADWX4=; b=OoOsHwYGom6eVpprRJuS1mYE3ma+5Ur1ZKd4nJivXKx2dm9phzocCbRz8PW+4xk2uO 6+kA2CZwgu10a0GVkO/vGIbnrEns8IHFfb7mfXzthNCz90JkIM6vuS2ZKTH1MOD7Rd/Q ksYjWy780o/2GHzLTBn0AooZYmXA5F6/5r8oh/qOnzJ/DfgoOiUokFYBD9EX4Gu375Rz QdTCsLME8zGudfCF5vA7dfXvVINuHH94WEEqnDBuMq5zUUVlnbrdtWvKv0qp8cGj8jMQ PG34b/sq+K1VGBXcA71TuitFPN1aIOuiaLlSuJh2OXnEPBNdj/ARnSAnqsL8PSn3fPWD S6dA== X-Received: by 10.180.103.5 with SMTP id fs5mr14780513wib.33.1399282105434; Mon, 05 May 2014 02:28:25 -0700 (PDT) Received: from [127.0.1.1] (alc112.alcatel.be. [195.207.101.112]) by mx.google.com with ESMTPSA id u1sm16089995wjx.16.2014.05.05.02.28.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 02:28:24 -0700 (PDT) MIME-Version: 1.0 X-Mercurial-Node: 8af4a6986e373b11c6c755411e0d65d542284713 Message-Id: <8af4a6986e373b11c6c7.1399281951@argentina> In-Reply-To: References: User-Agent: Mercurial-patchbomb/2.2.2 Date: Mon, 05 May 2014 11:25:51 +0200 From: Thomas De Schampheleire To: buildroot@buildroot.org Cc: thomas.petazzoni@free-electrons.com, Melanie Bats , Oded Hanson Subject: [Buildroot] [PATCH 2 of 2 v4] docs/manual: document how to use the cross debugger 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 From: Thomas Petazzoni Signed-off-by: Thomas Petazzoni [ThomasDS: some rewording, add path prefix in example] Signed-off-by: Thomas De Schampheleire --- v4: add 'target remote' command line (Samuel) 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 | 53 +++++++++++++++++++++++++++ 2 files changed, 55 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,53 @@ +// -*- 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: + +---------------------------- +/output/host/usr/bin/-gdb -x /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 +/output/staging/usr/share/buildroot/gdbinit+ file will tell the +cross gdb where to find the libraries of the target. + +Finally, to connect to the target from the cross gdb: + +---------------------------- +(gdb) target remote :2345 +----------------------------