From nobody Sun May 19 13:14:42 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 1628672981142195.12226110536142; Wed, 11 Aug 2021 02:09:41 -0700 (PDT) Received: from localhost ([::1]:52418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDkF2-00053c-3n for importer@patchew.org; Wed, 11 Aug 2021 05:09:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDkCy-0008E5-5x for qemu-devel@nongnu.org; Wed, 11 Aug 2021 05:07:32 -0400 Received: from mail-b.sr.ht ([173.195.146.151]:56454) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDkCw-0000en-Pg for qemu-devel@nongnu.org; Wed, 11 Aug 2021 05:07:31 -0400 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id 85DA111EEAC for ; Wed, 11 Aug 2021 09:07:28 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=none From: ~archi42 Date: Tue, 10 Aug 2021 18:04:36 +0200 Subject: [PATCH qemu v2] docs: how to use gdb with unix sockets (v2) Message-ID: <162867284829.27377.4784930719350564918-0@git.sr.ht> X-Mailer: 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: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_12_24=1.049, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1628672981757100003 From: Sebastian Meyer This includes the changes suggested by Philippe. I kept the `-S` in the command line. The user shall use that instead of `wait=3Don`. Signed-off-by: Sebastian Meyer Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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..f7411cb8ed 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 +`Using unix sockets`_ for an example.) =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 several tests in parallel and/or you do not have a free TCP +port a priori (e.g. when running automated tests). +First create a 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 ... + +Start gdb as before, but this time connect using the path to +the socket:: + + (gdb) target remote /tmp/gdb-socket + +Note gdb version 9.0 or newer is required. --=20 2.32.0