From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 125407 invoked by alias); 14 Feb 2019 09:38:08 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 125295 invoked by uid 89); 14 Feb 2019 09:38:07 -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=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=marks X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Tue, 01 Jan 2019 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [PATCH][low-mem] Fix DW_OP_GNU_parameter_ref handling in read_exprloc Message-ID: <20190214093832.GA22005@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-q1/txt/msg00022.txt.bz2 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? 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;