From patchwork Thu Nov 9 18:15:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikola Prica X-Patchwork-Id: 24184 Received: (qmail 13318 invoked by alias); 9 Nov 2017 18:15:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 5484 invoked by uid 89); 9 Nov 2017 18:15:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=HTo:U*kevinb, rights X-HELO: mail.rt-rk.com Received: from mx2.rt-rk.com (HELO mail.rt-rk.com) (89.216.37.149) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Nov 2017 18:15:15 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 234AF1A4575; Thu, 9 Nov 2017 19:15:10 +0100 (CET) Received: from [10.10.13.98] (rtrkw512-lin.domain.local [10.10.13.98]) by mail.rt-rk.com (Postfix) with ESMTPSA id D861E1A239C; Thu, 9 Nov 2017 19:15:09 +0100 (CET) Subject: Re: [PING][PATCH] Fix for prologue processing on PowerPC To: Kevin Buettner Cc: gdb-patches@sourceware.org, "Ananthakrishna Sowda (asowda)" , "Ivan Baev (ibaev)" , 'Nemanja Popov' , Djordje Todorovic References: <20171108095850.394a48ca@pinnacle.lan> From: Nikola Prica Message-ID: <8bf0014c-e83c-5988-4d06-173572f21186@rt-rk.com> Date: Thu, 9 Nov 2017 19:15:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171108095850.394a48ca@pinnacle.lan> Hi Kevin, lr_reg could be also set to -2 in part of code which is reachable after shifting removal. /* Invalidate lr_reg, but don't set it to -1. That would mean that it had never been set. */ lr_reg = -2; This part of the code which depends of non shifted lr_reg, and the part where shifting is removed are only two places where lr_reg is changed. As so, I've added last condition to set fdata->lr_register on -1 if lim_pc is not reached. If it seems fine now could you pleas commit it because I don't have rights to do it. Thanks, Nikola Prica From: Prica Date: Thu, 9 Nov 2017 13:10:48 +0100 Subject: Fix for prologue processing on PowerPC One of conditions in skip_prologue() is never visited because it expects non shifted `lr_reg`. That condition is supposed to set PC offset. When body of this condition is visited PC offset is set and there will be no need to look for it in next frames nor to use frame unwind directives. gdb/ChangeLog: *rs6000-tdep.c (skip_prologue): Remove shifting for lr_reg and assign shifted lr_reg to fdata->lr_register when lr_reg is set. If iteration do not hit lim_pc lr_register is set as -1. --- gdb/rs6000-tdep.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) else if ((op & 0xfc1fffff) == 0x7c000026) @@ -2180,8 +2183,8 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc, } #endif /* 0 */ - if (pc == lim_pc && lr_reg >= 0) - fdata->lr_register = lr_reg; + if (pc != lim_pc) + fdata->lr_register = -1; fdata->offset = -fdata->offset; return last_prologue_pc; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 6c44995..6f05ef5 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1655,9 +1655,12 @@ skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR lim_pc, remember just the first one, but skip over additional ones. */ if (lr_reg == -1) - lr_reg = (op & 0x03e00000) >> 21; - if (lr_reg == 0) - r0_contains_arg = 0; + { + lr_reg = (op & 0x03e00000); + fdata->lr_register = lr_reg >> 21; + if (lr_reg == 0) + r0_contains_arg = 0; + } continue; }