From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cCuaEV3mImDmZwAAWB0awg (envelope-from ) for ; Tue, 09 Feb 2021 14:45:33 -0500 Received: by simark.ca (Postfix, from userid 112) id 39BAB1EF4F; Tue, 9 Feb 2021 14:45:33 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=DKIM_SIGNED,MAILING_LIST_MULTI, RCVD_IN_BL_SPAMCOP_NET,T_DKIM_INVALID,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D9C921E590 for ; Tue, 9 Feb 2021 14:45:32 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 854603861875; Tue, 9 Feb 2021 19:45:32 +0000 (GMT) Received: from gateway34.websitewelcome.com (gateway34.websitewelcome.com [192.185.150.107]) by sourceware.org (Postfix) with ESMTPS id DFC033861875 for ; Tue, 9 Feb 2021 19:45:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DFC033861875 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway34.websitewelcome.com (Postfix) with ESMTP id 455FC2909B4 for ; Tue, 9 Feb 2021 13:45:20 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 9Ywql9nJTiQiZ9YwqlXKEl; Tue, 09 Feb 2021 13:45:20 -0600 X-Authority-Reason: nr=8 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:In-Reply-To:Date: References: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-Subscribe:List-Post:List-Owner:List-Archive; bh=3t6C/zkADxE2DMzJkk8LcWo4cGIgh875mUOHPbOuRNo=; b=jQUWzv5w6xX7zm6GcZiHREx9bt g1JKXbHWMoeum9Aepl5lCroJDKr4EeVmFHUeLFHyp2hJl2YZEJihPqpeaHyyDug3ZnvwSxBlRa0m9 Q2cc6oLRQ1VFOiX+NCyItRAOM; Received: from 97-122-91-54.hlrn.qwest.net ([97.122.91.54]:42728 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1l9Ywp-001Dmt-EI; Tue, 09 Feb 2021 12:45:19 -0700 From: Tom Tromey To: Zoran Zaric via Gdb-patches Subject: Re: [PATCH 17/30] Add new memory access interface to expr.c References: <20201207190031.13341-1-Zoran.Zaric@amd.com> <20201207190031.13341-18-Zoran.Zaric@amd.com> X-Attribution: Tom Date: Tue, 09 Feb 2021 12:45:18 -0700 In-Reply-To: <20201207190031.13341-18-Zoran.Zaric@amd.com> (Zoran Zaric via Gdb-patches's message of "Mon, 7 Dec 2020 19:00:18 +0000") Message-ID: <871rdpc9f5.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) 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.91.54 X-Source-L: No X-Exim-ID: 1l9Ywp-001Dmt-EI X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-91-54.hlrn.qwest.net (murgatroyd) [97.122.91.54]:42728 X-Source-Auth: tom+tromey.com X-Email-Count: 5 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" >>>>> "Zoran" == Zoran Zaric via Gdb-patches writes: Zoran> DWARF expression evaluator is currently using a few different Zoran> interfaces for memory access: write_memory_with_notification, Zoran> read_value_memory, read_memory. Zoran> They all seem incosistent, while some of them even need a struct Zoran> value typed argument to be present. Zoran> This patch is simplifying that interface by replacing it with two new Zoran> low level functions: read_from_memory and write_to_memory. Zoran> The advantage of this new interface is that it behaves in the same way Zoran> as the register access interface from the previous patch. Both of these Zoran> have the same error returning policy, which will be usefull for the Zoran> following patches. Is there any way to avoid adding more functions like this? Like could target_read_memory be used instead? Zoran> +static void Zoran> +xfer_from_memory (CORE_ADDR address, gdb_byte *readbuf, This is a bit misnamed, since "from" implies reading, but really this does both reading and writing. Zoran> +static void Zoran> +write_to_memory (CORE_ADDR address, const gdb_byte *buffer, Zoran> + size_t length, bool stack, int *unavailable) Zoran> +{ Zoran> + xfer_from_memory (address, nullptr, buffer, length, stack, unavailable); Zoran> + Zoran> + gdb::observers::memory_changed.notify (current_inferior (), address, Zoran> + length, buffer); This notifies the observer even if the write fails. I do wonder, though, why some writes notify the observer and some do not... looking e.g., at corefile.c:write_memory_unsigned_integer. Tom