From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by sourceware.org (Postfix) with ESMTPS id A2E193858C98 for ; Wed, 20 Mar 2024 17:32:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A2E193858C98 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A2E193858C98 Authentication-Results: server2.sourceware.org; arc=fail smtp.remote-ip=198.175.65.18 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1710955928; cv=fail; b=SiHz4gLW+YMIcpUnWhGrSGB75KEukUtSVWS7SSoOtWFFFfooTBhWc4zJB78D7Q+rGMAvT0kmiLQr7z9WlgGFQ7/Q1UD/hArhtOHx8A+/k9rGxGYVJ3n+3i3B4NJEJRoHJD9qhO0Lhl0EGwQh8mkBk12sE0oOkSc3VsAQfbKGAA0= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1710955928; c=relaxed/simple; bh=sIXpPBUPIMaM0Xue4QilxrNyGG260HCaQqWV6Rwe+0Q=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=KPs3xuFlaLymAO96yeRf75TlEHbkRQTaZbXG/QuGtM3HOmL9ygI9Pp/sFdC3eEcdQ299NKAV38QMSoC1sks5CBHqeiAJevDtsprjT0578uAKFvLz6/7kb7sqd2kraZDSRpLFPUTelhOIqTc+mpTg2i4bZE+PaWqB4pPv++Aty6I= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710955926; x=1742491926; h=from:to:subject:date:message-id:references:in-reply-to: mime-version:content-transfer-encoding; bh=sIXpPBUPIMaM0Xue4QilxrNyGG260HCaQqWV6Rwe+0Q=; b=MA3QwyCPzRXmJS29CLc04BUtydAzDss+7mjEPlkRfo+VPFdBZkEcSUKe CdS//1NfytdxkWh5jxv7kFkliXaEyC6lEkObvuK2XUvgND+oLbbeFeo0S bOUdMNZCJ3dagMVCqlfoZ8dWa7XNTK/S71A72KmRT4n1dhjPVE+vvqi1L bZe0feMyG3bPp/KXkxUKnDexl0VNgOgGM6zw3sx0jg2EyMZjk16nvT763 ZL94UGkmL8DKWYuoOGaw+/4zWkgv2kF6x5rzpfYPDx/LOHVBTSOrnFSHR fHv3BVU6PcCIlwG2v57Tn3u9PjGtJ6vvgqTfvLbGeCaJzOnZj651Cosnr A==; X-IronPort-AV: E=McAfee;i="6600,9927,11019"; a="6027376" X-IronPort-AV: E=Sophos;i="6.07,140,1708416000"; d="scan'208";a="6027376" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2024 10:32:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,140,1708416000"; d="scan'208";a="18903347" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 20 Mar 2024 10:32:04 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 20 Mar 2024 10:32:03 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 20 Mar 2024 10:32:03 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 20 Mar 2024 10:32:03 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FPeNs/7VoAGpYEEDHZsv7duZs4JDIAcBhP+QVg8wfrZwyZHi3NcAT5hgHnNGqt8gUD8MNuxZGGG0v3lXB8ttXpcVJBqhWJL1yNnMOqP/SQx1RifhTL+52xsQpmYl126MzmIFoK9NTP3gqdb0LIoe2qPi3YleWfRB4b3l67inl7DEtWq5rT9lUVxcGdY+BIx099aeZFvXaG+nR1th/j5122JfMjcvkgzkBfSMJpWdXWeQG9tAfAxMjRPtu4gIUrGWhNoQMj8xqpNcSBmfrR5U33tR3Qs73DUfP1IK1eTagGqzstRayb1a+f84sMjgmnjsVpSxIV22OyITZYL4zoU1wg== 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=d4WfZqPb1pobeOH3pFpfEnkzsF14e1bm+ExT1Dn0nxM=; b=eFZVst3VzIZZbKgBLlphNbW+bhFSgc97Zz7tJvF7ViMTf+GUjqOFDG57axdN+DAdqw0SNUbnj2LaShR1yxrAzP641FAuiXgpNNCdqKxkIFDe5g08A6iNz+JkJu/uZM8r4ZnmldwlNj0gU/LRA2hgmzUnIE6DviGBi9HT3D+/Uoj6g+db/g2NhEChXSYh2C5Oj/YsuJE/cVDTDAzfhQ6w7g1RNmEFR9eo3S9omutNq/d/bj6F741KWL8AM4jQ7qKc0dMxncLt7/sD7v0VxoA9AxWkOF59/Y8Sfapw0XTWKS+TMt5eVnAagluxOlb4yiZXy7sfFFSKKCOAn47KLA6PRQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM4PR11MB7303.namprd11.prod.outlook.com (2603:10b6:8:108::21) by SN7PR11MB7091.namprd11.prod.outlook.com (2603:10b6:806:29a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.9; Wed, 20 Mar 2024 17:32:01 +0000 Received: from DM4PR11MB7303.namprd11.prod.outlook.com ([fe80::9c92:b02a:3add:529e]) by DM4PR11MB7303.namprd11.prod.outlook.com ([fe80::9c92:b02a:3add:529e%5]) with mapi id 15.20.7409.010; Wed, 20 Mar 2024 17:32:00 +0000 From: "Aktemur, Tankut Baris" To: Tom Tromey , "gdb-patches@sourceware.org" Subject: RE: [PATCH 3/3] gdb, gdbserver: introduce the 'x' RSP packet for binary memory read Thread-Topic: [PATCH 3/3] gdb, gdbserver: introduce the 'x' RSP packet for binary memory read Thread-Index: AQHadVxMOgQ6F2ReO0SWhqKqj4NBLLE2DkikgAD1EDCAAC1n5IABXiBggAa0IPGAAaYsEA== Date: Wed, 20 Mar 2024 17:32:00 +0000 Message-ID: References: <990be8b42f1f6ca33ffed7a8ae7ead327009d847.1710343840.git.tankut.baris.aktemur@intel.com> <87h6halypk.fsf@tromey.com> <87v85pkmkl.fsf@tromey.com> <87o7bagqil.fsf@tromey.com> In-Reply-To: <87o7bagqil.fsf@tromey.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR11MB7303:EE_|SN7PR11MB7091:EE_ x-ms-office365-filtering-correlation-id: 65aa8273-6db1-42ed-e7d7-08dc4903a698 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: oSh9b+cudYtbqnDdWqtpfz0lHm8hbzZWiOtBs8dyxVfTFA5GmL7A9Pb54cYKc8z3Kb/tbTlmSVdwivKMS/7MJhqqIe5nwDpSnOqojXcnuM7ZZug4dOOeMb7zBT13ZQyOTKDoRrD/uJPdNO//3woPzBUwzoYQ+5IFV4l+QkvycVh3IK4+S4tYQmUadNDG4prmTYXQL4HUwcbl6vCsrQXsHZ0NJGXi6pLZi7e+XHjhDOqLYixhsIv6nea0xnhyaVaznJaKeqrIDkZOBBDPVXvj7UFlLn/u+Z2jjvqUE69ailjpa/bFpLE8lnUbcCjqaePda/rDbUM18b1jk3yJG3b14UUe0/2mwalNmiVNe0WCH8ZWmRaMeGLyVwnU1ky2tmb5gppOysqigcaRiLHbMwyNRRp8WiMdvq58bYfjJYClwJFW+A10J+TxtTO63UnTr5OOAY8A+x3lDSPnDbFhYKt6qha6THCgrhJL+XRE5xVyIxN1+iug2376xcozocFtahsC3/SyKFiB9Vmjyz1HvK7xN2KS2vep0LeUbVJxRZ2Ld+yWMWO8JvNZN1i6i30/imtoYsiPy9hlExrOOJ6ZjHbE8HE8yemfGpWxZo3pQqRbPYx4dYcf+dvROokhXJmOWguPFhjpv0beLkV3d+qzUAdVJDJGJNGxoMzzUIsmmOtPPHPRptTUmh2sVhw2zWT/H0sAnUJ+oBAXfz7duNu2uUPPJ/m7vhXOA4b78XtK9hNOfnc= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB7303.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(366007)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?rozcogEewlA4OToSXOXCzcNZClbIOr48hMDmyxguW2pYMall79q8j8zzd0vZ?= =?us-ascii?Q?KRDdC51FTvTSPYLMTsLkylzK5o8VNoJy5+WuJOmgmvFh7wz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uggPd2KjqNyzExbxnQZ8lpWSvJKciuf+Stn78?= =?us-ascii?Q?CcM0aiZDinRLejwgQ/sp9Le4nS6A0z2zw4T5Lnz95xZ0ZeppzaZTcHHZXTpr?= =?us-ascii?Q?857+jHLDkJM+sg1CWZArX9NtgjGCspNFiahHD+lCt/V3nL8I0/I8N7rzvrXK?= =?us-ascii?Q?FpeELAnejbrW4IvrssO+M8P1wsg/vL14y3XuMCvKQFAe5i3w2c3OGq3sHAXr?= =?us-ascii?Q?9mWYWBx8B+zPVtVNNVheKM902XxwByZoElhJyqIp28xx978uKeTxvkYR1fdI?= =?us-ascii?Q?jOSI2/yJgGJvSE8T7ny7kT9QyJC63WkY5H16T8rK1zydAob9tx1tnAwVNv4q?= =?us-ascii?Q?vzsPOytxTo+MwIxwbrPyrmLmUMZtEfo03+15bncZONMR0ELvcdpfjXd44gNx?= =?us-ascii?Q?Yn2fQ4tFpCbC1jk2PMW5a9lGWdU+GXACZ+quPrb6G88+TTtE8KmFKM79Bi7z?= =?us-ascii?Q?lz1AIvfoCeCpbRR6Mz58jvu2r/F5a59J0QzPVjfiyejcZU48vq0tpdJ7NxO8?= =?us-ascii?Q?v2uXR9urOHzeLa0X7VQCGjODBAqDBIct1cFAZMn35GcKIWoIqxkxPYVC/qo/?= =?us-ascii?Q?v2liiCrrGl5Mw8qSnp+5a4tincOBj7FxkajlVanx1jAcZjhgnrLeXeJrHOx2?= =?us-ascii?Q?Jw=3D=3D?= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB7303.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65aa8273-6db1-42ed-e7d7-08dc4903a698 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Mar 2024 17:32:00.8316 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Uq2mb0tONTLE9ivoZsE7AxWz7EyEH9Sib7hXiHK8IUk7tZsA+7RURaYxaodH9WMk8DN7zBAnpeIgo6F3fK49tBR1Hf09ZwAXH7AjvqF7KRY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB7091 X-OriginatorOrg: intel.com Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Tom, On Tuesday, March 19, 2024 5:01 PM, Tom Tromey wrote: > >>>>> Aktemur, Tankut Baris writes: > = > >> I think the probing idea is that you simply try the 'x' command the > >> first time it is needed. If remote sends an empty response (not an 'E' > >> response), then the packet isn't supported, so you disable it and retry > >> with 'm'. > >> > >> This is documented in the Overview node: > = > > Yes, I get this idea, and the 'X' packet actually uses it. My concern = there is > > that (1) sending this packet with an arbitrary address and length 0 see= ms too > > artificial; (2) using the proposed reply format, the target would send = an empty reply > > both when it does not recognize the packet and when it recognizes becau= se the length > > argument in the probe is 0 (the same problem would exist with the 'm', = 'p', 'g' packets > > if we were to probe them). This would not be an issue if we decide to = force the reply > > to always start with a marker character, as suggested in Ciaran's email. > = > I definitely think that gdb should not send an 'x' packet with an > arbitrary address and a length of 0. > = > Instead the idea is that if the packet is not explicitly forbidden > (either via a gdb command or by previous probe failure), just attempt to > use this packet for the first memory read. You mean, just as "x\0", without any arguments? (Please also see the end of the email about this) > If the remote reports the packet as unsupported, fall back to the 'm' > packet and carry on. > = > I think the docs should be explicit about what a 0-length read means. I agree that the document should be clear for this. > I tend to think this should just be an error. My first reaction would be that it depends on the given address. If the address is accessible, it seems viable that a zero-length read is trivially a success, akin to defining an empty string. If the address is not accessible, however, it would be an error. So, a zero-length read attempt could also be considered as a probe to check if the address is accessible by the context. Checking the code, I see in `target_write_memory`: /* GDB may send X packets with LEN=3D=3D0, for probing packet support. If we let such a request go through, then buffer.data() below may return NULL, which may confuse target implementations. Handle it here to avoid lower levels having to care about this case. */ if (len =3D=3D 0) return 0; (A return value of 0 denotes success, by the way.) And then in `read_inferior_memory`: /* At the time of writing, GDB only sends write packets with LEN=3D=3D0, not read packets (see comment in target_write_memory), but it doesn't hurt to prevent problems if it ever does, or we're connected to some client other than GDB that does. */ if (len =3D=3D 0) return 0; I had mentioned `check_binary_download` in a previous email. In that funct= ion GDB probes for 'X' using the first memory address it receives with a length of 0. From that perspective, the address is arbitrary, and I, too, find th= at unpleasant. Because of these reasons, I had preferred not probing and chose announcing the support instead. But if probing is still the desired approach, how abo= ut this: We can send a plain "x\0" packet, with no arguments. Because this doesn't = conform to the format, it would be an error, but that's sufficient to indicate that the server supports the packet. Would that be ok? > I also prefer Ciaran's idea for the response packet. I didn't realize > other packets already did this or perhaps I would have suggested it. Ok, thank you. I'll make the reply start with a marker character in the ne= xt revision. > thanks, > Tom Regards -Baris Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva = Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928