From patchwork Wed Jul 29 18:32:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 7920 Received: (qmail 93234 invoked by alias); 29 Jul 2015 18:34:20 -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 93222 invoked by uid 89); 29 Jul 2015 18:34:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Jul 2015 18:34:19 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1ZKWBE-0002CW-4V from Sandra_Loosemore@mentor.com ; Wed, 29 Jul 2015 11:34:16 -0700 Received: from [IPv6:::1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.224.2; Wed, 29 Jul 2015 11:34:15 -0700 Message-ID: <55B91C35.3040503@codesourcery.com> Date: Wed, 29 Jul 2015 12:32:21 -0600 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: CC: Yao Qi Subject: [patch, nios2] don't allow non-stack memory writes in the prologue I noted some nios2 testsuite failures in new-ish gdb.dwarf2 tests that were caused by a breakpoint being set too far into a function, where it had already executed an instruction that writes to memory. There is already a comment in the existing code in the prologue analyzer: /* Non-stack memory writes cannot appear in the prologue. */ but there's a bug in the code (leftover from ancient history) that permits some other writes too. This patch squashes it.... it fixes the failing test cases and doesn't cause any regressions. OK to commit? -Sandra diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c index 1c5dcde..12056b5 100644 --- a/gdb/nios2-tdep.c +++ b/gdb/nios2-tdep.c @@ -935,9 +935,7 @@ nios2_analyze_prologue (struct gdbarch *gdbarch, const CORE_ADDR start_pc, if (orig > 0 && (value[rb].offset == 0 || (orig == NIOS2_EA_REGNUM && value[rb].offset == -4)) - && ((value[ra].reg == NIOS2_SP_REGNUM - && cache->reg_saved[orig].basereg != NIOS2_SP_REGNUM) - || cache->reg_saved[orig].basereg == -1)) + && value[ra].reg == NIOS2_SP_REGNUM) { if (pc < current_pc) {