From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 6FDE6386F83F for ; Thu, 28 May 2020 16:52:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6FDE6386F83F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [10.0.0.11] (173-246-6-90.qc.cable.ebox.net [173.246.6.90]) (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 E5AF31E072; Thu, 28 May 2020 12:52:54 -0400 (EDT) Subject: Re: [PATCH v2 28/42] Remove dwarf2_per_cu_data::objfile () To: Christian Biesinger Cc: Tom de Vries , Simon Marchi , gdb-patches References: <20200512210913.5593-1-simon.marchi@efficios.com> <20200512211250.6230-29-simon.marchi@efficios.com> <04473d43-9719-436b-648a-bdc8e5f55751@suse.de> <354bbf9d-6bca-deaa-c64b-714c8d6b477d@suse.de> <2cdb90c2-ad74-310d-75db-65a3d694049f@suse.de> From: Simon Marchi Message-ID: <1d6d971e-6699-2510-14da-8c5b79c1172d@simark.ca> Date: Thu, 28 May 2020 12:52:54 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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: Thu, 28 May 2020 16:52:56 -0000 On 2020-05-28 12:24 p.m., Christian Biesinger wrote: > On Thu, May 28, 2020 at 10:33 AM Simon Marchi wrote: >> >> On 2020-05-28 9:05 a.m., Tom de Vries wrote: >>> Hi, >>> >>> thanks for looking into this. >>> >>> I tried out the patch, and it fixes all regressions for me. >>> >>> Thanks, >>> - Tom >> >> Thanks, I pushed it with the following commit message. > > Maybe add a comment describing this case, so that future developers > looking at the code know why the two objfiles can be different? I am the first one to ask others to comment their code and not assume that everybody is a domain expert, so yes :) I would add this: >From 54c8c8f45b2196538a6c87c4cc7d498a8a5ade36 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 28 May 2020 12:38:03 -0400 Subject: [PATCH] gdb: add comment in dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value Add a comment to clarify why we temporarily override some of the context's fields, and especially the per_objfile field. A longer explanation can be found in this previous commit 44486dcf19b ("gdb: use caller objfile in dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value") gdb/ChangeLog: * dwarf2/loc.c (class dwarf_evaluate_loc_desc) : Add comment. Change-Id: I60c6e1062799f729b30a9db78bcb6448783324b4 --- gdb/dwarf2/loc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 1aab1a4f51bc..400bb4d16fc7 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -731,6 +731,12 @@ class dwarf_evaluate_loc_desc : public dwarf_expr_context throw_error (NO_ENTRY_VALUE_ERROR, _("Cannot resolve DW_AT_call_data_value")); + /* We are about to evaluate an expression in the context of the caller + of the current frame. This evaluation context may be different from + the current (callee's) context), so temporarily set the caller's context. + + It is possible for the caller to be from a different objfile from the + callee if the call is made through a function pointer. */ scoped_restore save_frame = make_scoped_restore (&this->frame, caller_frame); scoped_restore save_per_cu = make_scoped_restore (&this->per_cu, -- 2.26.2