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 0A3143858D34 for ; Thu, 28 May 2020 01:44:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 0A3143858D34 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)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6766F1E793; Wed, 27 May 2020 21:44:35 -0400 (EDT) Subject: Re: [PATCH v2 23/42] Add dwarf2_per_objfile to dwarf_expr_context and dwarf2_frame_cache To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Simon Marchi References: <20200512210913.5593-1-simon.marchi@efficios.com> <20200512211250.6230-24-simon.marchi@efficios.com> <87a71z1y18.fsf@tromey.com> <66566187-024e-9a5e-9628-2f8e0cea7279@simark.ca> From: Simon Marchi Message-ID: <87fe5955-3645-6f3a-6aeb-29df3d7ac585@simark.ca> Date: Wed, 27 May 2020 21:44:34 -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: <66566187-024e-9a5e-9628-2f8e0cea7279@simark.ca> Content-Type: text/plain; charset=utf-8 Content-Language: fr Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, 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 01:44:37 -0000 On 2020-05-25 3:50 p.m., Simon Marchi wrote: > On 2020-05-22 5:04 p.m., Tom Tromey wrote: >>>>>>> "Simon" == Simon Marchi via Gdb-patches writes: >> >> Simon> *Note*, there's one spot I'm particularly unsure about. In >> Simon> dwarf_evaluate_loc_desc::push_dwarf_reg_entry_value, we would save and >> Simon> overwrite the offset value in the context, along with a bunch of other >> Simon> state. This is because we might be about to evaluate something in a >> Simon> different CU that the current one. If the two CUs are in the same >> Simon> objfile, then the text_offset is the same, as it's a property of the >> Simon> objfile. However, if the two CUs are possibly in different objfiles, >> Simon> then it means the text_offsets are different. It would also mean we >> Simon> would need to save and restore the dwarf2_per_objfile in the context. >> Simon> Is that even possible? >> >> Unfortunately I don't know for sure. >> However, call_site_for_pc doesn't distinguish between objfiles. So, I >> suppose I would assume it is possible. >> >> Tom > > In practice, I'm not sure how that can happen. Can DWARF info in an objfile > refer to the DWARF info in another objfile? Can there be a subprogram described > in one and a call site of that subprogram described in another objfile? If we > are quite sure it can't happen, I would rather not include code for it, that's > just unnecessary complexity. > > A further patch (28/42) happens to tie call sites with an objfile, and adds a > gdb_assert here making sure that the call site's objfile is the same as the > callee's objfile. > > So I would propose to leave that gdb_assert there, if we are wrong then we'll > fix that function. So it turns out that it wasn't there for nothing! Call sites can refer to another objfile in some occasions. See the follow up in this thread: https://sourceware.org/pipermail/gdb-patches/2020-May/169077.html Simon