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 678DA385041D for ; Wed, 15 Jul 2020 02:04:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 678DA385041D 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 785F81E5F9; Tue, 14 Jul 2020 22:04:11 -0400 (EDT) Subject: Re: [PATCH V5] Fix issues with reading rnglists, especially from dwo files, for DWARF v5 To: Caroline Tice Cc: Eric Christopher , Tom Tromey , Caroline Tice via Gdb-patches References: <87lfl634rs.fsf@tromey.com> <87h7vsqk5h.fsf@tromey.com> <87h7v815n7.fsf@tromey.com> <5eab18a1-c7e9-1a77-7f65-944eea10aa85@simark.ca> <5ccfe911-6049-e8f3-4874-9991b2649512@simark.ca> From: Simon Marchi Message-ID: <4da310be-fa9f-9f21-8988-81af58ec73e3@simark.ca> Date: Tue, 14 Jul 2020 22:04:08 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.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=-3.6 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_NUMSUBJECT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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: Wed, 15 Jul 2020 02:04:13 -0000 On 2020-07-14 11:47 a.m., Caroline Tice wrote: > "This time for sure!" -- Bullwinkle Moose > > I think I've got all of your requested changes in now, and I've > attached the updated patch. About what you said at the very end of > your last message: > >> I thought that somehow, when reading a CU that uses a DWO, we were creating >> a "logical" DIE tree by combining the DW_TAG_skeleton_unit DIE and the >> children of the DWO's DW_TAG_compile_unit DIE, and while doing this, >> overwriting the DW_TAG_skeleton_unit's DIE to use the DW_TAG_compile_unit >> tag instead. Therefore making it appear to the rest of the DWARF reader >> as if it was a "standard" DW_TAG_compile_unit DIE. But no, maybe I just dreamed >> all of this, or I can't find it anymore. >> > > Actually your first thought was absolutely correct. This is done in > cutu_reader::cutu_reader. In my patched > read.c this is at line 7244: > > comp_unit_die = dwo_comp_unit_die; Ah ok, we just the full tree from the dwo. And in read_cutu_die_from_dwo we copy over some useful attributes from the skeleton to the dwo's root DIE, like the ranges. Looks like I need to read and understand something a few times before it stays :). >> In fact, the reason the code was checking for DW_TAG_compile_unit must be that >> in the GCC/pre-standard version, the skeleton DIE in the executable is a >> DW_TAG_compile_unit. With DWARF5, we'll see DW_TAG_skeleton_unit here. >> >> So I believe we should use >> >> (tag != DW_TAG_compile_unit && tag != DW_TAG_skeleton_unit) >> >> to cover both versions, GCC pre-standard and DWARF 5. Does that make sense? > > I agree that we need to check both cases in cu_debug_rnglists_section, > because sometimes it gets called before the line above in cutu_reader, > and sometimes it gets called after (now that I'm also calling it in > dwarf2_rnglists_process). Ok. >> Wherever we use the logic: >> >> int need_ranges_base = (die->tag != DW_TAG_compile_unit >> && attr->form != DW_FORM_rnglistx); >> >> we should maybe check for DW_TAG_skeleton_unit as well?" > > I don't think there's any point in checking for DW_TAG_skeleton_unit > in the need_ranges_base checks, because I believe that all of those > checks are called after the call to cutu_reader, so we never have a > DW_TAG_skeleton_unit by the time we get to those checks. Makes sense, I think. I don't think I have any more comments. Tom, are you ok with this? Simon