/* Target-dependent code for Atmel AVR, for GDB.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of GDB.
info->saved_regs[AVR_SREG_REGNUM].addr = 3;
info->saved_regs[0].addr = 2;
info->saved_regs[1].addr = 1;
- info->size += 3;
+ info->size += 2;
}
}
break;
}
- if (vpc >= AVR_MAX_PROLOGUE_SIZE)
- fprintf_unfiltered (gdb_stderr,
- _("Hit end of prologue while scanning pushes\n"));
+ gdb_assert (vpc < AVR_MAX_PROLOGUE_SIZE);
/* Handle static small stack allocation using rcall or push. */
if (struct_return)
{
- regcache_cooked_write_unsigned (regcache, regnum--,
- struct_addr & 0xff);
- regcache_cooked_write_unsigned (regcache, regnum--,
- (struct_addr >> 8) & 0xff);
+ regcache_cooked_write_unsigned
+ (regcache, regnum--, (struct_addr >> 8) & 0xff);
+ regcache_cooked_write_unsigned
+ (regcache, regnum--, struct_addr & 0xff);
+ /* SP being post decremented, we need to reserve one byte so that the
+ return address won't overwrite the result (or vice-versa). */
+ if (sp == struct_addr)
+ sp--;
}
for (i = 0; i < nargs; i++)