From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80246 invoked by alias); 7 Mar 2019 13:25:47 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 80228 invoked by uid 89); 7 Mar 2019 13:25:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-25.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Subject: [PRING][PATCH][low-mem] Fix DW_OP_GNU_parameter_ref handling in read_exprloc From: Tom de Vries To: jakub@redhat.com References: <20190214093832.GA22005@delia> Cc: dwz@sourceware.org Message-ID: <883e82a2-89d8-79c4-4c18-f1f8701b7383@suse.de> Date: Tue, 01 Jan 2019 00:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20190214093832.GA22005@delia> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SW-Source: 2019-q1/txt/msg00102.txt.bz2 On 14-02-19 10:38, Tom de Vries wrote: > Hi, > > Function read_exprloc contains a loop that marks all parents of a > DW_OP_GNU_parameter_ref reference with CK_BAD. The loop however has no > private loop variable, so the ref variable, initially pointing to the > referenced DIE, ends up after the loop pointing to the root parent of the > reference instead. Consequently, the code after the loop, intended to be > executed for the referenced DIE, is instead executed for the root parent of > the referenced DIE. > > Fix this by moving the loop alap. > > OK for trunk? > Ping. [ This fixes an assert triggered on a cc1 executable generated by gcc bootstrap-lto: ... $ dwz cc1 dwz: dwz.c:8562: adjust_exprloc: Assertion `refd != NULL && !refd->die_remove' failed. ... ] Thanks, - Tom > [low-mem] Fix DW_OP_GNU_parameter_ref handling in read_exprloc > > 2019-02-14 Tom de Vries > > PR dwz/24195 > * dwz.c (read_exprloc): Move loop marking parents with CK_BAD alap. > > --- > dwz.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/dwz.c b/dwz.c > index d348418..6e6b6fb 100644 > --- a/dwz.c > +++ b/dwz.c > @@ -1492,6 +1492,15 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len, > } > if (op == DW_OP_call2) > ref->die_op_call2_referenced = 1; > + if (unlikely (low_mem)) > + { > + ref->die_referenced = 1; > + /* As .debug_loc adjustment is done after > + write_info finishes, we need to keep the referenced > + DIEs around uncollapsed. */ > + if (need_adjust) > + ref->die_intercu_referenced = 1; > + } > if (ref->die_ck_state == CK_KNOWN) > { > ref->die_ck_state = CK_BAD; > @@ -1504,15 +1513,6 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len, > } > else > ref->die_ck_state = CK_BAD; > - if (unlikely (low_mem)) > - { > - ref->die_referenced = 1; > - /* As .debug_loc adjustment is done after > - write_info finishes, we need to keep the referenced > - DIEs around uncollapsed. */ > - if (need_adjust) > - ref->die_intercu_referenced = 1; > - } > die->die_ck_state = CK_BAD; > if (need_adjust) > *need_adjust = true; >