From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id RKVtO8RG9GrdxQEAWB0awg (envelope-from ) for ; Wed, 11 Nov 2026 05:43:16 -0500 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=HVcU8AHl; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=HVcU8AHl; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DEDB4378002; Wed, 11 Nov 2026 05:43:16 -0500 (EST) 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=ham 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 707A61E04F for ; Wed, 11 Nov 2026 05:43:14 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E2DFE4BA2E28 for ; Wed, 11 Nov 2026 10:43:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E2DFE4BA2E28 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=HVcU8AHl; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=HVcU8AHl Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11013001.outbound.protection.outlook.com [40.107.162.1]) by sourceware.org (Postfix) with ESMTPS id 924834BA2E25 for ; Wed, 11 Nov 2026 10:42:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 924834BA2E25 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 924834BA2E25 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=40.107.162.1 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1794393760; cv=pass; b=cURdMS/VCVt5NB0Bd+0mW4l43XfaznrektI8Kz8e/jOJIrpdObTOnxYYGO/wgCCb5c40v+hS+30CINX2SkANaP+l9ePgowjPzJHtD+rj0ehxPoZxs6r+Jt+4QLy5G0YvVHgq0pAEYLQcaBaIfexCp2H/prx7Mg0f5SFjowp5Kl0= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1794393760; c=relaxed/simple; bh=2Ss36OPvjtefk4aX3iNBc9MibyGA2piclEVKCAjqtfY=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=QigxU8V24TXnw8Pi9vhaEmpPWfvHbykj++DU+ClIljG6nqVz71oUrooP9CPJytgO/p+2e5JNfm2JgXt0XB4CuHnLWyeLnj5iPD4x5TD2aXvJs0DGG9/dj5I54bB/JMF3Kw4OJ4calM5DcN9KGKWxOiAH5qnbWt2gGYL5s9ISzQM= 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=HVcU8AHl; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=HVcU8AHl DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 924834BA2E25 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=Ky5P6Nr03EWLcpBvq3G4Rky24uM7BGBMey4ngLTwzW+BRgqkpnXoply97cy3wq0qFxItEhhzfUHn6Co9aYcygoY77UoHVNeK31F7H6RiVOJc0l+XsFprQ+k8SvXG13yF1AvxdxQNVUQRDfWz95lcYhkDIfzYxLqDUVFNYh5Ng0BbQOnP7XAyMKWaIjiySHl4dVPkkdDANZOr+xO8G/b17WIuPM9SX4koqQMj/4JreFEPFt1vLfLb72rOXlMxlGziRPfcABkfqKD/NM2YnwrONaNRtdaQ8uT35skIeQwnyjOQGolbfaoiV49szCGg+FoqsHLFbKhEV3UL6O1QsiwA7Q== 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=jxAadCejt11t5Iob/nQkKPd4Er8JJegSLxopa4CpQes=; b=DNp1HIhD1g4Z1cSEF6vTcwuJQhNqeWy4VMafO6XmSyafZN7brBoYEw/sQbHpIDfAUb6854t+cre+6yVaEEzJeEWjv6Z93N1LV+PaeZBfimYcOPrI1GvFP1b29/wBB30w0EPBGRbVhL/jPYD/FOcR34pc+pmSlDkWLV662dsCmvJhZQYSnndiWndILzhdL2P7dV6RkBd0NdkF1WMOJql8Gamgz9ic5GK45K7ECdtdbJriPnbY0MjD43Oa8GjJCdjRjwS+l+XDbx+ECsIXgZtS0CH5qCEhSeIbTEMCM3Mk5S7mmm7X1befehqeEFHDxUfec/ol6igG+QEQ5U23z+fyrg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=tromey.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=jxAadCejt11t5Iob/nQkKPd4Er8JJegSLxopa4CpQes=; b=HVcU8AHlCugLGGNI7x5dAK1X8uX2uMv9fTwh8BBrXOZG+CThhJwXXW3wssFw1mSJoKxYCy5S4xbgXS2+hVAkHThXcmD3AbleO2zT6oYApOAjzevFl/rmSqzE9RLI8Uk/hKfKCDiOTfwgE8mI8IQ4/MgUrSb+ZeuTDVEbFUlx3xY= Received: from DUZPR01CA0211.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b4::24) by DB5PR08MB10046.eurprd08.prod.outlook.com (2603:10a6:10:48f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.8; Wed, 11 Nov 2026 10:42:31 +0000 Received: from MAD0EPF000008B0.eurprd04.prod.outlook.com (2603:10a6:10:4b4:cafe::90) by DUZPR01CA0211.outlook.office365.com (2603:10a6:10:4b4::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.615.9 via Frontend Transport; Wed, 11 Nov 2026 10:42:31 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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 MAD0EPF000008B0.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.615.4 via Frontend Transport; Wed, 11 Nov 2026 10:42:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=t5mzn1SKkrR3kFbwgzVlgK4jzN3BWk1vas8LL+O92dq09L2vf4Qw93v/IYlE6xGpiSy/sdbR4mk5xRF3oIGqabnQlgXL/aloci0R7DMHkQorai0Q5+DBKV1QhonMuIqoesbUoIjQ05+OxTI37MQVE7BIaCXJfACfHbHOR0/CmyXbsVVHMNaA/A4DCZvLvgC5GIiO7iYAvso2N2aBQLX4BH+0DZHyDWYbHEHLz7YHp6Cp/l2jqwEX1UABg8fomyEiDym2S9dHzbnJ2fK3/sr4ZpwiWf3OdiLvYUW+earNvwgM/HQuEX7tiFpL/VBIwp5z1GD57AFzS4pAu2UJKwcZUw== 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=jxAadCejt11t5Iob/nQkKPd4Er8JJegSLxopa4CpQes=; b=uopLMcQyaPsoZRjzA2cWJZiLoVNJtozaLFzKqodzAnMg6Y4HNNWTrtCMLVa1gG/4anG58kusBsUB6VuLGp8XeFOpUOsuOnVdEDWXkm3bxswswKMR/Iq4Zvs/4VgMrMzN2VeAJ4KOM2fiTj9vF2jjMTNS9hTaimOIRYr+VKwTObG3/3DS43GXa/ElfpK+NtMLXnx+5pXmBvmBULB7ntsz4uchO5LE1t6n41jRe1Dl96ygrO/iMjWXhSiY5mKTFKYAoOKf3SG6of1pWF3g0P/BwNG5pHvkV14OFOqTQkg9K5QrCpjISo+XczNCu67vMf4G6ot2SLunCJAW+ymX+NwYZw== 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=jxAadCejt11t5Iob/nQkKPd4Er8JJegSLxopa4CpQes=; b=HVcU8AHlCugLGGNI7x5dAK1X8uX2uMv9fTwh8BBrXOZG+CThhJwXXW3wssFw1mSJoKxYCy5S4xbgXS2+hVAkHThXcmD3AbleO2zT6oYApOAjzevFl/rmSqzE9RLI8Uk/hKfKCDiOTfwgE8mI8IQ4/MgUrSb+ZeuTDVEbFUlx3xY= Authentication-Results-Original: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from MMZPR08MB432554.eurprd08.prod.outlook.com (2603:10a6:190:4f::17) by AS8PR08MB9792.eurprd08.prod.outlook.com (2603:10a6:20b:613::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.592.11; Wed, 11 Nov 2026 10:41:55 +0000 Received: from MMZPR08MB432554.eurprd08.prod.outlook.com ([fe80::c446:154a:e347:29e8]) by MMZPR08MB432554.eurprd08.prod.outlook.com ([fe80::c446:154a:e347:29e8%2]) with mapi id 15.21.0615.007; Wed, 11 Nov 2026 10:41:54 +0000 Message-ID: Date: Wed, 11 Nov 2026 10:41:54 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 5/8] gdb/linux: refactor /proc mapping parsing to use array_view To: Tom Tromey Cc: gdb-patches@sourceware.org, Andrew Burgess References: <20260922135050.236941-1-matthieu.longo@arm.com> <20260922135050.236941-6-matthieu.longo@arm.com> <87wlqrvvkr.fsf@tromey.com> Content-Language: en-US From: Matthieu Longo In-Reply-To: <87wlqrvvkr.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PA7P264CA0372.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:37c::29) To MMZPR08MB432554.eurprd08.prod.outlook.com (2603:10a6:190:4f::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: MMZPR08MB432554:EE_|AS8PR08MB9792:EE_|MAD0EPF000008B0:EE_|DB5PR08MB10046:EE_ X-MS-Office365-Filtering-Correlation-Id: bd1bd8e1-6e3e-4ace-472c-08df3fe07cb5 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|1800799024|366016|11063799006|4143699003|261102123227099003|261009223027099003|261021123027099003|261021121427099003|56012099006|261022075727099003|261026121527099003|10067099003|22082099003|18002099003|6133799003|3023799007; X-Microsoft-Antispam-Message-Info-Original: MPCvoCWFcmtUSDPy3J8ePqCfWiRefWNcEDfUO2q4mX3TmCRYXDhjdndnCNWQetqHoRxL/BvhChOAVdPH1C/Apy7UISQ5MNtUHATbi4iOhvuX4GcN4R0uepvtlVHnf3nGqKaQPlZkHkBp0F0MW3ay45LwhOTyN09jM3XGZODuk3ZpulSn/OhNdv8211dDF3iGyT+t139j/cI3DOKP/cTJiWw0sdVTvG4qSkZz7ysgZdYSC0HTyZKmMPk3QHoNrxyDnGHR3dFks3stzArbsZRWonSMyq9LZdHBcueSaKCzUIbKSoPkY8FIRd+c/6qVExxMnxg70sdjvm7R8KI9Smgs9eESMCO04DHJi0QYOS1P134Ncmnc5gtstFY3TjvNKjmYgUz/Y8MLSwtQKqJVMQLOtlZsIKOSzct4/sAj1tnZAXboETVZd4gOe5UKJNgqK/i4gIGlZtVoeXpWIApgk74xQf/MdvVJPsQX7ATsn0ITx1OrT1v9/AGgmJy29SbQif1yKdasNR7X5QC9fMK/B40aHt2L9MaVNL2uAwvQ17uwWe2f3fAiy7nTLcNTtbKODliTtut5XTgNvDsq6ZOF9EjyJ0+b8i13zkY5psJnHGz3plNRhXAoqr+dcNRH5tQ6NbKnU455y5ARKCF0pHj1EDHSmZ+qbSkV6R1fqG5GxO4Z+OU= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MMZPR08MB432554.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(23010399003)(1800799024)(366016)(11063799006)(4143699003)(261102123227099003)(261009223027099003)(261021123027099003)(261021121427099003)(56012099006)(261022075727099003)(261026121527099003)(10067099003)(22082099003)(18002099003)(6133799003)(3023799007); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: 5Fnon6xUGheBLT641VkI4XJmYhIWOeNOIJH6Awh0q670yAqpJZVxCw6Dovbgy61Orajtp1GDhefduxt3DF/CJMcJ0PkbIJJIs+SCPzF+4JMTWhMCoNi+HwCxgiaQ+eF4MhhNtuZRvuZ2wQhD5mtjgt1c6g3TofAgq69S97szW9S5DBFWWGWc2QhtuVVHhdr0LgRy5/FHjVWCRuH9AjdIEosyB97Twq2qu83BRrrKwmrTuG8dzHJp0SBxPcMO3HMY5f2XXk4COMoglS5a3vqJCZ5jkZTnECsKBIeM88I8T5z1rkZXIj7DO8laQYhRcYe1RuDf8GvLrA9Yj3LyX/0qqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9792 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: MAD0EPF000008B0.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 84c5e528-5ced-4569-e120-08df3fe06745 X-Microsoft-Antispam: BCL:0; ARA:13230040|35042699022|36860700016|23010399003|82310400026|376014|14060799003|1800799024|18002099003|22082099003|6133799003|3023799007|11063799006|56012099006|261102123227099003|261009223027099003|261026121527099003|261021121427099003|261021123027099003|261022075727099003|10067099003|4143699003; X-Microsoft-Antispam-Message-Info: kykQHqwIkBhJRdxRzuSYccVOUcJ/3eM3OSPzZo+ahVjAKQxU/jUXDN5udorJAKN3XzdcLLfisFzyeFQZ5Hy5+v/AUgbcmkqY/5WKeArx2yMjzk9CxXWrehDXB35vIUGMUfysFArbVBMAaz07nTrTiFSvXLQUFcOJzf14WpAWm+wdG7kJOPUOqoEDSeEJ70xaNdyb/5vuvQm9zyd7FQS+grsy1UMAqoWzrCbH32GvRxDv0UpJmD0fQzUTxwqJWJOfEkEKEzDhPRdlyrf3+jcXbV1c82MY1ezVROaua7M8lKexZeJ+4J3xUlsinh75w7RAIAwlhR2fLEh6CX/LMk2y1y5xaJDv2Zr50GXWXQTI+re1nBOL/fWq2tXmqffQYxcP7aA4e8Z4maSyPT93uLJ8M75kRFYsGIyXLFJVoJO8YFxq8OdSYvojmziBleU2RT2YEZV6dJxdML86P20e7wblm1xmbP72nHNeBiwwxbAQ2vkkLnVnsIKi+Zp1rqNs1yezuuFa7NzFNYHDiQ48GOxviUE8iOnPKsS5j3TnSoj1/QsS3CaqK98HYPi1kORFAUlodlfwXCaMdtUkob6fIK4hFug/AsheJGMtvIE5Tbf5V56zgVGtiRCHkFS4/Qy+/1Gr/CTpJzqAZunfWm7R8RmEUraTpvr04nPx1zccnbysmY44AezCqgUZqh77X/RotGLG/PW3G8rRXpQWAZPex71pMQ== 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)(36860700016)(23010399003)(82310400026)(376014)(14060799003)(1800799024)(18002099003)(22082099003)(6133799003)(3023799007)(11063799006)(56012099006)(261102123227099003)(261009223027099003)(261026121527099003)(261021121427099003)(261021123027099003)(261022075727099003)(10067099003)(4143699003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: g9qF9mQiA/zyaCkeW4WXxAnwzk7GjTGPnNCJYLrJ53htIOL/5yguvGPJeJQd56MJxlAz79+8xJdrfWH8o2bbUPFkxmR5fiehe9BMQF81OUCpWzbvybeKKiRk0u2dP200UQBGUsKITts+lBAkdMaIdax4jh47J47h52uLEYMB5LiwceuRLlXm200KKQBiCK2teWrCZdIdk1vrwJq8PjO2UYy8aFtrgyaiX1gdf2lSqjXM2F198cqHdXhmlOyH+PRlL2O+ScllKCqR4d364mHdORcnYyQ0z/v0fr7wQ8tNrnZ1cStk2ynURAvA7yAC/Zr+hHTboDjOcg32GI2HSzO29DZiYe6PgePJ/IvvlrS8+u7ngs7rxeX4tnHINPc3YF8lf/r5JQIMuJ+E+XRp4AOfT2lRhNiFJrCJWRqMeiWW7U98D0oatFTSQgRLHIpPIiqq X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2026 10:42:30.5530 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd1bd8e1-6e3e-4ace-472c-08df3fe07cb5 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: MAD0EPF000008B0.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR08MB10046 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 05/11/2026 21:04, Tom Tromey wrote: >>>>>> Matthieu Longo writes: > >> Refactor read_mapping and smaps parsing to operate on gdb::array_view >> instead of relying on NUL-terminated strings and strtok_r to split mapping >> headers. > >> Track the amount of data returned by target_fileio_read_stralloc and use >> extract_next_field to iterate over mapping lines. > >> Update read_mapping to parse fields using bounded iterators and diagnose >> malformed addresses, separators, offsets, and inode values. > > Thanks. I had a couple questions about this. > >> static mapping >> -read_mapping (const char *line) >> +read_mapping (gdb::array_view line) >> { >> struct mapping mapping; >> - const char *p = line; > >> - mapping.addr = strtoulst (p, &p, 16); >> - if (*p == '-') >> - p++; >> - mapping.endaddr = strtoulst (p, &p, 16); >> + decltype(line)::const_iterator it = line.begin (); >> + decltype(line)::const_iterator it_next; > > Not your problem but if/when gdb::span lands, this will be an issue, > because std::span doesn't have const iterators. > > But, this function could probably take an array_view. > > I do wonder why array_view and not string_view. > See the before last line of the function: /* Ensure that the line ends with '0'. */ *line.end () = '\0'; This is a pity. Some code here and there has some assumption that the object file name has null-byte terminator. For instance, here: current_uiout->field_string ("objfile", m.filename, file_name_style.style ()); One solution can consist in adding a new method field_string_view to ui_out. I gave a quick shot at it, and I think that, if you want to go this way, I will have to publish an additional patch adding the method before this patch. See below the draft to give you a rough idea. Please note that my approach duplicates a lot of code. I think that adding a size parameter to the existing do_field_string would do better than adding a do_field_string_view. Do you see any reason not to do this ? diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 0c339d0e819..8af3899f251 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -187,6 +187,58 @@ cli_ui_out::do_field_string (int fldno, int width, ui_align align, field_separator (); } +void +cli_ui_out::do_field_string_view (int fldno, int width, ui_align align, + const char *fldname, const char *s, + size_t n, const ui_file_style &style) +{ + int before = 0; + int after = 0; + + if (m_suppress_output) + return; + + if ((align != ui_noalign) && s) + { + before = width - n; + if (before <= 0) + before = 0; + else + { + if (align == ui_right) + after = 0; + else if (align == ui_left) + { + after = before; + before = 0; + } + else + /* ui_center */ + { + after = before / 2; + before -= after; + } + } + } + + if (before) + spaces (before); + + if (s) + { + ui_file *stream = m_streams.back (); + stream->emit_style_escape (style); + stream->write (s, n); + stream->emit_style_escape (ui_file_style ()); + } + + if (after) + spaces (after); + + if (align != ui_noalign) + field_separator (); +} + void cli_ui_out::do_spaces (int numspaces) { diff --git a/gdb/cli-out.h b/gdb/cli-out.h index 4c7ae6e656e..2baa26de7b5 100644 --- a/gdb/cli-out.h +++ b/gdb/cli-out.h @@ -65,6 +65,10 @@ class cli_ui_out : public ui_out const char *fldname, const char *string, const ui_file_style &style) override; + virtual void do_field_string_view (int fldno, int width, ui_align align, + const char *fldname, const char *s, + size_t n, const ui_file_style &style) + override; virtual void do_spaces (int numspaces) override; virtual void do_text (const char *string) override; virtual void do_message (ui_file_style ¤t_style, diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 50583797604..bda5992f443 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -502,21 +502,18 @@ struct mapping ULONGEST offset; std::string_view device; ULONGEST inode; - - /* This field is guaranteed to be NULL-terminated, hence it is not a - std::string_view. */ - const char *filename; + std::string_view filename; }; /* Service function for corefiles and info proc. */ static mapping -read_mapping (gdb::array_view line) +read_mapping (std::string_view line) { struct mapping mapping; - decltype(line)::const_iterator it = line.begin (); - decltype(line)::const_iterator it_next; + decltype(line)::iterator it = line.begin (); + decltype(line)::iterator it_next; mapping.addr = strtoulst (it, &it_next, 16); if (it == it_next) @@ -534,9 +531,9 @@ read_mapping (gdb::array_view line) it = it_next; /* Skip spaces. */ - it = std::find_if_not (it, line.cend (), c_isspace); + it = std::find_if_not (it, line.end (), c_isspace); - it_next = std::find_if (it, line.cend (), c_isspace); + it_next = std::find_if (it, line.end (), c_isspace); mapping.permissions = std::string (it, it_next); it = it_next; @@ -547,9 +544,9 @@ read_mapping (gdb::array_view line) it = it_next; /* Skip spaces. */ - it = std::find_if_not (it, line.cend (), c_isspace); + it = std::find_if_not (it, line.end (), c_isspace); - it_next = std::find_if (it, line.cend (), c_isspace); + it_next = std::find_if (it, line.end (), c_isspace); mapping.device = std::string (it, it_next); it = it_next; @@ -560,11 +557,9 @@ read_mapping (gdb::array_view line) it = it_next; /* Skip spaces. */ - it = std::find_if_not (it, line.cend (), c_isspace); + it = std::find_if_not (it, line.end (), c_isspace); - mapping.filename = it; - /* Ensure that the line ends with '0'. */ - *line.end () = '\0'; + mapping.filename = std::string_view (it, std::distance(it, line.end ())); return mapping; } @@ -656,7 +651,7 @@ struct mapping_regexes Then FILENAME will be "/path/to/file". */ static int -mapping_is_anonymous_p (const char *filename) +mapping_is_anonymous_p (const std::string_view &filename) { static std::optional regexes; static int init_regex_p = 0; @@ -675,9 +670,9 @@ mapping_is_anonymous_p (const char *filename) if (init_regex_p == -1) { - const char deleted[] = " (deleted)"; - size_t del_len = sizeof (deleted) - 1; - size_t filename_len = strlen (filename); + std::string deleted = " (deleted)"; + size_t del_len = deleted.size (); + size_t filename_len = filename.size (); /* There was an error while compiling the regex'es above. In order to try to give some reliable information to the caller, @@ -685,13 +680,14 @@ mapping_is_anonymous_p (const char *filename) If we managed to find it, then we assume the mapping is anonymous. */ return (filename_len >= del_len - && streq (filename + filename_len - del_len, deleted)); + && filename.substr (filename_len - del_len) == deleted); } - if (*filename == '\0' - || regexes->dev_zero.exec (filename, 0, NULL, 0) == 0 - || regexes->shmem_file.exec (filename, 0, NULL, 0) == 0 - || regexes->file_deleted.exec (filename, 0, NULL, 0) == 0) + const std::string filename_nbs (filename); + if (!filename_nbs.empty () + || regexes->dev_zero.exec (filename_nbs.c_str (), 0, NULL, 0) == 0 + || regexes->shmem_file.exec (filename_nbs.c_str (), 0, NULL, 0) == 0 + || regexes->file_deleted.exec (filename_nbs.c_str (), 0, NULL, 0) == 0) return 1; return 0; @@ -1034,7 +1030,8 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args, auto [line, next_line_begin] = extract_next_field (content, it, '\n'); it = next_line_begin; - mapping m = read_mapping (line); + mapping m + = read_mapping (std::string_view (line.data (), line.size ())); ui_out_emit_tuple tuple_emitter (current_uiout); current_uiout->field_core_addr ("start", gdbarch, m.addr); @@ -1047,8 +1044,8 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args, current_uiout->field_string ("offset", paddress (gdbarch, m.offset)); current_uiout->field_string ("perms", m.permissions); - current_uiout->field_string ("objfile", m.filename, - file_name_style.style ()); + current_uiout->field_string_view ("objfile", m.filename, + file_name_style.style ()); current_uiout->text ("\n"); } } @@ -1599,7 +1596,9 @@ parse_smaps_data (gdb::array_view data, it = next_line_begin; /* Parse a region's header. */ - mapping m = read_mapping (region_header_line); + mapping m + = read_mapping (std::string_view(region_header_line.data (), + region_header_line.size ())); struct smaps_vmflags v; memset (&v, 0, sizeof (v)); diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index cba6acbbab5..66ffc94d2a6 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -141,6 +141,22 @@ mi_ui_out::do_field_string (int fldno, int width, ui_align align, gdb_printf (stream, "\""); } +void +mi_ui_out::do_field_string_view (int fldno, int width, ui_align align, + const char *fldname, const char *s, + size_t n, const ui_file_style &style) +{ + ui_file *stream = m_streams.back (); + field_separator (); + + if (fldname) + gdb_printf (stream, "%s=", fldname); + gdb_printf (stream, "\""); + if (s) + stream->putstrn (s, n, '"'); + gdb_printf (stream, "\""); +} + void mi_ui_out::do_spaces (int numspaces) { diff --git a/gdb/mi/mi-out.h b/gdb/mi/mi-out.h index ce1e5dadc4c..53fc6a2ee94 100644 --- a/gdb/mi/mi-out.h +++ b/gdb/mi/mi-out.h @@ -72,6 +72,10 @@ class mi_ui_out : public ui_out virtual void do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string, const ui_file_style &style) override; + virtual void do_field_string_view (int fldno, int width, ui_align align, + const char *fldname, const char *s, + size_t n, const ui_file_style &style) + override; virtual void do_spaces (int numspaces) override; virtual void do_text (const char *string) override; virtual void do_message (ui_file_style ¤t_style, diff --git a/gdb/python/py-mi.c b/gdb/python/py-mi.c index 7e8105fdade..739f60ecaf2 100644 --- a/gdb/python/py-mi.c +++ b/gdb/python/py-mi.c @@ -119,6 +119,18 @@ py_ui_out::do_field_string (int fldno, int width, ui_align align, add_field (fldname, val); } +void +py_ui_out::do_field_string_view (int fldno, int width, ui_align align, + const char *fldname, const char *s, size_t n, + const ui_file_style &style) +{ + if (m_error.has_value ()) + return; + + gdbpy_ref<> val = host_string_to_python_string (std::string_view (s, n)); + add_field (fldname, val); +} + /* Implementation of the gdb.execute_mi command. */ PyObject * diff --git a/gdb/python/py-uiout.h b/gdb/python/py-uiout.h index 5a1ee9c09b3..3bccb7a03c4 100644 --- a/gdb/python/py-uiout.h +++ b/gdb/python/py-uiout.h @@ -99,6 +99,10 @@ class py_ui_out : public ui_out const char *fldname, const char *string, const ui_file_style &style) override; + void do_field_string_view (int fldno, int width, ui_align align, + const char *fldname, const char *s, + size_t n, const ui_file_style &style) override; + void do_spaces (int numspaces) override { } diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 45bb1d821a1..396587134e7 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -522,6 +522,20 @@ ui_out::field_string (const char *fldname, const char *string, do_field_string (fldno, width, align, fldname, string, style); } +void +ui_out::field_string_view (const char *fldname, std::string_view s, + const ui_file_style &style) +{ + int fldno; + int width; + ui_align align; + + verify_field (&fldno, &width, &align); + + do_field_string_view (fldno, width, align, fldname, + s.data (), s.size (), style); +} + /* VARARGS */ void ui_out::field_fmt (const char *fldname, const char *format, ...) diff --git a/gdb/ui-out.h b/gdb/ui-out.h index 26d4a6b7d0e..4ad859a410c 100644 --- a/gdb/ui-out.h +++ b/gdb/ui-out.h @@ -197,6 +197,10 @@ class ui_out { field_string (fldname, string.c_str (), style); } + + void field_string_view (const char *fldname, std::string_view string, + const ui_file_style &style = ui_file_style ()); + void field_stream (const char *fldname, string_file &stream, const ui_file_style &style = ui_file_style ()); void field_skip (const char *fldname); @@ -360,6 +364,9 @@ class ui_out virtual void do_field_string (int fldno, int width, ui_align align, const char *fldname, const char *string, const ui_file_style &style) = 0; + virtual void do_field_string_view (int fldno, int width, ui_align align, + const char *fldname, const char *s, + size_t n, const ui_file_style &style) = 0; virtual void do_spaces (int numspaces) = 0; virtual void do_text (const char *string) = 0; >> + LONGEST len = 0; >> gdb::unique_xmalloc_ptr map >> - = target_fileio_read_stralloc (NULL, filename); >> + = target_fileio_read_stralloc (NULL, filename, &len); > > I think target_fileio_read_stralloc guarantees \0-termination. > > So with string_view you wouldn't even need the length stuff I think? > > But maybe there's some later reason. > The next patch introducing target_file_reader tries to mutualize the code to read text and binary data files. Hence my choice of using gdb::array_view. >> struct smaps_vmflags v; >> + memset (&v, 0, sizeof (v)); > > Would `smaps_vmflags v {}' work? > >> + map.mapping_anon_p = mapping_anon_p? true : false; >> + map.mapping_file_p = mapping_file_p? true : false; > > Missing spaces before the "?". Oups, this was old code. I just indented it. Fixed in the next revision. > > Tom Matthieu