[nios2] don't allow non-stack memory writes in the prologue
Commit Message
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
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.
@@ -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)
{