From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oasKCIu7iGDaFQAAWB0awg (envelope-from ) for ; Tue, 27 Apr 2021 21:34:03 -0400 Received: by simark.ca (Postfix, from userid 112) id 0CE071F11C; Tue, 27 Apr 2021 21:34:03 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham 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 02FD61E783 for ; Tue, 27 Apr 2021 21:34:02 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5104D3847803; Wed, 28 Apr 2021 01:34:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5104D3847803 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1619573641; bh=UaUf4WIk0O96jrKtvVQgJyJl60ijbDkfGpw0NfATLJ4=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=R+3CB5xAjvfXt0kYxIVK6YXFTxuynH4/AIaW/kfEcM2yUB4XDRgufUps08NgAlTwo 9RUhoJGQ87cgSSXPxe2qQVt2WmnflGCj+P9N2Nqz/vLojD9+3ZESvzm81t3bTkY6I0 1ACmujzVU2sutGS4/+HJnbfJoIwfKutveNrOjf8k= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id AF8883847803 for ; Wed, 28 Apr 2021 01:33:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AF8883847803 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 13S1XpFG009209 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Apr 2021 21:33:56 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 13S1XpFG009209 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 409391E783; Tue, 27 Apr 2021 21:33:51 -0400 (EDT) Subject: Re: [PATCH 12/43] Merge evaluate_for_locexpr_baton evaluator To: Zoran Zaric , gdb-patches@sourceware.org References: <20210301144620.103016-1-Zoran.Zaric@amd.com> <20210301144620.103016-13-Zoran.Zaric@amd.com> Message-ID: <084a8b95-2dae-659d-1873-e5f41e03e894@polymtl.ca> Date: Tue, 27 Apr 2021 21:33:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210301144620.103016-13-Zoran.Zaric@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Wed, 28 Apr 2021 01:33:51 +0000 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 2021-03-01 9:45 a.m., Zoran Zaric via Gdb-patches wrote: > From: Zoran Zaric > > The evaluate_for_locexpr_baton is the last derived class from the > dwarf_expr_context class. It's purpose is to support the passed in > buffer functionality. > > Although, it is not really necessary to merge this class with it's > base class, doing that simplifies new expression evaluator design. > > Considering that this functionality is going around the DWARF standard, > it is also reasonable to expect that with a new evaluator design and > extending the push object address functionality to accept any location > description, there will be no need to support passed in buffers. > > Alternatively, it would also makes sense to abstract the interaction > between the evaluator and a given resource in the near future. The > passed in buffer would then be a specialization of that abstraction. > > gdb/ChangeLog: > > * dwarf2/expr.c (dwarf_expr_context::read_mem): Merge with > evaluate_for_locexpr_baton implementation. > * dwarf2/loc.c (class evaluate_for_locexpr_baton): Remove > class. > (evaluate_for_locexpr_baton::read_mem): Move to > dwarf_expr_context. > (dwarf2_locexpr_baton_eval): Instantiate dwarf_expr_context > instead of evaluate_for_locexpr_baton class. > --- > gdb/dwarf2/expr.c | 19 +++++++++++++++++-- > gdb/dwarf2/expr.h | 13 +++---------- > gdb/dwarf2/loc.c | 45 ++------------------------------------------- > 3 files changed, 22 insertions(+), 55 deletions(-) > > diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c > index 1212be9c984..fe6d072ac8f 100644 > --- a/gdb/dwarf2/expr.c > +++ b/gdb/dwarf2/expr.c > @@ -252,6 +252,18 @@ void > dwarf_expr_context::read_mem (gdb_byte *buf, CORE_ADDR addr, > size_t length) > { > + if (length == 0) > + return; I'm really curious about when `length == 0` happens, but I see it was there previously, so this ok. But if you know the answer, I want to know. > @@ -239,6 +231,7 @@ struct dwarf_expr_context > void push_dwarf_reg_entry_value (enum call_site_parameter_kind kind, > union call_site_parameter_u kind_u, > int deref_size); > + void read_mem (gdb_byte *buf, CORE_ADDR addr, size_t length); You could keep the comment that was there previously over the read_mem method signature. Simon