From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2081.outbound.protection.outlook.com [40.107.236.81]) by sourceware.org (Postfix) with ESMTPS id 791E6385802D for ; Tue, 23 Feb 2021 15:35:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 791E6385802D ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fVR0XEKGcsznXxAaP6kVZ0PZnhGJK+zUQZbjVvpFT6OEUjoJAw4Osh+Llvb5lrBfOy/eBmnlJZv6auH90PQz2umXVNQ3QDMYWo+t43A0v3M4HpLs6miaxEPozGKmnSPItHOnbzQn9fdYJclrfPsQJvrjM+eDVLdS89zJxcoP4pWuY6eJ8pd9uKrnpSC/VcUX3ltTnANaInBFrLimS+/iu5k76CjeCUDGv9UPZJHH4YJ2Zm1TDr6qCAdHBWwe+yScAfH4KPSWfV+QPgP2D2d+l+FIMlRKFHba24R06LpUgC/lKycop8p9CAlHPUoPYjnwhxeHmCO+zPQMwe/OSJHE0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tdCLchzAFVcyJUkvqpgFXOKfzISYeCoj62e4/WHYbeE=; b=JCnaWk4M4/GzUbfzz9qcPV5hofm4dV2FyOixXfXVtEfqSu4dCRJkwvlnXTAV5fuD7Tx/FnQsslsZ0fKncRKYMC9OpsqfyRsnw5ZQhN2eXSG9iUjZ+pUx3JA2C5WPghSpfkgrchkZc/gTblrU7Svi80z5q9h4ZjMZ8cA72kPZcvEDP3OyR98pGprD4xiazVtLifPZtEFKrTNaJijFuRniwrlSdEBCo7qu5hfu0pVME6MqxYAjlwSpoSQIQgFAjmlwKp4bSWm9dCZ+tUiyQpygSw/7SlbOHIj17ePaz7b9dmi8VdiXBZWBncttSk+mNX7ywXCIXQ3jHR/rfCseIc01Kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none Received: from DM6PR12MB2762.namprd12.prod.outlook.com (2603:10b6:5:45::15) by DM5PR12MB2344.namprd12.prod.outlook.com (2603:10b6:4:b2::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.33; Tue, 23 Feb 2021 15:35:08 +0000 Received: from DM6PR12MB2762.namprd12.prod.outlook.com ([fe80::31d8:f503:f7b2:f44]) by DM6PR12MB2762.namprd12.prod.outlook.com ([fe80::31d8:f503:f7b2:f44%3]) with mapi id 15.20.3868.033; Tue, 23 Feb 2021 15:35:08 +0000 Subject: Re: [PATCH 17/30] Add new memory access interface to expr.c To: Tom Tromey , Zoran Zaric via Gdb-patches References: <20201207190031.13341-1-Zoran.Zaric@amd.com> <20201207190031.13341-18-Zoran.Zaric@amd.com> <871rdpc9f5.fsf@tromey.com> From: Zoran Zaric Message-ID: Date: Tue, 23 Feb 2021 15:35:03 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 In-Reply-To: <871rdpc9f5.fsf@tromey.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [2a00:23c7:5a85:6801:3c68:1988:3c97:9289] X-ClientProxiedBy: LNXP265CA0003.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::15) To DM6PR12MB2762.namprd12.prod.outlook.com (2603:10b6:5:45::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2a00:23c7:5a85:6801:3c68:1988:3c97:9289] (2a00:23c7:5a85:6801:3c68:1988:3c97:9289) by LNXP265CA0003.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.32 via Frontend Transport; Tue, 23 Feb 2021 15:35:07 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2b2cbb46-5b62-4412-f97a-08d8d810997f X-MS-TrafficTypeDiagnostic: DM5PR12MB2344: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UwA+qg+T05DIgkBsMhOxrXUJmXE9+5HTcs6wNuE6ksB6UlsRHo1wDw7fK9Ibq7YBDooR3Odef0afLpXfw0Uo4Y2bslgqcZfnnuYU15LJUvIYI7NMGBhtuWigMNYl3bYgKBYS8bysgGby6Tyvh8Mv09OBWrkg0xv9O8n/kjHLKXGfDGUf0f+tD5/6OdZJQ+g0Y9pYdWpos8aSiZ+WWgK7wOc9qYdCsm1RSJB4yoRLiRsDPFEDV/nrwAzLg4lblXzgDd68N2acoQ20MBlLFHSoKNFOnE+sNIfhcTtexEQ4+a6QGqpeHbDbgNkGUNUREM47XZucWJTpmuCdKpgY8SMRXhsbNdzvcmg9lw9C/rJYtA34iZGEkXTZ4aY964mxR9Bg2XivWdO6AYKj+0nFTz4KSvs05J9ZAsja+4nKV+d6gTqn/ZZEObIGGLxfOhKaUIaXqD11y12uMh97rcA+oR+/LMP6cX8MGGtjWojfJ6RxkPRw199OQK5Wx4rJz+YEqGfovMeMYwGFpXcNVdpFw8M86QqdRE/oNLkPZpsQcvgAzR9dk0h82NK/9MdlndbvFECbX6lg14rj2dYMGaLhndXb0Ihux/h84edmwgwesw5/Occ= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB2762.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(346002)(39860400002)(396003)(366004)(376002)(2906002)(31686004)(478600001)(186003)(36756003)(31696002)(5660300002)(66556008)(66476007)(16526019)(6666004)(83380400001)(66946007)(316002)(8936002)(8676002)(52116002)(110136005)(2616005)(86362001)(6486002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?SXlmanA2d2xJRW5ITUx5K2cvYWh0cWVMMFdWY3JvczlxUDI0Qmh5M3l6TndI?= =?utf-8?B?RFAyQnYxWjFpUDQ0dFJKeS84ejM1R1M3bFl5bjdQa1VWWVhzNFB4dWdFS0VG?= =?utf-8?B?cnFJWnNDMmdtMVFlMkgzdVBZcllSTG0yN1RHeHlqRVJNSldTbVBaV1JBNGVy?= =?utf-8?B?VjhzNTFzclZRZWQzOXRlcFR3OS83OXViWk5FKzJ3NnpCZGJ5UGp4Zm8zVURu?= =?utf-8?B?UVFvU25NMWtUZDd3ZVpUWmhQcnpiaWMxM1JjTUFsUzk4QWlMOXltcThSMjVV?= =?utf-8?B?bGppL09wWmM3NEFDTzBEa1BTaGhnZFpodW41L2o3YUVLbkFISzZqWHY1b2h6?= =?utf-8?B?N2VORkpKYzhIanBPM3JxajFDWUI2b3Y0NjZReGc4ZHdHS0l1d0F6aXJOM2gr?= =?utf-8?B?bG5GREV0WnQ1ZElkUVUyQmNFT215MFlGTnRDb240NDZ1czhLcnp2TERjTS9t?= =?utf-8?B?Y2oxNGJZMHVxUlkzeFRab290c3VybWxZNlU2cENQcTgrR05KSkh1N3Y5RGlY?= =?utf-8?B?cjhEbHBRUDAzcjN6K2pUUy8rajN0eWVsWkFuS0cyUFlzWDJucytZT1V4czB6?= =?utf-8?B?K0pJOVBhTW16V2FnN3pZU0JPVUdNdjJ5S2V1d1h2bHRpVTZ5ZzRxeGp6K3JO?= =?utf-8?B?MVZvZkhsY1R0bFlhWEFSYWxLUTlvRXBac0xBbVVOT1VrM2ZPZEJlcVR4MExC?= =?utf-8?B?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GZPSkxMN1hEOW1VMlZxRkVoS2I2MjVrL3JiaWhOKzJGazJVOEVobmR2OHlv?= =?utf-8?B?elhXTVNVOEFWbXo0YndBVngvOHI2UkljSnY2d3pXdCtuTjJrSytkeTdUaUZ3?= =?utf-8?B?amJXSG92MS84Y3ExWGNNS0hydktvcldOdE1nWUpZeWZHMWdISGthTkdGSFcv?= =?utf-8?B?L0VKdDRHeVljcW9tYS9LN1JsNC9YU2hyRzJHWHcvTXZrbEc2eDczWCtycHNK?= =?utf-8?Q?Zkxw/nU1fFhzB?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b2cbb46-5b62-4412-f97a-08d8d810997f X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB2762.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2021 15:35:08.4509 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4OcSmc1CAAbZdvnfBAM0MdaY6mNGFw84921NwpE4frosJyahtKZ+bypJSZIu5CCPrawbQrox8IfptP1ld3yQaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB2344 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Tue, 23 Feb 2021 15:35:11 -0000 > > 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? Unfortunately not, The target_read_memory doesn't have a way to target the TARGET_OBJECT_STACK for example and if used will break some of the existing gdb tests that involve caching. I am open to suggestions but I couldn't find an appropriate replacement to the previously used read_value_memory which is tied to the struct value infrastructure. > > 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 > This is something that still puzzles me to be honest. I was trying not to break the existing algorithm because I didn't have the time to get into the details behind the write notify logic. I did have a version where I didn't do any notification in the evaluator and I didn't see any of the test failing, but that doesn't really prove anything. Zoran