From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0WB9AeVxjGr0zTwAWB0awg (envelope-from ) for ; Mon, 24 Aug 2026 12:31:33 -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=aJET8PVq; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aJET8PVq; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id EF6591E0A3; Mon, 24 Aug 2026 12:31:32 -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 [IPv6:2620:52:6:3111::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 F135E1E033 for ; Mon, 24 Aug 2026 12:31:31 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1BFD54BA9008 for ; Mon, 24 Aug 2026 16:31:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1BFD54BA9008 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=aJET8PVq; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aJET8PVq Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazlp170120005.outbound.protection.outlook.com [IPv6:2a01:111:f403:c200::5]) by sourceware.org (Postfix) with ESMTPS id D724E4B9DB52 for ; Mon, 24 Aug 2026 16:31:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D724E4B9DB52 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 D724E4B9DB52 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c200::5 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1787589062; cv=pass; b=rFVaMv0mx0E7VaXaRwLY1K776UcAZQrWSxHixXgj4RVU3wPc03d2SSNz3Xi9VBuZC4akUUfaZzrCpPuOg0XetOz2DBy6VnyU+yi5FPIdBxAvIDv57sj66wupp74876KDZRIF+cpY+HNhyBoJ2P5S6YJYXxnOiKJVuYKQ9DmtnzY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1787589062; c=relaxed/simple; bh=To+rK3yhKTp7EHg4el+eixlc9fO7blyY6jwBAUD/WnY=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:From:To: MIME-Version; b=mluItYXmsaAYGWS/eC509iWoBvC4lHT0/gdTz3Ph0WxQ6s3IXdDO/gfCyftmjVxXh9N4V0v3usyJtbNy1isQlxsLz06oJM5eYA1akQc0wWI/ZIrfGfucwCdMj0RyNlN586r2dNXJM+4B0r/COrdbsiHtZL3EInodZSBLdV1y2yA= 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=aJET8PVq; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aJET8PVq DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D724E4B9DB52 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=cZkPB48M1WJ992yqSNnUfKpA04lY29I8q4nR/46uK1HEKo15XoLNdUHln/Zv55l3nb9wc4RHqCU4fcJKV4zMpcHhMl2S6fzTAlmgW7tjihNJQOwfWzqDa58tq0glKGFUgxmsYcQSssULazj2y4fTD2W/MoYylyti7mqi++mgvM0iuf1zM+yiMY5400DliMJ8qMzkgT+yu96c3Du0M8Bqae9R+CD/AiYDpDBm8Lp/lSmSeEPOQhySpE9/2dgsJ6CLPJj0c1UhpUyI9vl4mb2Chp+oMpatBui5RVbntoG3tYUlc50EldTNKNMd9AhRXd5C0IdflNi5fdEEufULu2LkpA== 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=v52aHR4xSouaR5KFXsbgtj1bWtSrsulxvnbRYTvGO1Q=; b=wLlt3jvZf90vJh7hbx9lrnPoVt5TTHTSd5kFvvQqzQFoxkG6VrMHEI/SUD4e9vt+G9NkVoL4wiLAVmmIcd+SjbcBzeqwHIS6z+xaOf21BKv6eI97rwipyeaQAOD/KawjE5oGK0gIEzgiznh/RpkRGlVgjcDVGscN6CtmykmF16hqKHfmgtuv7qYVPeFVHGZFoIvd68wC7QZmsPY+PuVgawWwVZ4f1IWtSs3B9FXT7CLl2RB5BfSjraDdH8g94GHiArLGwK10nAdgZ/b1OaLwz/5sEEdgd94C7xOrXkl2hXRtecKJtC3MwENoco3lz8XEofEZm62lbIu4Wa9FWENuBQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=intel.com 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] dkim=[1,1,header.d=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=v52aHR4xSouaR5KFXsbgtj1bWtSrsulxvnbRYTvGO1Q=; b=aJET8PVqa97wCLAof8KJH9PSi2gq9fUMzVK2jRgb55i/dJU/8uwy9gnxfmGzvEw/fnneOrFflJsLanrY1QryWsvPqndg7LXrYmmt+oN5MT0KPXAiNMqpoZb57/6sFh1o0uQgQOrpec9FK2n+lgHnEBFxSzUijwPph+0qTLvNzXM= Received: from AS4P191CA0053.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:657::29) by GVXPR08MB11742.eurprd08.prod.outlook.com (2603:10a6:150:314::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.339.12; Mon, 24 Aug 2026 16:30:49 +0000 Received: from AMS1EPF00000094.eurprd05.prod.outlook.com (2603:10a6:20b:657:cafe::a5) by AS4P191CA0053.outlook.office365.com (2603:10a6:20b:657::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.339.12 via Frontend Transport; Mon, 24 Aug 2026 16:30:49 +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 AMS1EPF00000094.mail.protection.outlook.com (10.167.242.91) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.3 via Frontend Transport; Mon, 24 Aug 2026 16:30:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zN0jmn/VCyaer7BHcqTM4LfS9nWkTb+VxnxL4QGBnJTP2dt2dbRd9e1azSF5dDF3LUjnY2o5SSvIO/23eYMR3d1gMwxrVoS8+MHodd+lbB9mzDAFYC+HSs1GAudk/MtwXRI0MVdDF3kL29/jJdJO3ioDBg9glUFvtqtkyYV+NkLFfJkonoCJ6yc2lh6EgYCwIHUkSLguOiFcssGHmeVYdKR5ChDZDID27R8lKL/IdvlthpUgQdGgSbs9yFzELO5YatZ+MKoak/mjvPhdAdE6ISRkaB6Tf912jRdFgUcWo/SYAWDnE5HcH4dRCwCknBX4V5zWM3KXO5I8OVb893IGHQ== 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=v52aHR4xSouaR5KFXsbgtj1bWtSrsulxvnbRYTvGO1Q=; b=XInIDFktS6cj0Lvs0z3thHAwKHcKH79OBkHVwdtct5RI1+03IcgXzsCXZ1JZiYGEncz6ZHit27RQh80GaSvDR7Tb2JmjMVEeeKxR0iEWDC8r0WJIcIFNBCIsEk5q15inuytjmYzm1OX5zSLJgSSGrRhSJJ5EsWBKECie/WhEZ1Y/H2W5ra+ibQ2tiT7SZ2bSvrP6gJOQuqbYYHv/uJJzby2vG+qU3IKSCLzUB+usYaVVI+e0gwzki4wWGSjOymnTeDlbElg7lvc0INhELPgbCKv1aUU7NPxB03MHkzjoCmsKEIgxTbB5/1O8TsfnYkJKGL6vKexKtJyGaNLikoBbWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none 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=v52aHR4xSouaR5KFXsbgtj1bWtSrsulxvnbRYTvGO1Q=; b=aJET8PVqa97wCLAof8KJH9PSi2gq9fUMzVK2jRgb55i/dJU/8uwy9gnxfmGzvEw/fnneOrFflJsLanrY1QryWsvPqndg7LXrYmmt+oN5MT0KPXAiNMqpoZb57/6sFh1o0uQgQOrpec9FK2n+lgHnEBFxSzUijwPph+0qTLvNzXM= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB8659.eurprd08.prod.outlook.com (2603:10a6:20b:563::10) by AS8PR08MB9868.eurprd08.prod.outlook.com (2603:10a6:20b:5ac::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.339.12; Mon, 24 Aug 2026 16:30:15 +0000 Received: from AS8PR08MB8659.eurprd08.prod.outlook.com ([fe80::96bf:2de3:5eab:70ae]) by AS8PR08MB8659.eurprd08.prod.outlook.com ([fe80::96bf:2de3:5eab:70ae%5]) with mapi id 15.21.0339.012; Mon, 24 Aug 2026 16:30:15 +0000 Message-ID: Date: Mon, 24 Aug 2026 17:30:14 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 3/6] gdb: introduce helper class file_reader_t From: Matthieu Longo To: "Joos, Christina" , "gdb-patches@sourceware.org" Cc: Luis Machado , Luis Machado , Thiago Jung Bauermann , Simon Marchi , Kevin Buettner References: <20260728151700.253720-1-matthieu.longo@arm.com> <20260728151700.253720-4-matthieu.longo@arm.com> <2c974a80-9ad6-4b46-a6a9-33a8e710d372@arm.com> Content-Language: en-US In-Reply-To: <2c974a80-9ad6-4b46-a6a9-33a8e710d372@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO0P123CA0012.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:354::20) To AS8PR08MB8659.eurprd08.prod.outlook.com (2603:10a6:20b:563::10) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB8659:EE_|AS8PR08MB9868:EE_|AMS1EPF00000094:EE_|GVXPR08MB11742:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c135c31-0d9b-4cf4-34f1-08df01fd0e2f x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|376014|23010399003|366016|1800799024|18002099003|22082099003|56012099006|11063799006|4143699003|10067099003; X-Microsoft-Antispam-Message-Info-Original: dFi5BTOrGme8RzCfvV+EtF92cPByJ32+YdTnOrRkkPtWWk5UFjvXmU1i3YUT4TfiyQqNGUeUV3w2mCbBu4PaKfZLyoIglAP1kHbDoO7sBnVop7Q6zIX7zmtGCjd/TYcmmU/aN7sywIh2X1wEKYcA6Z1U4AE/d0RvQzBfFPXA+cdv0ireUPK9KY+meEpgV4gz36vLZcMVwayfLvnkv03lVERlrVCLor/n0K0PUF5LUAY9CWGPVhuuVynlwdH8tErif9XtHSsTyIrg5yt/NMO+7omRZChkGmsFGJYgfhP9NsQqHg+843EBKDUBOshNlOxKYufRwu/1zn6d7WdHSCKr40M8u6aelsItz/0HeZdqNwEfprxQb5uvADqD4ZizAgX28Fo4A1N4/X/omQvuhl6xNYkPEApb5UjlkazC3RyKIztegTXUOgnVDtYUOs1zQk4uopaU3gpGyar6HW0NwXTsVrS/MVygiR1W2gpG6aaK8Y+2cJw9I6viDuqzgfKvcTFiFQt1MW7rD8qWJHtRMgKC5yqCLlHw5NreEXsyfuUQOiKgne6AXFajhZPx/HdBl0hFtInXdD8v/s9SmjPnTP5yYPC+c5aMUvMbWiB1iHndQCxjJmY6ltcL7P1bydH/crJyzRvVi/TMlgeB474e1wB4rBCYIwuHeuQwHkwJKU1wjI4= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB8659.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(23010399003)(366016)(1800799024)(18002099003)(22082099003)(56012099006)(11063799006)(4143699003)(10067099003); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: tNNfQGG0JKi+gNpA27fjBA6xofA8DcaI3vkSitsnOVQ5nXoJqdahs3ArlImMokqXYXui5zeKzJmsoG3B049wTwaysOVhJLPm3YJvvf0QDC4PNcxRDhk+bay4YhZPF8cWM5hpoBur0dJJhBpSh8q8fjybrMXV3+lt5ADuOABt5LoxUcR1I0xLjM/4prBF2uAnfAce9CIrkfUmYdooNytNExnyk+FUzApPVpwbTp6gK0fB9IpqF31uYsWoW6gIAocQupA/tjDUOATd465Ku2KdJG//wYbxIceN0QfkmNVPzkh9y//m96OoDnewWrXfcRg9yhVZ5EzG1vWXU7S4Oy9MZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9868 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AMS1EPF00000094.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ddef7327-ba88-4fe7-6e1d-08df01fcfa3f X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|23010399003|36860700016|82310400026|35042699022|14060799003|376014|18002099003|22082099003|10067099003|56012099006|11063799006|4143699003; X-Microsoft-Antispam-Message-Info: Y5HgsGFB7V3Ca8ZcsDXfermYmIZNsm0+HBTufW1Wpi/cJxUiEypauw+3GgVAdVX2c/sO1CYNW+GKC0cvWAlcLbPokolmfxTovNgO+mwHlhcpQnsNjraGfxkybkfUugoVX452dD5/PPqnKTZR8lNGPKifPRNjdOLdRF5V6UvZXWP7X7aF5xhpkOPtQxs48jP6R82/CWyfyySm/zxQbbAy5ofPr1wIdeeQvOKRVI9pNO2EneRuxn3BB6XukHI4DQDFO8TAUALxigObAk5IDavRlREMEEtB8I1zRxtOhZeNqyHpyk2jmL45uA1TfKQ4atQiNt/kFVRFj8sMd9y4Q8cBgFTQ8Hlo4oHaItU0gmQ1SfEBGEqGnuKmSPSYFVp4AXHiYti/sjdoY7QYOmrJlX+f9VCxRVX3J93zyBlrQE5g6attkOIcm5Jl58QM5pM23bEB1R8uQZU4rO6AdAmtFzGjHxeHNLVaeBybY3sn87j3HblB+BjTuYrCUdy2mmNRF818KzJkYWo7CIonwv86i3FrQKLgolIPuO0ZqdiGTMuN79n4gw+tTQWx17zksCOgs42EynKK+EXnVtbFsuelAGntObEc41AlsDs8SKohC8eqjGWSTm+Dsw6x1bzystLQUN8c7XoC7XHIIzEcZVG+K31/53bLcSAWAbTWLFDiMlCG09jm9TF6t+40N5P3b4l4ihMio174lZDvnUPygHQjxn391w== 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)(1800799024)(23010399003)(36860700016)(82310400026)(35042699022)(14060799003)(376014)(18002099003)(22082099003)(10067099003)(56012099006)(11063799006)(4143699003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6dq0s/1d4hXIKpVPQuFWe/4msJNCneMazKjDpqBgtQxWvpQ+G5uPBG1ql+XXPR8oPxU4UU0VkZxBZpU805KevxecQ3eIPaHYGwptwT3CZm9IC4sgjMXSRX1CetyBY9EZHw6MolYL3/hc8+ypHWbAnUB1mkUyBeOez10uVh6s/BKKEfnJv7WEG5e84RlR7locUjcGYT1hsTPFgHR2+TsallNpuZmhh6Ms5pGzFDLprVG+SlHAcxiaycrz6BhUPsFQl2gVhKwRSP+5YpOq+Gr9riAwSoBdeK3BUE75bwlcSe8LT9uooSJwPRY3sKOxqodp+jgGkKg84EGKOewi9TiOxXRpYXMoFLNYd0+xqVrUpAD5Pt117pmfop5nwpfI+KLz51/ufzNMLlgIdZty5dBjjy8RQ2jT8rlFiUlNAuX0+JTr9yoOU5znvpPDgl9rah+m X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2026 16:30:48.5126 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c135c31-0d9b-4cf4-34f1-08df01fd0e2f 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: AMS1EPF00000094.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB11742 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 On 14/08/2026 16:25, Matthieu Longo wrote: > On 10/08/2026 14:07, Joos, Christina wrote: >> Hi Matthieu, >> >> Please find my feedback below. >> >>> -----Original Message----- >>> From: Matthieu Longo >>> Sent: Dienstag, 28. Juli 2026 17:17 >>> To: gdb-patches@sourceware.org >>> Cc: Luis Machado ; Luis Machado >>> ; Thiago Jung Bauermann >>> ; Simon Marchi ; Kevin >>> Buettner ; Joos, Christina ; >>> Joos, Christina ; Matthieu Longo >>> >>> Subject: [PATCH v1 3/6] gdb: introduce helper class file_reader_t >>> >>> Wrap all the boilerplate code required to read a file in a new helper >>> class: file_reader_t. The class owns the file contents together with the file path, >>> and provides convenient accessors for the data, size and typed views. It >>> supports both null-terminated text files and binary files. >>> >>> This helper eliminates repeated calls to target_fileio_read_stralloc and >>> target_fileio_read_alloc, remove explicit memory management with >>> gdb::unique_xmalloc_ptr, and simplifies the casting logic when working with >>> binary data. >>> >>> The patch converts some of the existing Linux, AMD64, and SPARC code that >>> reads files from /proc to use file_reader_t. >>> --- >>> gdb/amd64-linux-tdep.c | 12 ++--- >>> gdb/linux-tdep.c | 109 ++++++++++++++++++----------------------- >>> gdb/sparc64-tdep.c | 13 +++-- >>> gdb/target.h | 79 +++++++++++++++++++++++++++++ >>> 4 files changed, 137 insertions(+), 76 deletions(-) >>> >>> diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index >>> 9bdcc55a0e1..11f0a6952ea 100644 >>> --- a/gdb/linux-tdep.c >>> +++ b/gdb/linux-tdep.c >>> @@ -1698,6 +1698,12 @@ parse_smaps_data (const char *data, >>> return smaps; >>> } >>> >>> +static std::vector >> >> Nit: we should omit the struct keyword here. >> > > Fixed. And in others places where it is relevant. > >>> +parse_smaps_data (const file_reader_t &freader) { >>> + return parse_smaps_data (freader.data (), freader.filepath ()); } >>> + >>> /* Helper that checks if an address is in a memory tag page for a live >>> process. */ >>> >>> @@ -1709,17 +1715,13 @@ linux_process_address_in_memtag_page >>> (CORE_ADDR address) >>> >>> ptid_t ptid = get_process_reference_ptid (); >>> >>> - std::string smaps_file = string_printf ("/proc/%ld/smaps", ptid.lwp ()); >>> - >>> - gdb::unique_xmalloc_ptr data >>> - = target_fileio_read_stralloc (NULL, smaps_file.c_str ()); >>> - >>> - if (data == nullptr) >>> + file_reader_t smaps_freader >>> + (string_printf ("/proc/%ld/smaps", ptid.lwp ())); if >>> + (!smaps_freader) >>> return false; >>> >>> /* Parse the contents of smaps into a vector. */ >>> - std::vector smaps >>> - = parse_smaps_data (data.get (), smaps_file); >>> + std::vector smaps = parse_smaps_data >>> + (smaps_freader); >> >> Like amd64_linux_lam_untag_mask we have a minor behavioural change here. >> But I again see it as an improvement, as the result should be the same, we just >> return earlier. There might be some more cases in linux-tdep.c, but I did not check >> all of them. >> >> I think it's worth pointing out in the commit message. >> > > Amended this paragraph in the commit message: > > The patch converts some of the existing Linux, AMD64, and SPARC code that > reads files from /proc to use file_reader_t. As a side effect, > amd64_linux_lam_untag_mask and linux_process_address_in_memtag_page > may now return earlier in case the file is empty. > >>> diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c index >>> 93db3417a2a..955631b87df 100644 >>> --- a/gdb/sparc64-tdep.c >>> +++ b/gdb/sparc64-tdep.c >>> @@ -301,18 +301,16 @@ adi_tag_fd () >>> static bool >>> adi_is_addr_mapped (CORE_ADDR vaddr, size_t cnt) { >>> - char filename[MAX_PROC_NAME_SIZE]; >>> size_t i = 0; >>> >>> pid_t pid = inferior_ptid.pid (); >>> - snprintf (filename, sizeof filename, "/proc/%ld/adi/maps", (long) pid); >>> - gdb::unique_xmalloc_ptr data >>> - = target_fileio_read_stralloc (NULL, filename); >>> - if (data) >>> + file_reader_t adi_maps_freader >>> + (string_printf ("/proc/%d/adi/maps", pid)); if >>> + (adi_maps_freader.error ()) >> >> Didn't you mean >> if (!adi_maps_freader.error ()) >> >> ? >> > > Yes, you're right. > > However, I am wondering why the diagnostic message is not an error instead of warning. > Any idea ? > > I would also like to change the program flow to something like: > > file_reader_t adi_maps_freader > (string_printf ("/proc/%d/adi/maps", pid)); > if (adi_maps_freader) > { > // This is skipped when the file is empty > ... > } > else if (adi_maps_freader.error ()) > error (_("unable to open /proc file '%s'"), > adi_maps_freader.c_filepath ()); > return false; > >>> diff --git a/gdb/target.h b/gdb/target.h index 819279c08fc..09830dfe3a9 >>> 100644 >>> --- a/gdb/target.h >>> +++ b/gdb/target.h >>> @@ -2341,6 +2341,85 @@ extern LONGEST target_fileio_read_alloc (struct >>> inferior *inf, extern gdb::unique_xmalloc_ptr target_fileio_read_stralloc >>> (struct inferior *inf, const char *filename, LONGEST *len = nullptr); >>> >>> +/* Helper class for reading the content of a file on the target. */ >>> +template class file_reader_t { >>> + /* The filepath of the file being read. */ >>> + std::string m_filepath; >>> + /* Smart pointer to the data. */ >>> + gdb::unique_xmalloc_ptr m_data; >>> + /* Number of bytes read. */ >>> + LONGEST m_size; >>> + >>> +public: >>> + file_reader_t (const std::string &filepath) >>> + : m_filepath (filepath) >>> + , m_size (0) >>> + { >>> + if constexpr (std::is_same_v) >>> + m_data = target_fileio_read_stralloc (nullptr, m_filepath.c_str (), >>> + &m_size); >>> + else >>> + { >>> + gdb_byte *buf = nullptr; >>> + m_size = target_fileio_read_alloc (nullptr, m_filepath.c_str (), &buf); >>> + m_data = gdb::unique_xmalloc_ptr (reinterpret_cast(buf)); >>> + } >>> + } >>> + >>> + file_reader_t (file_reader_t &&other) >>> + : m_filepath (std::move (other.m_filepath)) >>> + , m_data (std::move (other.m_data)) >>> + , m_size (other.m_size) >>> + {} >> >> I hope I get the C++ rules right here: >> AFAIK, since we have the move constructor, we implicitly delete the copy >> constructor and the copy assignment operator. >> >> Wouldn't it be clearer if we'd write this explicitly using DISABLE_COPY_AND_ASSIGN ? >> > > I agree. Added. > >> I also wondered if the default move constructor is doing the same thing, so we could write sth. like: >> file_reader_t (file_reader_t &&other) = default; >> >> instead. >> > > Fixed as follows: > > file_reader_t (file_reader_t &&) = default; > file_reader_t &operator= (file_reader_t &&) = default; > > DISABLE_COPY_AND_ASSIGN (file_reader_t); > >>> + /* Return true if the file was read successfully but contained no >>> + data. */ bool empty () const noexcept { return m_data != nullptr && >>> + m_size == 0; } >>> + >>> + /* Return true if the file could not be read. */ bool error () >>> + const noexcept { return m_data == nullptr || m_size < 0; } >>> + /* Return true if the file was read successfully and is non-empty. >>> + */ explicit operator bool () const noexcept { return !(error () || >>> + empty ()); } >> >> To me it would feel more natural if we return true also in case the file is empty. >> Then we could also omit the error function. >> >> But I don't have a very strong opinion about this. >> >> >> Christina > > The cases where we use .error (), the alternative should check whether the file is not empty. From > this perspective, including !.empty () in the boolean operator makes sense. > > See for instance linux_vsyscall_range_raw or adi_is_addr_mapped, the loop with strtok_r() will be > skipped if the content is empty. > > Matthieu Hi Christina, Do you have further comments ? I would like to publish a v2. Regards, Matthieu