From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cZ8NAYUgcGp8QQEAWB0awg (envelope-from ) for ; Mon, 03 Aug 2026 01:00:53 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ZJASZdDj; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 006381E09E; Mon, 03 Aug 2026 01:00:52 -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 967821E033 for ; Mon, 03 Aug 2026 01:00:52 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2E5134BB1C09 for ; Mon, 3 Aug 2026 05:00:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E5134BB1C09 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ZJASZdDj Received: from mail-vs1-xe30.google.com (mail-vs1-xe30.google.com [IPv6:2607:f8b0:4864:20::e30]) by sourceware.org (Postfix) with ESMTPS id D28D84BA798B for ; Mon, 3 Aug 2026 05:00:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D28D84BA798B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D28D84BA798B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::e30 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785733228; cv=none; b=xcOnJdyMybr6/aeW7K2gVY87g65u1KsGpKRRlKus7axzL8M5oPhXC1dj9JaJvi8GzjJF9IPPrYTP6pEPVvTxsdur/vT9zerX0Cm+R+iNV5zXUQwN+vblL02PmmPeiiPP3ipmetmv/I57puauLVZl57KCZKhgGox93lszoP/ixQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1785733228; c=relaxed/simple; bh=N/yWp7c+HMN1kLGVOrXMN5Osf52uFAsTFLGZtLfUqpY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nn0z/26csQ3ZldX8qNWTEQKDnybY45UfnhUG/JTt8xssAmItIuiLQOBZY058kkyaAdMHQ1nYEVq3jIo5Lc1y3ZDucsmhuO7fJdobRjyaYVlxpja8tylX5thDQ0lK9MB4pwHJJdExZXUsg8SrcPhs889XI3Tz0hdVUQiL1pzuB/s= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=ZJASZdDj DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D28D84BA798B Received: by mail-vs1-xe30.google.com with SMTP id ada2fe7eead31-745497ac8fcso987834137.0 for ; Sun, 02 Aug 2026 22:00:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1785733228; x=1786338028; darn=sourceware.org; h=content-type:mime-version:message-id:date:user-agent:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=uWVah56RRx2yB6BPusEh2W+bS1QlBf+F9jtHvR7RRoU=; b=ZJASZdDj0U/o6T/9e+v9AUBtdvpA4N2qlTp3htoZwbuN8ma/23nFz5KRzjOCaUZeIP 3edavR1KLdPhkqj6heF43nWeFDohFLubNidcCNJAktVZ1j+p9WD+SKsbBfGDJIHPV8ro ECPBPN8C1JFS7No5Q2tQf0zfEjMKw3G7kdlMJAuah7E0XshW5iuIDjKnsKQ5QH5BIuhJ v6M+CBpnnUDQVUhvCWSkCHTtIxxaoK5CH9pqroK/yRAzZUD/um/9Ov4wT8zu2KnhNJja 6j/yI6a2OaMUxhx4jdcyjETyl9yZ8x9zQ5aA9bgmEXoGI4/mAbxWlTgT0XqadOQ6lw90 zoDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785733228; x=1786338028; h=content-type:mime-version:message-id:date:user-agent:references :in-reply-to:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=uWVah56RRx2yB6BPusEh2W+bS1QlBf+F9jtHvR7RRoU=; b=pkcYwn4fa5Ztp+PPLSFbd407in2lFKbjrqf3SgPW2GHKh9YYahFWJB7/QwgL2E364/ nCSg5oNyW5DEhjZMs9/zsesDYGASiVXN6X6gyMajPV3NjQO6mGRhZOPBHY8l2vXykLY1 719f9mHQkZhVi2WQEdxsdKv3SZsH/wXbJAkMECsXtRwctbj84gvAFUCzgkOHy//d0GjL vtY/PZ1jYUfqOFw+sUjPpNBnT/+biOKjVA/ncjh8xnTON6pC57jJO2aDyKbUW1/AhdIY zpwncLl+qzOVuuJbdGiJTi6ANOm0Ig4woblABd2BKSldtVTP+WZJMrkEIpXrmfW7vgqx rXRA== X-Gm-Message-State: AOJu0YwXWBtmdoK+xP35lzlah/h/YMur2HzJL5z3b7sZ5E55Aj8xxuRH 5Axi0GuMkQDAHY8OXyaI7lGf0MOysLtUCLQKO7qJw0MSU7xvupQKoa4eJ/k5jUnlf9Q= X-Gm-Gg: AR+sD103GvaE95P7ZdGKJUcJ8ydzalVN+Qmf8ACZXidisu0DFMGj1yN+InfvchHp5Hd 8wR/smLLSMjx3z2jC6cZ7d0OZ7wbbZGIxtjGPztbpIO/H/RudMzXLVwNXNzGcMJyf5axp0/8ViN wqIr5KKnyjovZJ5H6hdmfrQASGnCIR5X6ROxN+XvHpj6y43lNPancgJEjsNRtOHYiyq0P+tWAxb cdOdG74IWuNHCoYw+RfKeyPjg3Yibj5MjKMdU9WuKmJNxbZ9wXqopbX9OTeKJRb1Gzfl5HZ4Jex cm/e/zgtwBqYKU0J9lf0jLdmZJpbK9+uZJmWKhnDqwyZq/UKsWJ3Plnr4T0KTusrhKLlgB5/65A HMbjut3OWTITsTuJgu5JWPvVUi2XKkpdPYNsi6B2A9iFj361hVsCq++IUtkpbtQCwFuaSxfg075 82gqR69jYQMd+lrliHRWQtHcb0s3USHxc37XXJCUs6bXtdOk1nH5bHUo1ptW6TskuKEs+BfKXYT kTfgQUNyFg= X-Received: by 2002:a05:6102:6893:b0:74a:b5e3:e96f with SMTP id ada2fe7eead31-75b22661bb0mr5208884137.7.1785733228150; Sun, 02 Aug 2026 22:00:28 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8083:f04c:42e3:5943:38f6]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-977e6aa598asm5606156241.13.2026.08.02.22.00.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2026 22:00:27 -0700 (PDT) From: Thiago Jung Bauermann To: Matthieu Longo Cc: , Luis Machado , Luis Machado , Simon Marchi , "Kevin Buettner" , Christina Schimpe , Christina Joos Subject: Re: [PATCH v1 3/6] gdb: introduce helper class file_reader_t In-Reply-To: <20260728151700.253720-4-matthieu.longo@arm.com> (Matthieu Longo's message of "Tue, 28 Jul 2026 16:16:57 +0100") References: <20260728151700.253720-1-matthieu.longo@arm.com> <20260728151700.253720-4-matthieu.longo@arm.com> User-Agent: mu4e 1.14.2; emacs 30.2 Date: Mon, 03 Aug 2026 05:00:25 +0000 Message-ID: <87ldan3ija.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain 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: > 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(-) Thank you for adding the comments I requested. You addressed Christina's remarks about keeping the current behaviour when reading empty files in the case of the task maps file and also in the case of the SPARC-specific adi/maps file. I don't know whether this is enough to resolve her concerns. Assuming it is: Reviewed-by: Thiago Jung Bauermann -- Thiago (he/him)