From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53512 invoked by alias); 16 Oct 2018 22:29:51 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 53490 invoked by uid 89); 16 Oct 2018 22:29:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=dies, investigating, Hx-languages-length:2619 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Oct 2018 22:29:49 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38E913082DCF; Tue, 16 Oct 2018 22:29:48 +0000 (UTC) Received: from theo.uglyboxes.com (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 01D1079B35; Tue, 16 Oct 2018 22:29:47 +0000 (UTC) Subject: Re: [PATCH] Prevent inline function parameters from crashing the DWARF reader To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20181012212141.29423-1-keiths@redhat.com> <87o9btbkt1.fsf@tromey.com> From: Keith Seitz Message-ID: <846fe42c-f510-bdc8-0f48-15e313e7b2a4@redhat.com> Date: Tue, 16 Oct 2018 22:29:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <87o9btbkt1.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00360.txt.bz2 On 10/16/18 3:15 PM, Tom Tromey wrote: >>>>>> "Keith" == Keith Seitz writes: > > Keith> However, as demonstrated in this Fedora bugzilla: > Keith> https://bugzilla.redhat.com/show_bug.cgi?id=1638798 > > Keith> the abstract_origin of the parameter DIE may be in an entirely different > Keith> CU. This CU will have no builder defined for it, so the call to > Keith> get_current_context_stack is made on an uninitialized builder, and GDB > Keith> segfaults. > > I was curious what happened before, so I checked out the commit > before 804d27291b2922f01fe5cc2d9ae759533d4a2f6f, and ran it on the > executable in that bug. > > I set a breakpoint conditional on curr==0 and it never hit. > What ends up happening, IIRC, is that we simply only ever checked (previously) the depth level. It was 0. > Now, I am not totally sure that this was correct before, but I suppose > what was going on was that the earlier code was installing these symbols > into the referencing CU's symtab. Yeah, I was wondering about something like that, too, but had convinced myself temporarily that this was appropriate. The immediate problem is that the formal_parameter DIE lives in a partial_unit in its own CU. After troubleshooting other similar problems, I'm now not so sure. [I was coming around to another (better?) solution, see below.] > Abstractly, at least, that seems reasonable. So maybe that approach > should be taken again. > > Also, when I look at new_symbol, I see a bunch of uses of cu->builder, > so I wonder if there are ways to make those spots crash as well. > So maybe this indicates some different approach is needed as well. It's not just new_symbol. It happens in other places, too, like read_import_statement (where it calls using_directives). > Sorry about this. I didn't anticipate this at all. I can try to take > it over if you'd like. So far, I'm still investigating, but from the Fedora side -- which seems like it may be in really bad shape right now for some reason. > Maybe one idea would be to temporarily set the referenced CU's builder > to the referencing CU's builder somehow. Yeah, that is an approach not too far off (I think?) from what I was attempting: When we "import" DIEs from other CUs, I add them to an sort of CU inheritance chain. Then we crawl up the chain looking for the last valid builder. [This can happen frequently with DW_TAG_partial_unit DIEs in the debuginfo.] If I need more help, I will certainly let you know. Let's consider this patch shelved for the moment. Keith