From patchwork Thu Nov 23 15:56:14 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: 746485 Delivered-To: patch@linaro.org Received: by 2002:a5d:6706:0:b0:32d:baff:b0ca with SMTP id o6csp954850wru; Thu, 23 Nov 2023 07:58:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IEm4TkIMxXKTQSteYtz6+yknEq5iRkk+gaq2GcFDJ1+gRSM/U2XWY/GQ/aRkkw2IJVrnF5m X-Received: by 2002:a05:620a:8e07:b0:77d:7843:a06b with SMTP id re7-20020a05620a8e0700b0077d7843a06bmr838027qkn.4.1700755113616; Thu, 23 Nov 2023 07:58:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700755113; cv=none; d=google.com; s=arc-20160816; b=qN3LmP2D7Ev2L8G86MsHuBCse5xfXaUxsPCswYjxL+ymQdkf1XCRdnBVUTcaXYHR2W 8932OanzD4m4MGcRrGpipj0TZm4eECue+ZWDq4+JnDymyBv77yA7P4Ff+g6oNYDe3zQ4 WGzEB+bV9f1Dne9IvZ7HiipEFJzXnxSx33uH/zi6ZHOliI+WtFv5OJjjoW1U61Yi9c5q z3MHjFn1SdVrR1V9UDF65m+5SffjtIoUfgkRPSR0640sWwbTJttjUQdmwj3JQy+4lnbS pg3dgLPpQAg1zvBmiOS6eaNcAfkkpL7P3ARBetuDWZ06xfWbUjedzJlGYcpjH1laVEm5 6xDQ== 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=9kYdFlz/DbR9wiBLu9uW1n60WPr7r2xH09X5l3DXY1k=; fh=WhxHrTvkXUd+iMXCSKFEwh518tntpsC5XXAxrOX+Ze8=; b=Gmjr6ADT8u3WObOME8mO9eEIdc8jaYt2sCAXafam7xMNmJJ0gxHESselr/M8w3h7EC RTNe+1dJCT7pNk7twqk/w6/tmHI5BRK917V04Efa8Z5MXbc3uuoWawBtzV+/+YyQYEsi PLN1beRXIgEoVpZZ/00dLMa8K1ZP082Ol5Js9yFcsDNCLy5B2E8fZGJidDXBoAqiqtRx 6yssBmdE9zdnW9fyTGs6q0pOPe6DqmO5PZyd3BSs9mcU/nwIodkfgEOCk1kfnAKgGemE ibCJhQXAX9QHetIROnjYCnu/1yGvmhGDkCR4AWegzEExzlAvVX9AqR710d8ksApbkfDO Oe8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ldc+Isud; 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 h5-20020a05620a244500b00777e47ef0b2si1412042qkn.181.2023.11.23.07.58.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Nov 2023 07:58:33 -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=Ldc+Isud; 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 1r6C4B-00060F-Nr; Thu, 23 Nov 2023 10:56:35 -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 1r6C46-0005yS-Si for qemu-devel@nongnu.org; Thu, 23 Nov 2023 10:56:30 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r6C45-0002LA-2w for qemu-devel@nongnu.org; Thu, 23 Nov 2023 10:56:30 -0500 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-332e7630a9dso69253f8f.1 for ; Thu, 23 Nov 2023 07:56:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700754987; x=1701359787; 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=9kYdFlz/DbR9wiBLu9uW1n60WPr7r2xH09X5l3DXY1k=; b=Ldc+IsudMHl7Che2NDxeeMoOhw8suxHnbRvO+JbCbYD+wjdMDTNoN1m/GmLXkGzTFF I+RMBMVr4K0FNGOeevV2ZecRxsFNuiv+asKXO9arPxNoSkxQ0iL9vnFKMX5WQ9WGXcH9 +6VK3gX53q6s+GREj/ZP3ixd9Oj0dRsHgbz5Xsn4fwJZak+MjK4Ewr+LOnDOhyD2o+mD +ukkDf42V54gJ2W7SXVKvRxzAaeKGisILz0oL107pnK1pvyI4HFVpUtXnfn9WtK4OSGg 9fry3pB5a9nHQlvF3+bUAvFVaR2FFvi75Y6vM9qCdp/HahFj0NEUZsbl61fCTsBdfbRG KKLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700754987; x=1701359787; 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=9kYdFlz/DbR9wiBLu9uW1n60WPr7r2xH09X5l3DXY1k=; b=cvg4eiWsmBv2QKYOv+cv1+DzFG4iCrJKZh9IVm7qqR/TuBO7Dama4A4LDPE/EXchIZ KoQG7G7qUrkvBOR2f98Qxfc6up6K87PyQCY4bIg2507hRyf1jUpfiqvPtmzHXWjzPSvq P3cIwAJ+vUXqW7cnh+ThBY6xc2vNTIVVD/gz026iRTetSqxonoAXl5tARuXorxiUzZG1 8+xiEP88tAs09R2BgnYd9bcmT/I+M38TxHzQGwTVBtD21bHGkr3c6/geGkxsyG7pKcnY VFuTF893PqLFU+vS9dOE4f4CCdtGZTcPLsSt75an4K+Mrsh3TFdEF5qT6x7qDw6vXwzO c6/g== X-Gm-Message-State: AOJu0Yw2TPcILlMxmO58sxFC3qYcLM2JWUaiJP7+9/lnLuSMMGrN3FLN G4Xvb9pvN9QBqADTMkj34BrMrZOULDVF6/Dhkhdsog== X-Received: by 2002:a5d:5644:0:b0:32d:81fe:7104 with SMTP id j4-20020a5d5644000000b0032d81fe7104mr3782456wrw.63.1700754987681; Thu, 23 Nov 2023 07:56:27 -0800 (PST) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id c11-20020a5d4f0b000000b00332e67d6564sm836043wru.67.2023.11.23.07.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 07:56:24 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 6BBAB645FD; Thu, 23 Nov 2023 15:56:21 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PULL 08/14] docs/system: clarify limits of using gdbstub in system emulation Date: Thu, 23 Nov 2023 15:56:14 +0000 Message-Id: <20231123155620.3042891-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231123155620.3042891-1-alex.bennee@linaro.org> References: <20231123155620.3042891-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.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=ham 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. Clarifies: https://gitlab.com/qemu-project/qemu/-/issues/1274 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée Message-Id: <20231120150833.2552739-9-alex.bennee@linaro.org> diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst index 9906991b84..4228cb56bb 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 it is 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 what's 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 ============================