From nobody Sun May 19 13:07:53 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=git.sr.ht Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1628616188029192.10062508701697; Tue, 10 Aug 2021 10:23:08 -0700 (PDT) Received: from localhost ([::1]:50370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDVT0-0006YH-Ds for importer@patchew.org; Tue, 10 Aug 2021 13:23:06 -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 (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1628616190233100002 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 c= onnection 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 followin= g 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= =3Doff,id=3Dgdb0 -gdb chardev:gdb0 -S -kernel bzImage -hda rootdisk.img -ap= pend "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