From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KWFTKCZqjWqKxj4AWB0awg (envelope-from ) for ; Tue, 25 Aug 2026 06:10:46 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aQ6pHM/J; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aQ6pHM/J; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9D9DA1E0A3; Tue, 25 Aug 2026 06:10:46 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 7B8231E033 for ; Tue, 25 Aug 2026 06:10:45 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 070284BA799D for ; Tue, 25 Aug 2026 10:10:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 070284BA799D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aQ6pHM/J; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aQ6pHM/J Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazlp170110003.outbound.protection.outlook.com [IPv6:2a01:111:f403:c201::3]) by sourceware.org (Postfix) with ESMTPS id 9A7ED4BA79A0 for ; Tue, 25 Aug 2026 10:10:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9A7ED4BA79A0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9A7ED4BA79A0 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c201::3 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1787652613; cv=pass; b=GfMJSGq8nD0TU4DIHRvlf8EqxSKSbcQO4XdmcArBvVZydlazWab9StmTT6KoyvsSm4fln1/6cL/MoZTtcp7XU+x0HtNy+f8SpK4nKs5JSkKNYSFXCKsP36vNCXDnMalZw3xUGo6KQiOaxhzGPRKbuYA4Kddk6FbhI5p15gUr8is= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1787652613; c=relaxed/simple; bh=W6vr9aqUDwGQ43laknqNJ4YNErUKq3/VZfEvUVIao/4=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=TLfFFmqOxafjixIlxCIX+tO+K7coT6DRK+A8M8RlugC3dwVAqaQjAuUuNba8LMh0a2w8k6fBsML8nkwoE24s98ql4iEj2zUrrOeVQrNSW6I/JvTmBH709erZwTCgaeSrrgEb5inU14wVPLgOLSS5ypLbUeujBMQDO2orTmRgs7k= ARC-Authentication-Results: i=3; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aQ6pHM/J; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aQ6pHM/J DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A7ED4BA79A0 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=V64fIr9DpzJ3nMl9IPqwbRv+k9x2T84MtHVUs12FxT10gsFSXdqhki+blyoHRu/z+g8grkhJRKtp4dgUJGqKCb7JQkU11re39v/fRaJ3QjJwf/L0CrQpKIKrNwCtRauM/RBF8N+D5OU46OcT0n+aR0xDcmTpfVUtXZn9RSwC2q7fZsv248/2wJVkkEafVTiWaiwHT8xr9xiTF5QhN0vet6wAN3DmPjWwFnBQtMZ+IChpfUq5/st1onsGO8E768IRSYQT4gSQ0C/eWbbW3axDiLHYodOaQpMUnzed6V/c9AGXRGzWDqa1iKdz9JhtzID1zIQU2IPHOWcx59kNB1cGEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=8k4SK++9YNJ8800nIqE95UDlJ0YolGxznqdHe39lSGA=; b=ZzgrYDAtqDYdEIdE+Uqo2VrIDeUwDkhYgKlgVtBk+f2Sh553vdJB/A7jpi1N/WjjEpYGgaqCRgHcQ9IwAOq9tGAg1GvySqB+34fxsi8lowqgyPaOzpPcm+y1MYprI/zjr0IyVr6BxM6mS4QF5/szZpGjrlzr26qU3DseoCbKKDQXqgPqnBHgxyi1slZR0r9R7ZpC17yXDqb9/nd+woa75M6mVqt9OMm9tzO8flGDJqTRY3wua+jHvZs1upwj2pOkziEzacgLFGn1vwHzCRG4r8sL47wEKIs6P0SZWYSkfvL9/nzNuqHR3UdCPUJf/5+BOY8daGXqjVf/HkzRrX1Evw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8k4SK++9YNJ8800nIqE95UDlJ0YolGxznqdHe39lSGA=; b=aQ6pHM/J2QEV6C38m2jOlrfqD82sQ1Bzn876c/+mFyiN1IXIvg9ML9UyOejbPfx/qvAS8XsF/rjZrQR822s3qnw3UeRcRI+Fmp652nOgkMSduMCE2SnVBlGDziVChjfZNfoZWgbipw8268TNF50Bn6qT720D16fcyyR2rabW+BY= Received: from DU7P191CA0021.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:54e::21) by GV2PR08MB7954.eurprd08.prod.outlook.com (2603:10a6:150:a8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.339.12; Tue, 25 Aug 2026 10:10:06 +0000 Received: from DB5PEPF00014B8B.eurprd02.prod.outlook.com (2603:10a6:10:54e:cafe::75) by DU7P191CA0021.outlook.office365.com (2603:10a6:10:54e::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.6 via Frontend Transport; Tue, 25 Aug 2026 10:10:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by DB5PEPF00014B8B.mail.protection.outlook.com (10.167.8.199) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.3 via Frontend Transport; Tue, 25 Aug 2026 10:10:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S2U56rbbPmAAwtyUDelKFOgr/d/TzyiKD+Ne5ZMKmsBLTxPGG2+Brzlk2+hlkuOATATeu+5jGkEyStRhfpoAfRW7wFxk5zdCbpkQcZmI0fXxeVaiDg88JdOHpQ98y177oyhT+cwVA/LhazjtCiwWSsXHDz6FiEGZKZ5Wr3QLuDKDz5oPZxak3V+qu8w1phYhicSpjSta011iiCps8tH4NZgGRdOQj9rAGe07/QGeTjOl73tg98daAy4qBpwieYj9MZ0M9Wmi3f+YVt6BazzOpu15xeZFto8zLvLF9E8OPSuzao6BOwKB8gvA3SCEfK8RCcTzKmqVx3lL8ZH/0vzA3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=8k4SK++9YNJ8800nIqE95UDlJ0YolGxznqdHe39lSGA=; b=L6sRK6p7sTS2z4PCNOwiZKlaBhPiRqfmNvI29XnrGAewmAWySb+6Q+i6PDK9aFHyYejb14avDy+A7L6BNf4HsKl2OVT6E4qsv2x+8ZY77/S/3F/kXdI2UUst4vnb/q4TvKS5Ryj4DYqGENwzQXxSB3ZuarqyOFxXLJAVJlYT5GnBbhPygFT7SHdXFMlf4q/9BIOGcXKmqkzU2jgatAqZRIQoxww1q+eGooNL4NMSg8tDJLO/Hjjag/4jJ0NyttODilGGp0IMH9mnO9U0/wjMqATgW06wEU1Ulx0G4u3WprsJOEhQMf/s5YMYEzbwEO77TCwu79jcvVrPsxzogklPFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 172.205.89.229) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8k4SK++9YNJ8800nIqE95UDlJ0YolGxznqdHe39lSGA=; b=aQ6pHM/J2QEV6C38m2jOlrfqD82sQ1Bzn876c/+mFyiN1IXIvg9ML9UyOejbPfx/qvAS8XsF/rjZrQR822s3qnw3UeRcRI+Fmp652nOgkMSduMCE2SnVBlGDziVChjfZNfoZWgbipw8268TNF50Bn6qT720D16fcyyR2rabW+BY= Received: from AM8P191CA0025.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::30) by DB4PR08MB9382.eurprd08.prod.outlook.com (2603:10a6:10:3f2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.6; Tue, 25 Aug 2026 10:09:31 +0000 Received: from AM4PEPF00027A64.eurprd04.prod.outlook.com (2603:10a6:20b:21a:cafe::6d) by AM8P191CA0025.outlook.office365.com (2603:10a6:20b:21a::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.339.12 via Frontend Transport; Tue, 25 Aug 2026 10:09:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 172.205.89.229) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 172.205.89.229 as permitted sender) receiver=protection.outlook.com; client-ip=172.205.89.229; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (172.205.89.229) by AM4PEPF00027A64.mail.protection.outlook.com (10.167.16.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.3 via Frontend Transport; Tue, 25 Aug 2026 10:09:31 +0000 Received: from AZ-NEU-EXJ02.Arm.com (10.240.25.139) by AZ-NEU-EX04.Arm.com (10.240.25.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Tue, 25 Aug 2026 10:09:27 +0000 Received: from AZ-NEU-EX04.Arm.com (10.240.25.138) by AZ-NEU-EXJ02.Arm.com (10.240.25.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Tue, 25 Aug 2026 10:09:26 +0000 Received: from PF4S4363.arm.com (10.57.48.229) by mail.arm.com (10.240.25.138) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Tue, 25 Aug 2026 10:09:26 +0000 From: Matthieu Longo To: CC: Simon Marchi , Thiago Jung Bauermann , Luis Machado , "Luis Machado" , Christina Joos , Kevin Buettner , "Matthieu Longo" Subject: [PATCH v2 1/6] target_fileio_read_stralloc: add an optional length parameter Date: Tue, 25 Aug 2026 11:09:07 +0100 Message-ID: <20260825100912.514232-2-matthieu.longo@arm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825100912.514232-1-matthieu.longo@arm.com> References: <20260825100912.514232-1-matthieu.longo@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM4PEPF00027A64:EE_|DB4PR08MB9382:EE_|DB5PEPF00014B8B:EE_|GV2PR08MB7954:EE_ X-MS-Office365-Filtering-Correlation-Id: 34414ede-f4b4-4ce0-bd38-08df029109bb x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|36860700016|376014|1800799024|23010399003|82310400026|3023799007|56012099006|10067099003|11063799006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info-Original: QAbUA16S7mqaOWzK+9pS+A/JQHp91t5ACLmQq6M4Xh1N1B0Er1tr/gGEpfBqUddE6jk1v7lOpnulqkLpW3eEHGST6ku4emUfSg5CtB+Ly3lBLVEfD6PBcYz+NVn2k3NK7u19ybLaytqxuuzngNahMKYbeYLIJ7OtyfBf3RRrxG5WpAcjQgn8vTlOHjYe7gbHfTLIeij1HMNmHpF2ZWXFf7G6Qxeihs0L894o6DFixYz4APKcjWNUgV1sBLw7ZA7AqtmNqgYyaCKHS8IUEd750ueV17VrRjUGnTwKXVJ2aX5aIDq97ZFken1MQoTDUEAM+PotxjAo2Gnh9ASTqpyXEMScjZDV2lopmFUtK7v9hqtpD+HsQdp7mJ4NEpE+LEfBS1C4pVAjXj4GphCTBSkqqa0gdxKNhzsLvKBLeiKG00zwGolb8qK9TdTNIRdAsQhYGUp13YUuZau04hia9dL+Z52vhUVwdxugrR7Pw5s3opcP0zkoCHS/gaFkXKpEti3PThkWFD/AH65BozxwInKhUcxHyQHj46k3BIAVohje2IedM6rxGTo041KoLJp0JDoJyylQXXnffQoC3J9QiZP8DEREfsl/rhh2Q1XI/E4Uz5zBFoVDD57chwK3e+ZANu3Z/T92fxz+7pRFdhWfHdzNkaOpxvNnk/P1z+9EusHeTbj9MZXhJkf685AwmXH8N/UDv23swOtPwNWxI//LKeMs7g== X-Forefront-Antispam-Report-Untrusted: CIP:172.205.89.229; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700016)(376014)(1800799024)(23010399003)(82310400026)(3023799007)(56012099006)(10067099003)(11063799006)(18002099003)(22082099003); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: FRMaIXQ52EAH0uV7vDXKzttTdppH5gu47QQ9v3C7GT9ZNwHMfzybNsf2iEMQv7HgUvToPZbdMsA39VKD8kqFmmzislNEdsmyQ9hv0E5YZ2gia4tIOp1XVzWG3Qi6GBe6n4lVRBo3HWRqhavG2Wq1PO0V5SyH0E6702S1lTpTp40o6784/vHszxx84Fte5a4R0Jxu06XjKurTSnyxhXv8xwyQ105SPXAY3BYEC07sOe3vDuJ2KmDz30w6st5y4sF4rzIFbqbnlTh90Vdqd+tFR05/91a2oBZcfxzDPhGcY8W4vSX6jGonnqTcZ1fgGGWEv3MHTv7UgA4tYNhpx/BZ+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB9382 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5PEPF00014B8B.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 045de2ea-73a5-47e7-6f2c-08df0290f4ce X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700016|376014|23010399003|1800799024|14060799003|35042699022|3023799007|56012099006|10067099003|11063799006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: jgmdXnMY3xUfzwfSsUWbghnThTp5YxjiQgptCqLJBgmYTeKXr/C6x70PDsGscy8Tw2XwJV8YuZipZ6njKoiexAZkNrBF9S7L5VOlKEq8YDsWZ0PPNYobF0QelMKIHqRNe8MT2+/KHIMVs/CryCrvtuGfLRrId1ZgFTYW0yCETHGN4m2jyJ/M3UixLZzBYCn5zg8HflTkaQeifoYbYKkdUnNL7Xz+jG/63ddIy3TsSe+gONOl7tzdmNZdPqfp4bAEgVCRoqjFgx2Yi1V1L2efZXCXSPp/hASu93lPzT6gSCMaFH6zv5l2bEI2encFQb/NCuOFbn8kVCCPLO/Rl9vCwY31fM0MijeeTwPSz2vfVkfcyjw1MFx9iMgTaw6WxvJOd3vRe741n04wpsjtNtWg6kqf4C710IoAw2CytpGKDXR61QQxE8Mqt4Omin0E3SqHXOjGwU2vIUu6jbS6iy7cowu6pru+P82lk//2S33lcurzwabXRi9WLE5tgxUPeM9WwyOiEPE9Utu5obOMOBJvex84KNaGZqhdNFPUFLbqfofM8eHEN113Rc6wPzyYWN3At7nLd9pWg2Qv+IzxnxKz9zBhwfUFhVU9MZ2tp/g2N+WscW1DeP63zFflhrvAyvBIzG00zCjbt5F7L6o/QmA9jop/l1SRyS0rquAolgRsHPP42itTC6wjwrd9V7Z44erWZ8IhToVrDaxcKC8sGgqUaQ== X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700016)(376014)(23010399003)(1800799024)(14060799003)(35042699022)(3023799007)(56012099006)(10067099003)(11063799006)(22082099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bJATgAL/nMOfeOlQyUWpewSXk7jbO19iXHS8M0r5EQ343jok9br4H6EvuZJGXVpi9vEui9fznubZhTqrzLabx6ynTGsO3yeIBZyF3eT+yBLAlwN6yDHisYfSHb21mXyy4TuJIyQiVgW1Tb/vbvEA8sO6rapeD5CGb0C1dSp1V7wuNp+EZ1BGo2n+0xwo3TbCSOYVDp5TjvMQbEZT/cz5jKObgSa9xNbCGKRiadGwtNEsilvT+X304QYSmZX7PbARBUTjWDabzuv1fzDPdx/s/eE/a0CGWQZsVzlisNFxO9/VxgMp4AwNSdsbmSx3sk+PEDSmaaPOOq8xkL7vz+TQMNb2euZTUAF6wq1/z2FDgdt6ZqCGXREcpiyP3T82xwM4B2YvxWNzEwoPStisMsJZbDb0Ba1HTuEYCfgR4k1PE51rQLAvIZrBxsmeEVZelwCm X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2026 10:10:06.5688 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34414ede-f4b4-4ce0-bd38-08df029109bb X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: DB5PEPF00014B8B.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB7954 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~public-inbox=simark.ca@sourceware.org Extend target_fileio_read_stralloc with an optional output parameter that returns the number of bytes read, excluding the terminating NUL byte. Most callers only need the returned NUL-terminated buffer and can ignore the new parameter, but callers that need the number of bytes read can now obtain it without recomputing it. While updating the function, make a couple of minor cleanups by using '\0' instead of 0 for character literals and clarifying the function documentation. Reviewed-By: Thiago Jung Bauermann --- gdb/target.c | 11 ++++++++--- gdb/target.h | 20 ++++++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/gdb/target.c b/gdb/target.c index 5d937f3ae85..ebf0f30092c 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3547,7 +3547,8 @@ target_fileio_read_alloc (struct inferior *inf, const char *filename, /* See target.h. */ gdb::unique_xmalloc_ptr -target_fileio_read_stralloc (struct inferior *inf, const char *filename) +target_fileio_read_stralloc (struct inferior *inf, const char *filename, + LONGEST *len) { gdb_byte *buffer; char *bufstr; @@ -3556,17 +3557,21 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename) transferred = target_fileio_read_alloc_1 (inf, filename, &buffer, 1); bufstr = (char *) buffer; + /* Note: on failure, target_fileio_read_alloc_1 returns -1. */ + if (len != nullptr) + *len = transferred; + if (transferred < 0) return gdb::unique_xmalloc_ptr (nullptr); if (transferred == 0) return make_unique_xstrdup (""); - bufstr[transferred] = 0; + bufstr[transferred] = '\0'; /* Check for embedded NUL bytes; but allow trailing NULs. */ for (i = strlen (bufstr); i < transferred; i++) - if (bufstr[i] != 0) + if (bufstr[i] != '\0') { warning (_("target file %s " "contained unexpected null characters"), diff --git a/gdb/target.h b/gdb/target.h index 6d1c21f29f6..819279c08fc 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -2327,15 +2327,19 @@ extern LONGEST target_fileio_read_alloc (struct inferior *inf, const char *filename, gdb_byte **buf_p); -/* Read target file FILENAME, in the filesystem as seen by INF. If - INF is NULL, use the filesystem seen by the debugger (GDB or, for - remote targets, the remote stub). The result is NUL-terminated and - returned as a string, allocated using xmalloc. If an error occurs - or the transfer is unsupported, NULL is returned. Empty objects - are returned as allocated but empty strings. A warning is issued - if the result contains any embedded NUL bytes. */ +/* Read the content of the target file FILENAME from the filesystem as + seen by INF. If INF is NULL, use the filesystem seen by the debugger + (GDB or, for remote targets, the remote stub). + + If LEN is not NULL, store the number of bytes read, excluding the + terminating NUL byte. + + The returned buffer is NUL-terminated and allocated using xmalloc. + On error, or if the transfer is unsupported, return NULL and set + LEN to -1. Empty files are returned as allocated but empty strings. + A warning is issued if the file content contains embedded NUL bytes. */ extern gdb::unique_xmalloc_ptr target_fileio_read_stralloc - (struct inferior *inf, const char *filename); + (struct inferior *inf, const char *filename, LONGEST *len = nullptr); /* Invalidate the target associated with open handles that were open on target TARG, since we're about to close (and maybe destroy) the -- 2.55.0