From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 5lgoHYjv7GoK6iIAWB0awg (envelope-from ) for ; Thu, 05 Nov 2026 16:05:12 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=kah/3s/3; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 641221E043; Thu, 05 Nov 2026 16:05:12 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no 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 B5BE71E043 for ; Thu, 05 Nov 2026 16:05:11 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3E2844BA2E27 for ; Thu, 5 Nov 2026 21:05:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E2844BA2E27 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=kah/3s/3 Received: from omta38.uswest2.a.cloudfilter.net (omta38.uswest2.a.cloudfilter.net [35.89.44.37]) by sourceware.org (Postfix) with ESMTPS id 351D44BA2E28 for ; Thu, 5 Nov 2026 21:04:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 351D44BA2E28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 351D44BA2E28 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793912686; cv=none; b=d2aeFGYLjyoR5Y+uhlcvrtnYli3px2C+rBrgLOagDHTKeyv6G/c9RqtaoJQ9PTs8J0FBfP4iCWIi9mti5WsEtyfefMYC1jXQ1kV9ebcfDuIBPgaeNgAnS7nzW/D7HPxWpHTnwIDIudxYNxvY99tDtqdTwgPmISbg68s8DGr8f9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793912686; c=relaxed/simple; bh=BnpkImDyrxNkr+ThiHyzHcudrnORVwqAqge3FuWhWDg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=rdhNh+A/bfha9IzWJ26yE9ZGDk+5UUVQt5o//LlKnFe0Qq6tPnxp9yVsu2+hHsHnb1ncVEGAC78pjAuO20ztvE59YmB1ZQiUQ6Wxf43gcEKbkToeDbWizefU050Pdv9FAgYiD2DURFXPUnIIJqXC8NzqjIOV64r3S4vL14K0yPg= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=kah/3s/3 reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 351D44BA2E28 Received: from eig-obgw-5007b.ext.cloudfilter.net ([10.0.29.167]) by cmsmtp with ESMTPS id P1kpxdfCAVK9UP4dYxScyY; Thu, 05 Nov 2026 21:04:45 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id P4dSxWF6FxqjjP4dSxE58m; Thu, 05 Nov 2026 21:04:38 +0000 X-Authority-Analysis: v=2.4 cv=bZxrUPPB c=1 sm=1 tr=0 ts=6aecef6c a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=zJRp6_cAMcgA:10 a=ItBw4LHWJt0A:10 a=7CQSdrXTAAAA:8 a=TxIHRuaxmIwVNPK5akoA:9 a=a-qgeE7W1pNrGK8U0ZQC:22 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KBAuy+8aNLxq7xfs6L5rS9NL+r20S+FNFNv9Y4kYFnI=; b=kah/3s/3uZtqxPEBj56uAfnjGc YMLaOXh/F8LAZ9Bi8rI8aWDV0lsg+s9HfSssE6LQqIwNiXRZLXFXdMI7Ole4iOJE38gWUkGetTXFe 5MyIIcRaPh8iIKtWm1HkuTLd7; Received: from 97-122-110-129.hlrn.qwest.net ([97.122.110.129]:37270 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xP4dR-00000000IoV-3DJK; Thu, 05 Nov 2026 14:04:37 -0700 From: Tom Tromey To: Matthieu Longo Cc: , Andrew Burgess , Tom Tromey Subject: Re: [PATCH v3 5/8] gdb/linux: refactor /proc mapping parsing to use array_view In-Reply-To: <20260922135050.236941-6-matthieu.longo@arm.com> (Matthieu Longo's message of "Tue, 22 Sep 2026 14:50:47 +0100") References: <20260922135050.236941-1-matthieu.longo@arm.com> <20260922135050.236941-6-matthieu.longo@arm.com> X-Attribution: Tom Date: Thu, 05 Nov 2026 14:04:36 -0700 Message-ID: <87wlqrvvkr.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.110.129 X-Source-L: No X-Exim-ID: 1xP4dR-00000000IoV-3DJK X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-129.hlrn.qwest.net (bapiya) [97.122.110.129]:37270 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfPzFXNq2CteJTO5qqluMncbn941v5hBKyloM3cSZ4N1yYPqLpRqvCIx4QVarghD+cEX8auXKx3Zrivxh4bv5IP/htNPYL9N0i3ZA5pCe1r/KpTw2ktOk bjF9a/PEZfK6SZ5xNu0ezM6tWXlIoNclVUsCuYz+0zWvLWNsQ8IA4cHGGLdvRCVDDIDTDOG+kUv0pZ9lZScop0geHChYCzlnMbc= 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 >>>>> 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. > + 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. > 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 "?". Tom