From patchwork Mon Apr 22 15:35:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciaran Woodward X-Patchwork-Id: 88864 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 77171384AB68 for ; Mon, 22 Apr 2024 15:36:01 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2130.outbound.protection.outlook.com [40.107.7.130]) by sourceware.org (Postfix) with ESMTPS id 23A5B384AB69 for ; Mon, 22 Apr 2024 15:35:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 23A5B384AB69 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=xmos.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xmos.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 23A5B384AB69 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.7.130 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713800131; cv=pass; b=FxEAWAWTaPCCXJK4J63pF0x6uFhiAqwvHZpaJSN+qrIPmw/+zWa3NXFi/1Ut7LUTCuoWlRywq9ShobA0urVmYOhDtnQc+H6f1rOxHNUC//8uSUpLdvm26O1K/kBdDprZC1CeSb7rAtPGu0jWoORQKRYiyS1+WFccnQOM08tks2M= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1713800131; c=relaxed/simple; bh=pNjDILx2lXgtSBZ2763qULYSBBGLYbmO35kcprlsyVg=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=s3DIVDc6ipko7ZgyGxIoRzM8BOmxQUBrgNR9vnXuStbZW6EJIUYkPOPmgaBZ3c7y99Cvxy99ivTnlo35umwWHkRSDt9Sb5Squ1HnAXxTCIO86Uh8+dl9Bn9OzZMXBg2a01V/YZjWBpJx2m6dICkLHx+QVyMAeFWR0TuPWgtRBo4= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MeM+HnfjSVjLwM3F7rIzmbeeLv0zmpoHU9scumo+vsLYVCkKkbStFgseRakXVhWzBsAeHwmym1yVWgAvrAdjEreb1kexq0dcdELUWwRZydadaR0TiSUxiNBzkXPlbKB2I3mhr1yLzK8cWT6Vf0yL6eUGTFugWXiifOUFz/3NKYYg0KzECKP3Uh7nWldQNs1g4o8rG+PI66P+/V9RCFlqiWvqOaS+XGt6CImtIuW9W6AuCl4Y5kBCRBUi9y/DGcbVWK+EIbju0UKTTRWsKf8W3D496xv663+dn+c/bV6Uzr+0omzhcoWrfBNbC5z1LlQT810GMyZj4xRvEx4tMj644g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FuM2uVAg/tzW3Bt8bGJEI8NTJkR4iwFx0+XoJbwReHw=; b=QxkaHnIuda1A2hQ3slK/Ps5wgRaYhBYpowoCIirIFZhLKRE77A2FBr+k8f9UG+kKjSQs/9sr5zclstSsheMM2WeCTx73XU5e7M6W72XFlOTZ58Qko9Fm4T4XDvP9w1xo6lriUmzivf/B2F5QdERya2jPIKyj4mz22VybCp7tVoNtYkH+xi1jhzIxGeWCYz84ZId3BveorY+SfxK/XsukDWq5Q1KIeO1w5Cn8O6F6wBjwj4il5mD7tTmYkFFMP6m00v0T875yNz+pKdqZqCgFK4TUn1WZr5/axdwdvmaghj2SKFMRBBzvxJxdedp1g0XhzpJ4n+eIZnwerplgXX3hCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=xmos.com; dmarc=pass action=none header.from=xmos.com; dkim=pass header.d=xmos.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xmos1.onmicrosoft.com; s=selector2-xmos1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FuM2uVAg/tzW3Bt8bGJEI8NTJkR4iwFx0+XoJbwReHw=; b=ThRn3YHSGD4DH3r4S7FBNA7NE7HR9pl1PQGtdwwjkPNWKrc4Aq6e3feqrwTJHxti/SdKuJ+qpsqgGac2UTT4ploQZE7HDQECnnXTes+cr4UL0T+tMszuVGb7cH2G2fBe8uXRjR63UE/Px38Yjm6vFhRIWr/5YuQWMuZV5C2h55o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=xmos.com; Received: from PAXPR09MB5583.eurprd09.prod.outlook.com (2603:10a6:102:280::6) by AM0PR09MB3713.eurprd09.prod.outlook.com (2603:10a6:208:180::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Mon, 22 Apr 2024 15:35:16 +0000 Received: from PAXPR09MB5583.eurprd09.prod.outlook.com ([fe80::1338:c63c:6c3c:9090]) by PAXPR09MB5583.eurprd09.prod.outlook.com ([fe80::1338:c63c:6c3c:9090%7]) with mapi id 15.20.7472.044; Mon, 22 Apr 2024 15:35:16 +0000 From: Ciaran Woodward To: gdb-patches@sourceware.org Cc: Ciaran Woodward Subject: [PATCH] gdb/doc: Fix incorrect information in RSP doc Date: Mon, 22 Apr 2024 16:35:02 +0100 Message-Id: <20240422153502.7250-1-ciaranwoodward@xmos.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: LO2P265CA0038.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::26) To PAXPR09MB5583.eurprd09.prod.outlook.com (2603:10a6:102:280::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR09MB5583:EE_|AM0PR09MB3713:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f6e6910-624e-410d-7abd-08dc62e1cf0d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9qwrpCk5DhtHFhquSoqS+/mJKpS1ANhYyrCZl2ahGG3Grc7Urp2/5cyTltQakRzCyGq/YrgTOOC5ZE9LRLDechWlwX3e6nhSgu4dbMktBZxjSqkHomHXuw/ckNF83ZwNvWEL1PT225RQyyvZdxLKcOCJmVtv2A8MNhlw2/2J+no2IKrQRPX1Xd9CGvtXkeow8uqfePUSdvyn8TDNAz6qkjvbA0/1OcKV9KmCdgvUz4CF9B2tlDHC02VMry96uwveiWtmmPpTh1MpYnXlE1s7OtBWw6+NdIvG4riJN6rxjX0HZIZobR4udyInKJkWI3WIupvrcx03AnHGxxPvyRbR0MbTgWKb9izha8YmuvQohnrrfeFakOG2AArJrYiOX0hFkzsSIEi3vkeMyq30umf2VQ+Nv22HjmcTMZtkmUnAUDcNFf0kcm9Hb3ZWaDq+PeOto6Jbvlfzh74I8107ktLN2tehwFp20Rk2Xt+Y/lFBKX5fTdRy0vwci3jgduJahvRnFzC13uhzGhW+DfTyYW/CaCXWOFh94SWz3Yfcl5T82hGe4mnRs52h8rMMJR3V3nQLECUDWA5JA4bUSb7d5tzMGc9l+Goq6BFN2MhT3EcAH2W04Ac1jBWXySU6lQwtPMCS7z09tEJ9MN6g1Jn1mZqFeslNs8R/gs3kGA6+iLpdfv3TmVuDaZXGg4A++7FwYhcLzuBPkZ3rrUI89hXi6RBOcKir7qZtwBdMmfpeb7PPYwyIwemu2gasKteTBNmf/+v5xu4uQ6IHbk3h/2PETIfHhD3W9PinNGMMuq8zdvGTg+eETc6SM5RAzp4rSCCrB/xj7jCbbeBbwLnwGgVQ3Rr+mfVK1chxifkierkkxG2E9x4J8GeJXzePdKyOAwRb2zs7UazsIa1qMXgR9yJOQznLbGhjg5kGnnbyHysU+arbo0J/ykrbJPdiOFELpuhBaIiHHGQkx5IGY6eAWJBptOERN01icYo4iBaxLXeneBkqLP3sudd79bs7jx2l0fSvqR7OjpNTsr9zxTMRiQaMPRrDyER5yT4D8ddEsd6pBA16nUsD7kkcqzurrCt27KwhIh7g7kjr/b2f0lEjHX1pvPgBfXWGSa79YGdahjwJ1n3RG1LEwjc3Z4JA2A1mQBPUxDR7rULtoLpm/KEYNRVsujQVmBqMcrobGobUvtzrRpQ2xGIMYuNrYyCKb1XB0NvWLKT6z6P9xFuZesU363+wfele51jt976/W1ZLacJ93KCqYDiVxN1K71Dbw+yMvMQ63Vc79zOHXrqhR651vZTuVSgZbg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR09MB5583.eurprd09.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(376005)(366007)(1800799015)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WO+oYSJuN2u0j0YSGmov8gUU7HLM7mF06ybQPedh43UmmIrNsGBP2PP87kG2mub0CQnz+HRssxRN7f7ZZ0Yae/VaO+j4pjAEsyTNbjfMaiK7/vP459awdtknLzxOvQg8DrmjeZCLB7Y/bwyJmxN9wgAcA6JEAtoFacjiTzRoK1mu96qY7viGEVtjC1YNxLbePwvwcQoJK/GAuToU+lJCmThrTFORi3XVMt++p8THc6jecUo7RIV+yFBFnrnI+cigokA8Y+Mu0TaCxWtiTNH9zMD8Lcn1Rg2bjt3vBG2XieiZnOFkJ8R0bzwcTN8+3LVeOVLav5Qg5r+xZ5ywy4UUKi+EXuwhVfTr+k9Eryh94zUiiN0fq3T9EjjQNTs1KYSY5xK3sI6lHN0QnO/vCR+c2iyR8rK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P3E2CBViPCPikeTPvsq5ewdLkr/BR4Bl/LUD1M6+9EefzfZjF2PQYT+ASghy3yi+fVOH6QSdnxT2wQ7p8GOz96K8eF3aPbwA0lOUUpyo3BDef0kLVNf77A== X-OriginatorOrg: xmos.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f6e6910-624e-410d-7abd-08dc62e1cf0d X-MS-Exchange-CrossTenant-AuthSource: PAXPR09MB5583.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2024 15:35:16.2033 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 975ecfb1-4080-42d2-a01d-4a4d0707a539 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SCljYe4r3alzEwtfW4yheS9uwMaFsogl7jm5IuDFVcJdxDKHk9BBkHMz17JLYWSvf9IKrdS2p7ggEn5UgSFVVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB3713 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org The 'PacketSize' attribute of the qSupported packet was documented to be the maximum size of the packet including the frame and checksum bytes, however this is not how it was treated in the code. In reality, PacketSize is the maximum size of the data in the RSP packets, not including the framing or checksum bytes. For instance, GDB's remote.c treats it as the maximum number of data bytes. See remote_read_bytes_1, where the size of the request is capped at PacketSize/2 (for hex-encoding). Also see gdbserver's server.cc, where the internal buffer is sized as PBUFSIZ and PBUFSIZ-1 is used as PacketSize. In gdbserver's case, the buffer is not used for any of the framing or checksum characters. (I am not certain where the -1 comes from. I think it comes from back when there were no binary packets, so packets were treated as strings with null terminators). It also seems like gdbservers in the wild treat it in this way: Embocosm doc: https://www.embecosm.com/appnotes/ean4/embecosm-howto-rsp-server-ean4-issue-2.html#id3078000 A quick glance over openocd's gdb_server.c gdb_put_packet_inner() function shows that the internal buffer also excludes the framing and checksum. Likewise, qEmu's gdbstub.c allocates PacketSize bytes for the internal packet contents, and PacketSize+4 for the full frame. Reviewed-By: Eli Zaretskii --- gdb/doc/gdb.texinfo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 31a531ee992..b2e9faac82d 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -44953,7 +44953,7 @@ These are the currently defined stub features, in more detail: The remote stub can accept packets up to at least @var{bytes} in length. @value{GDBN} will send packets up to this size for bulk transfers, and will never send larger packets. This is a limit on the -data characters in the packet, including the frame and checksum. +data characters in the packet, not including the frame and checksum. There is no trailing NUL byte in a remote protocol packet; if the stub stores packets in a NUL-terminated format, it should allow an extra byte in its buffer for the NUL. If this stub feature is not supported,