From patchwork Mon Nov 20 15:08:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 745369 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1345830wrt; Mon, 20 Nov 2023 07:11:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEX1AD3tqRRYcqLcUwabh8T7LFZ9W7nkDNq4UvFihMFJ7cGWprNkuSRgbPFjXFTWh8DMCj0 X-Received: by 2002:a2e:2243:0:b0:2c8:35a2:ab4c with SMTP id i64-20020a2e2243000000b002c835a2ab4cmr5076838lji.24.1700493117639; Mon, 20 Nov 2023 07:11:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700493117; cv=none; d=google.com; s=arc-20160816; b=H4bnyf4VVIfeyhU2wwyUS2mWwT8+VYnIoE5zZbZelJBhpbN9saYfcI0oyPz4A52gGp kpgs4MZfqX9bYm5zWHvfqd+OawMcr9k3IgL8qLmEEVSPnoBZ5+rHjKxgs/HvY/A4trH9 4xHQlaYvBqEJW5Oj3gjiv2/rNX2gJmE8EEHWrPwdAd9Irp/9snR8rCwvgBsS7RbFNIMG ve1EK+s8bBhVYJtHs7EvIsAJPQWnJ1JwTl4LuK0w/zsG0HZrtetkh1J+2yJXhUBmDBNv ljoMXa76hAhrYDW4vnGG0/wwzTFGrsTwjymh6LFwqb5gQWxs6HB4tjTCVOyCSQC/Pd+a iOCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nFCIY8a2prU+vxKx/Khs2e4u+A5y+AyU+weaY1KLmL0=; fh=L8gboe2BpnMHPozXPXZ1zwcw4kd4+Ep8z61Ccww9Lhk=; b=QrqVITkhh0ZsBc54vsQDJ3SYiZt8j7tMcMidGEV0O7FWPaiDarDCKjNoztXEiYKVgZ woLokdcdXKdH6jqgzZSe864CR12Z4pyZ3xqDi6rlY/Bu6Q1Gks4YlrfJBnGr/rkKsnP0 zLe+F8StNJxcZCSezqJ77ZjndTg9DlKbWPQmu1SVtRafiVMKHccxvEIeZhtExon7LfGK 7nMZyz9eX+UsJHMA6eKeF5ZWQWyrtnK0HmkInmZEj5HpYLq/UIdVyLBRbsRc25+yryMW CEWmxLT8zr0GFsYZI4/F794rSs9rEKxCncXUloBdzj3WkqklYSp95yOopruLslpHsarT IQKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oIuUzylE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f15-20020a05600c4e8f00b004077ebd5ab1si4967790wmq.28.2023.11.20.07.11.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Nov 2023 07:11:57 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oIuUzylE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r55tf-0006L0-G7; Mon, 20 Nov 2023 10:09:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r55tL-0005qL-8l for qemu-devel@nongnu.org; Mon, 20 Nov 2023 10:08:56 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r55tA-0001Cv-7s for qemu-devel@nongnu.org; Mon, 20 Nov 2023 10:08:49 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4084095722aso19156265e9.1 for ; Mon, 20 Nov 2023 07:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700492918; x=1701097718; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nFCIY8a2prU+vxKx/Khs2e4u+A5y+AyU+weaY1KLmL0=; b=oIuUzylEAc/Mtmflle9r+o+O2IPhKKxloPSQZxmSJjqmklXenc1irTJq6Je5HIeyUg piRJU9/hSdfJdrPRmVeXDFKHE8j1PhEkq6KEtD7wIfqfygRgXtVh0yX45P7JSJ7FOoVm 0jAOCefOpSuwghwuXHaH4EuAq+ALjOpAZhdrU3boXOYb9eBr1HG4YG0FH3tN05wdQQBW nY+A5tRiXh5dO7/K+kBc7LMkaZYVRpdvzV1047tcVNLI7V5ZRqUitxMpLwMPDKVjxKWI dqHDZOR7v+LWYY4JVsX8QTbhC6VWCjmSfvafus1Uo0tg4iW4EQF+465OKxUPzV//TBvF qUYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700492918; x=1701097718; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nFCIY8a2prU+vxKx/Khs2e4u+A5y+AyU+weaY1KLmL0=; b=sXrz1AFYdpbXDxLFoTrW6M4jL3KjX+zR08+ZJpU6mjD8Rs5ppxdavRVSpsSzvhM8S8 eospmXZSgoviQbC4zioMdOnpsPUv5VGtaJF1/IiueASecce0tx/2UIcFT03kOpkLA50y inXVE/WKj1z4VOCqxOSFPIcsvZJPvDKj25Jjntd7mDyhOowDhhch6Qa4tu0uXHDsBcAw DPaWcAv1XZpUVsyDfNG0Hg7hEKXsiJ7T3j7OmR7mR9fgZ2wt3ODnx8LLjPXiaxonNQEF jE0iqOuLvxC1IDB/6rHf12lgUdjc+L5WT94WaEFOHJPz7IoBb1ja7zhQT0tI1CIeV35U w1GQ== X-Gm-Message-State: AOJu0YzplxzXef21zXisQtm0aiIAmGOI1vGoili+Ur1j6+I6JNCU6BGA KzOTBsHYd2723ea+59i5wEo2FA== X-Received: by 2002:a05:600c:3106:b0:404:4b6f:d70d with SMTP id g6-20020a05600c310600b004044b6fd70dmr6806538wmo.17.1700492918405; Mon, 20 Nov 2023 07:08:38 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id l6-20020a05600c4f0600b004068495910csm18174146wmq.23.2023.11.20.07.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:08:38 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B663565776; Mon, 20 Nov 2023 15:08:34 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , =?utf-8?q?C=C3=A9dric?= =?utf-8?q?_Le_Goater?= , Mahmoud Mandour , Peter Maydell , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-s390x@nongnu.org, Beraldo Leal , qemu-arm@nongnu.org, devel@lists.libvirt.org, qemu-ppc@nongnu.org, Daniel Henrique Barboza , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alexandre Iooss , Marek Vasut , Thomas Huth , Chris Wulff , Ilya Leoshkevich , Richard Henderson , Nicholas Piggin Subject: [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation Date: Mon, 20 Nov 2023 15:08:27 +0000 Message-Id: <20231120150833.2552739-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231120150833.2552739-1-alex.bennee@linaro.org> References: <20231120150833.2552739-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org It seems some users will try and use the gdbstub to debug userspace inside a system emulation. While possible clarify the limitations of this approach and direct the users to a less head scratching way of debugging user-space. Signed-off-by: Alex Bennée Clarifies: https://gitlab.com/qemu-project/qemu/-/issues/1274 Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- docs/system/gdb.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst index 9906991b84..c0cc0c9c7e 100644 --- a/docs/system/gdb.rst +++ b/docs/system/gdb.rst @@ -60,7 +60,7 @@ As TCG cannot track all memory accesses in user-mode there is no support for watchpoints. Relocating code ---------------- +=============== On modern kernels confusion can be caused by code being relocated by features such as address space layout randomisation. To avoid @@ -68,6 +68,17 @@ confusion when debugging such things you either need to update gdb's view of where things are in memory or perhaps more trivially disable ASLR when booting the system. +Debugging user-space in system emulation +======================================== + +While technically possible to debug a user-space program running +inside a system image it does present challenges. Kernel preemption +and execution mode changes between kernel and user mode can make it +hard to follow whats going on. Unless you are specifically trying to +debug some interaction between kernel and user-space you are better +off running your guest program with gdb either in the guest or using +a gdbserver exposed via a port to the outside world. + Debugging multicore machines ============================