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=-12.7 required=3.0 tests=BAYES_00,DATE_IN_PAST_12_24, 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 656E3C432BE for ; Wed, 11 Aug 2021 09:09:38 +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 A260960FC3 for ; Wed, 11 Aug 2021 09:09:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A260960FC3 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]:52418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDkEy-00053c-Jr for qemu-devel@archiver.kernel.org; Wed, 11 Aug 2021 05:09:36 -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 Authentication-Results: mail-b.sr.ht; dkim=none 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) 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 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 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 +`Using unix sockets`_ for an example.) =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 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=3Do= ff,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