From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD6F7C4338F for ; Tue, 10 Aug 2021 17:23:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0F33E61073 for ; Tue, 10 Aug 2021 17:23:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0F33E61073 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=git.sr.ht Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:50370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDVSv-0006YH-KI for qemu-devel@archiver.kernel.org; Tue, 10 Aug 2021 13:23:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDUwX-0003Zs-BH for qemu-devel@nongnu.org; Tue, 10 Aug 2021 12:49:33 -0400 Received: from mail-b.sr.ht ([173.195.146.151]:59250) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDUwV-0001wP-VR for qemu-devel@nongnu.org; Tue, 10 Aug 2021 12:49:33 -0400 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id AACCD11EF11; Tue, 10 Aug 2021 16:49:30 +0000 (UTC) From: ~archi42 Date: Tue, 10 Aug 2021 18:04:36 +0200 Subject: [PATCH qemu 1/1] docs: how to use gdb with unix sockets Message-ID: <162861417028.13673.3981098709822414721-1@git.sr.ht> X-Mailer: git.sr.ht In-Reply-To: <162861417028.13673.3981098709822414721-0@git.sr.ht> To: qemu-devel@nongnu.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Received-SPF: pass client-ip=173.195.146.151; envelope-from=outgoing@sr.ht; helo=mail-b.sr.ht X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 10 Aug 2021 13:21:40 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ~archi42 Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Sebastian Meyer Signed-off-by: Sebastian Meyer --- docs/system/gdb.rst | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst index 144d083df3..2ff4d6aab5 100644 --- a/docs/system/gdb.rst +++ b/docs/system/gdb.rst @@ -15,7 +15,8 @@ The ``-s`` option will make QEMU listen for an incoming con= nection from gdb on TCP port 1234, and ``-S`` will make QEMU not start the guest until you tell it to from gdb. (If you want to specify which TCP port to use or to use something other than TCP for the gdbstub -connection, use the ``-gdb dev`` option instead of ``-s``.) +connection, use the ``-gdb dev`` option instead of ``-s``. See +further below for an example using unix sockets.) =20 .. parsed-literal:: =20 @@ -168,3 +169,24 @@ The memory mode can be checked by sending the following = command: =20 ``maintenance packet Qqemu.PhyMemMode:0`` This will change it back to normal memory mode. + +Using unix sockets +^^^^^^^^^^^^^^^^^^ + +An alternate method for connecting gdb to the qemu gdbstub are unix +sockets (if supported by your operating system). This is useful when +running serveral tests in parallel and/or you do not know a free tcp +port a priori (e.g. when running automated tests). +First create a new chardev with the appropriate options, then +instruct the gdbserver to use that device:: + +.. parsed-literal:: + + |qemu_system| -chardev socket,path=3D/tmp/gdb-socket,server=3Don,wait=3Do= ff,id=3Dgdb0 -gdb chardev:gdb0 -S -kernel bzImage -hda rootdisk.img -append "= root=3D/dev/hda" + +Start gdb as before, but this time connect using the path to +the socket:: + + (gdb) target remote /tmp/gdb-socket + +Please mind that this usually requires gdb version 9.0 or newer. --=20 2.32.0