This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch, nios2] don't allow non-stack memory writes in the prologue
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Yao Qi <qiyaoltc at gmail dot com>
- Date: Wed, 29 Jul 2015 12:32:21 -0600
- Subject: [patch, nios2] don't allow non-stack memory writes in the prologue
- Authentication-results: sourceware.org; auth=none
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
2015-07-29 Sandra Loosemore <sandra@codesourcery.com>
gdb/
* nios2-tdep.c (nios2_analyze_prologue): Do what the comment
already says and disallow non-stack memory writes in the prologue.
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)
{