From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yfefInPIaGor4zEAWB0awg (envelope-from ) for ; Tue, 28 Jul 2026 11:19:15 -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=Y1V+VRUi; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=Y1V+VRUi; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8360B1E09B; Tue, 28 Jul 2026 11:19:15 -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 7E6F51E09B for ; Tue, 28 Jul 2026 11:19:14 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BB824BB3BC0 for ; Tue, 28 Jul 2026 15:19:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BB824BB3BC0 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=Y1V+VRUi; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=Y1V+VRUi Received: from MRWPR03CU001.outbound.protection.outlook.com (mail-francesouthazon11011000.outbound.protection.outlook.com [40.107.130.0]) by sourceware.org (Postfix) with ESMTPS id 2A02F4BB3B9C for ; Tue, 28 Jul 2026 15:18:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2A02F4BB3B9C 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 2A02F4BB3B9C Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=40.107.130.0 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1785251921; cv=pass; b=dNH4BlGvQHveS8sw5mIZrgEdv+i+44XyCvbylt084b+fnZa4QqlOl2ep9b2dqVrYzxZ6bT7O/2F8PLHfAD6K031h16YWzp7HqIZJ0syiCkNfedE+dHsZyxSECJKBhXRs4bS5rGKRcDJ+jBBVw8w0unzJHx8yZD3Uva0PCKX9O24= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1785251921; c=relaxed/simple; bh=VN5Bfap9A+PDIVmMjZpa8M//h8uEcXJsXpdICBAnMLY=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=RnWXquXWKAnuJpkKx/YI0XwZ/tRnU7lzLoA76bSmNXOot0+dgPCV1jOButTUBSI5Rg2mc1cT1mOoQvFqlxXD7kpOtLiV/Q7fhOf1kf9OSLJ1uZLMI1T0YfSQ91dDc461v3C7juKFrsK7UWmpfFLZQgVyL1opkZms/BxxGavdJJw= 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=Y1V+VRUi; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=Y1V+VRUi DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A02F4BB3B9C ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=MmXPScIKC1EQQhT4ONoXEwZK7M+Ygu4BCh/1m2qnNmS7VjcyfvgfQRyUnnfIYsWEuAzfvk01ZPS0j5cPdOp4GsgXiNfN9ESlYsfVTGpgEXu67LCV0U363FwKa4V+A17vktWxlHq1SCUxOlZuj/uZM5K/8x/QEOJ3yGxnirVo5TFiSd3vuaR3mOVp8ITx9y4Gf+piXnpTwXa2fMaOiydXrM5ElL5X7ao0lRZYP4AlONHiHrpRBDWfgYamRa+lwLJsZIm4DgkZGWYGpdKzgoM0uld/C8S93txYneGqbn+CBmR4/KNFiPJzkhtvD00OrTawyutGeC5bKKixzOcASBeQwg== 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=XwkJwd6iEi2G/zmfA059UUGNnQzSccT1X5mdUoQ8t/w=; b=djdKMbGxNcxMlEVAUqEJgYxeWIKiShJKTvOA1+v18Rfi8Fn2WngSRM0PvdWyd2mjii3/DzZmQL0cT2slpMRi55pKUV6qPo+zT/YYfTrFv7SI67tKNg9nLzpgUpsfU381O7US4yrcKEu9ucl6OVJgF5KXjwTHJtwgyKIoB6YlnNRjcVdIXATc2pHuN3cuPVGA5EUffMbz+lJflc7ZLb2gNLGpjTkDKd4tlygef+RUiJGjHtVHGLPBy/4zBujcl1m6hP2BFDfsR4FPyJ2WhhlwdMOIotGAGE1asS8k+qz8O6OP+b/MACs/3ttEXQQkF/C1yuXTpwa0V+i/N859b9IjGw== 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=XwkJwd6iEi2G/zmfA059UUGNnQzSccT1X5mdUoQ8t/w=; b=Y1V+VRUiAsF4rvwGMIL5YMB5EjLIX2AmX0dX6v6bCnI95NXxIaM22mlJ1FHhhDhpV2mLQJjpKHIlwdOJFNVM+J3mXLGcYDL7LK0lmVP62UZ8QgTDUtasyL70/7Y1qhbtQwMpR5RcTvNC3wiTyCMXarcUxILwq4kkm4iVqL6XBHc= Received: from AS4P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5db::13) by PAVPR08MB9404.eurprd08.prod.outlook.com (2603:10a6:102:30f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.13; Tue, 28 Jul 2026 15:18:27 +0000 Received: from AM2PEPF0001C712.eurprd05.prod.outlook.com (2603:10a6:20b:5db:cafe::2e) by AS4P189CA0026.outlook.office365.com (2603:10a6:20b:5db::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.270.12 via Frontend Transport; Tue, 28 Jul 2026 15:18:27 +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 AM2PEPF0001C712.mail.protection.outlook.com (10.167.16.182) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.270.5 via Frontend Transport; Tue, 28 Jul 2026 15:18:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FGyigsKXlByKFnJcfX9C20LLuimCjpsJc/yn6L6gG5rloH4JtaOl2rf3eXQbd/We+wYPJRhhXI6/oBL8GnhQjXq0KsPsENtEHmd+D1J/jv8mfbSTsp5UBEWFTk36yEBa88/Z9qBgze8OTwmddM/rH1TySMCvJv1olE3/ga8TN+/fjJxJEevOOr7BX3sSL2YcspUpBlxM4ekxj42M59maxs91n8gLMQ/R873Hz3JhWcuTij2wvkCoW749oXBrqWH+w4NPdZVinM1GBRusGlo0nC4yZHGFb1nZlQIRtJxlyS2AyagpdY3ngmmH02ohTMlKEkB/4QxCPFVyFTJJIZzV7Q== 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=XwkJwd6iEi2G/zmfA059UUGNnQzSccT1X5mdUoQ8t/w=; b=q/1ArcWEh7GXxiH2C0k4N+QhdDzWD92kBuiJERDlsyQ3gnGnIhVNzycQaQbls8gENDtEghKrTaXaf1DprFg4Qbaij7hapcMCAi0CQOIvtzEeo96fMioQOEwvYJtFWmzpyPCnlko4TSpl/BKYEfZd64A8tAkv/ikmvzwTfr99uXYSgxkl9SVINrXoU6NV/I+ERsVa8U500b/HM+R6pF1ZcuNmUJwSA5OgANG5JINQga5EQRXQSQPwMDRu/Jtqhihvpv9qyjuCWdVxT3qa0jmkc3gs6xF+fSc50+XT0hiVh4lJ3JnFc8x+FUg+0+QvwSnaIymFnQ49vxKLnZ1ZZzxIew== 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=XwkJwd6iEi2G/zmfA059UUGNnQzSccT1X5mdUoQ8t/w=; b=Y1V+VRUiAsF4rvwGMIL5YMB5EjLIX2AmX0dX6v6bCnI95NXxIaM22mlJ1FHhhDhpV2mLQJjpKHIlwdOJFNVM+J3mXLGcYDL7LK0lmVP62UZ8QgTDUtasyL70/7Y1qhbtQwMpR5RcTvNC3wiTyCMXarcUxILwq4kkm4iVqL6XBHc= Received: from DUZPR01CA0321.eurprd01.prod.exchangelabs.com (2603:10a6:10:4ba::15) by DB9PR08MB6395.eurprd08.prod.outlook.com (2603:10a6:10:254::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.13; Tue, 28 Jul 2026 15:17:20 +0000 Received: from DU2PEPF00028D01.eurprd03.prod.outlook.com (2603:10a6:10:4ba:cafe::93) by DUZPR01CA0321.outlook.office365.com (2603:10a6:10:4ba::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.270.12 via Frontend Transport; Tue, 28 Jul 2026 15:17:20 +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 DU2PEPF00028D01.mail.protection.outlook.com (10.167.242.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.270.5 via Frontend Transport; Tue, 28 Jul 2026 15:17:20 +0000 Received: from AZ-NEU-EX03.Arm.com (10.240.25.137) 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, 28 Jul 2026 15:17:16 +0000 Received: from PF4S4363.arm.com (10.57.42.206) by mail.arm.com (10.240.25.137) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Tue, 28 Jul 2026 15:17:16 +0000 From: Matthieu Longo To: CC: Luis Machado , Luis Machado , Thiago Jung Bauermann , Simon Marchi , "Kevin Buettner" , Christina Schimpe , Christina Joos , Matthieu Longo Subject: [PATCH v1 1/6] target_fileio_read_stralloc: add an optional length parameter Date: Tue, 28 Jul 2026 16:16:55 +0100 Message-ID: <20260728151700.253720-2-matthieu.longo@arm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260728151700.253720-1-matthieu.longo@arm.com> References: <20260728151700.253720-1-matthieu.longo@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF00028D01:EE_|DB9PR08MB6395:EE_|AM2PEPF0001C712:EE_|PAVPR08MB9404:EE_ X-MS-Office365-Filtering-Correlation-Id: 5cfaf93d-6555-4a9b-aae1-08deecbb795e x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|23010399003|36860700016|1800799024|376014|82310400026|3023799007|11063799006|10067099003|56012099006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info-Original: PXMlIJJC9Hr2qxMOzOzyF9iFaK1fC8vJHJHyDNPYioJ9aOVgMoIaUzpzVpjCaOwj1KqIgh29tjESFD/T3pJowhxDJNIBWTk31VvlGPKSJTu7RF2mCS65Fpf80MBPacypJOriC21gQhy7+IlwbE1zzOU8FHgGsuahcPpsWcx9Ye9CURF8VwELea16PMEufasQ73+QQuPomiB9cTJWJG9lyF24BWzf/WA+9NBP5vbsFg7TygkQmgl9LQimhV8OQrpP2g2WMEsJWTwSTEchU5iDv83+oPxZZFvA6cD2V+rDHZQw9FlV4yoGQEr+2T0nUlS0A47mj7v8w1cQ4f1cDEzzLOZ/LSPZnzxadUkjYz9ZMhO08oQcBoiqqX3dREc8Bpl57fUxb9XJmESMSKdcyyLOsM6bf3rHwclRnRHvSbLYPisTRpArqNhlnW8MnpYgNwbWbChENEv5Q91VicI8S4g2I06W2q0hOFoHXBvakgrBghc5TV1a28MomNiqqCb/37s6Yx40GN+AuJ1yKlKOuf0Ifs37Prl14lz9/yozVAKHvrkPzcIryNlOBqogEmBDINa/yQCfZVrKhrMqWvp+r5lLlNTLkKm+fbvBv3ufI2Aiy4mRLOA5QA4Sl6sYT5X2LSpMwJVwVuQigjMy7D35BL+/AoloDko6tbzpSTLQXYncUcPyc7Kw2wXOAKVY9BSeFajmmQsbIoKnS0Phf1yh9vOGMQ== 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)(23010399003)(36860700016)(1800799024)(376014)(82310400026)(3023799007)(11063799006)(10067099003)(56012099006)(22082099003)(18002099003); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: KWPL/PaMStuif9B75wDa2BSeSB+TGwFNDHXQkqcRbj7l+TJv/6Jl/eBKSnB05tbIys2tm1U2aQ5hl76OGBWsMFcF4oRQtUT0ocdCq1lj2rVJSC+e8mAIosoHxZYUmq13vL6O1kG4yzyjE6lk2NouBdsuKBVB7zG/GRS25MCu5FhHi+2zHsue+IxA2rjier3EjmZEyp23oKj4+6Igdc/snmWLVziVomzxFFt7n69BNuFiVjg6G5MKYdfUjWswJRu35MWVtC3LOOaEoIU1bZWQ9sX76yBYhkpWh6gcdxUq12CJejbmh2pDfMns+kk58p0y5aqZzt4vGEZ7dpC5+K8p7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6395 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM2PEPF0001C712.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 1ed5202c-1c79-4288-c465-08deecbb51ce X-Microsoft-Antispam: BCL:0; ARA:13230040|35042699022|14060799003|23010399003|1800799024|376014|36860700016|82310400026|10067099003|56012099006|11063799006|18002099003|22082099003|3023799007; X-Microsoft-Antispam-Message-Info: yh+dNR1WK+OGBxRXjZqU/wc4qv0CDPDIlm6WbEF5vMHnLbPfSuXGj/EKiS3sJJkuOWI8ymP6PcoZWABglGPqfHmfxk1veRIob7Hnnne6URz5yRoJ1e/PhAVDQ/ZQqeJfJTuxmShqJlp6q0TTVSO5WjXC9YClqIBoPVmWrb7mkF/i7kPVBCEcRcESvh/EkWpLMuOrv8um8SscGQ9vuzqs0zKc304OD5BOY+gdGlyvMITxw/5VzfMZr8Tyi1Kg4NCLFYvro/iFcryjKgJWjmqzMLvBYIjApMKqdj/Kxbs6UjcmdLUcaDf4TTPF0LRAbTIdX6eSOIcchoVb0lqNRwcGA1/fq9UnWO7KH0D5LDX9gF8BN46JLdpOSiDVfUgoUCCU/HfqXXC3eSzEjz/yi+b3C09gvkLFUyGt6DjCcRIEQGzezjc+uZYGTsdIGHnubc/XfITMCcEGTjBJkwSKvOgjYdV7pWMHBcZa27kVcofjDyzTu9BcLAmqBZKcai9yAXWNy1Dq37P2HF10HCXWdtZw2KroGMDSM0xR3AzKEQIjGDpSKQk9nCxrIF9hMV8Rrw6EXPp88gA1q6oUN8x3xqApX0lfLPmzVXIGV7hud148XEEEJDArKygSuqAgeFo7J035cPHXr3rfqa203jOUojBmvhBdyXlNmUb0PraHAmjhw0HcHnPVNnIJtZtYrSipAhB8NHLHuLckHNdBBwSKpfpacA== 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)(35042699022)(14060799003)(23010399003)(1800799024)(376014)(36860700016)(82310400026)(10067099003)(56012099006)(11063799006)(18002099003)(22082099003)(3023799007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0b1dcEIJfuqzrLdfK2F+jChr1bh+EdjyoLoFUydZgFtjV5XR9kf+tf9Tflth2mVlRM6ZpiSsWtDelYNmLB4qVYpSI6SLJ1tEjdl0OJBCyYZPWhf/+PIhPbExfCv/HMDtY1m/6ABinqr9VAXXnbE1OhyDVmkaWpl4vC37nu2DrYIo53F2Cvr+goQvTCIYM1nj7hR4beTL7MVeYxABtwKMPapu6iuUqoYWbbBvqOIA0WWrH8h3Jy8rBUqvYm90QEtEWXfKlxisvxutOoJ3igRNt8pbquq26omSNryW+5aSY0DTB06b5E9EsMF3X8vUKHiusbhAtqC6n7qD2J5sHvdtN1BBpsaioIe+BwxjDcOIM15haJ3y7gYrQ0dL0kuLP4oY1AYsY+RNJBv5RZdTr7D9pfSjCYGb9OShk3E1hns/xUt+n17Z2fj/DtltzYZuOJup X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2026 15:18:27.1594 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5cfaf93d-6555-4a9b-aae1-08deecbb795e 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: AM2PEPF0001C712.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAVPR08MB9404 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. --- 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