From nobody Fri Dec 19 04:32:24 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1629889573; cv=none; d=zohomail.com; s=zohoarc; b=D+YKJE73CddI8GvCYbPdBmrtvdARba+MGar6r2FN68KEaz+Z/jdIPoMtKTgCMmA/wtnAZrmdJodC4kmBhxqcfWM0ppoZLgFLTFC2ReEpbFoSWwluKo64djBYye7XgaPXrm2bSKFcXzYRfxWRWJaI3mGn45QXUF6ehxHgIRn3tGw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629889573; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LLWtgW+9AQrEcf5IWz/pAYLJCA/RqHavinTg7t+HK3g=; b=Hj1ucZZ50N7WYBUNeIjidoZWVpXrF+MhJWA1M7hgN6bzNVknb0pYBRKIgEKwf0D4x+PU9YuuMkMFgbApEI9+1d4KYu6BSUNTZfGkH9m9rncL8SzYEoTeBwAGMKXlM/uj4dAWiYpLfAQv1dy/Ut4QoqmPgoC9055NP69kizx9c9Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629889573668534.1492742927417; Wed, 25 Aug 2021 04:06:13 -0700 (PDT) Received: from localhost ([::1]:42898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIqjT-0008NP-Ch for importer@patchew.org; Wed, 25 Aug 2021 07:06:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIqGV-0004sy-Qk for qemu-devel@nongnu.org; Wed, 25 Aug 2021 06:36:15 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:52906) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mIqGU-0005hH-7B for qemu-devel@nongnu.org; Wed, 25 Aug 2021 06:36:15 -0400 Received: by mail-wm1-x336.google.com with SMTP id f10so14672005wml.2 for ; Wed, 25 Aug 2021 03:36:13 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id m4sm5075931wml.28.2021.08.25.03.36.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Aug 2021 03:36:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=LLWtgW+9AQrEcf5IWz/pAYLJCA/RqHavinTg7t+HK3g=; b=CDAE0DSZLxTWYF0fcXXVfxgns8ixZaDZGbXfBJgf/AlagPwnVFnuNwyd+58Ro59xCZ 1woQmZ8pH6tZASRCdpXdFo0MHNB23toAnyICKkrSaXq8b2qezFVevCJiBez0ghbncq0d pzLHsFkErQlT3CQ0hs5pcdX9pegl8ZhcYKbzZRkPQBNrx8fOcT6Auvu7bSWS4Cjs9PfP xlyWXtCYzyB1pDuKxWW8JBUEFbpQTSbfFlhMqiK2PlEO5hVqfFzRv/leq0Ff37qTN6eq fKdEhHZE7/Cung1s2b+WLtljm4q8LTlDkAaRR1C86NcQuDnp+C35UulyEhFW2XHEkygx wAsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LLWtgW+9AQrEcf5IWz/pAYLJCA/RqHavinTg7t+HK3g=; b=kIQ0L8N4RTanFvYfEdBfYRPXBakn8Qnrf1F8Hw6yO6oO8Kf30LcZlL+RtebpWUHpob g4pAxYgApEJUWOs9DLhQ7m2zFqs6xruN2TQ1fw3yUvFZciJIk8ART+W1/M9ldqTc9PbU CfLeBmmtPt+LdMYfzw3PlPiHVGQUf84iMmJpn8zQ3eBO4ZJlNl7cDW8FQiys9PC+Cqy9 SvLsmPki0gz+IKleUw7XQPBlxSQZkYNGGiw+SON0QNG5PbInxRaYzI+Zg/hhSYJDjnvB KCrzDjAeNgoKdC3tQYabXSIxTagq2erxB418VsWNBhcGtaP+oQRa26/D4CQimua8/hPt WDkQ== X-Gm-Message-State: AOAM530UPxk0T7IcIDht5PN66SJDw0q7C/ZcfdzWS5SIyA4tHkcMcvRl 2JPdVj0wjHPazFGGulmVnFH5LmLd0h+iuw== X-Google-Smtp-Source: ABdhPJyCLSWTx/rf2G9qvnUaCgIrP6+MMvVA0HCazE/CQdSYtkkNzVtkgR9SWMr6tJic9eY/+H58+w== X-Received: by 2002:a1c:6a04:: with SMTP id f4mr8575581wmc.54.1629887772927; Wed, 25 Aug 2021 03:36:12 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 44/44] docs: Document how to use gdb with unix sockets Date: Wed, 25 Aug 2021 11:35:34 +0100 Message-Id: <20210825103534.6936-45-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210825103534.6936-1-peter.maydell@linaro.org> References: <20210825103534.6936-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::336; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1629889574703100001 From: Sebastian Meyer With gdb 9.0 and better it is possible to connect to a gdbstub over unix sockets, which is better than a TCP socket connection in some situations. The QEMU command line to set this up is non-obvious; document it. Signed-off-by: Sebastian Meyer Message-id: 162867284829.27377.4784930719350564918-0@git.sr.ht [PMM: Tweaked commit message; adjusted wording in a couple of places; fixed rST formatting issue; moved section up out of the 'advanced debugging options' subsection] Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- docs/system/gdb.rst | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst index 144d083df31..bdb42dae2fe 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 @@ -100,6 +101,29 @@ not just those in the cluster you are currently workin= g on:: =20 (gdb) set schedule-multiple on =20 +Using unix sockets +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +An alternate method for connecting gdb to the QEMU gdbstub is to use +a unix socket (if supported by your operating system). This is useful when +running several tests in parallel, or if you do not have a known free TCP +port (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 that to use a unix socket for the connection you will need +gdb version 9.0 or newer. + Advanced debugging options =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =20 --=20 2.20.1