[nios2] don't allow non-stack memory writes in the prologue

Message ID 55B91C35.3040503@codesourcery.com
State New, archived
Headers

Commit Message

Sandra Loosemore July 29, 2015, 6:32 p.m. UTC
  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
  

Comments

Yao Qi July 30, 2015, 11:46 a.m. UTC | #1
Sandra Loosemore <sandra@codesourcery.com> writes:

> 	gdb/
> 	* nios2-tdep.c (nios2_analyze_prologue): Do what the comment
> 	already says and disallow non-stack memory writes in the prologue.

Patch is OK to me.
  

Patch

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)
 		{