diff options
author | Tristan Gingold <gingold@adacore.com> | 2009-11-13 10:32:58 +0000 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2009-11-13 10:32:58 +0000 |
commit | fd6d6815538394e49c70d2df8fd65ebddb05ffbe (patch) | |
tree | d2d9d1a0054f1e40c3e26de9fd4816d58f1fa7c5 /gdb/avr-tdep.c | |
parent | 2fa554264611910bc0d0f095893b2adc59732232 (diff) | |
download | gdb-fd6d6815538394e49c70d2df8fd65ebddb05ffbe.zip gdb-fd6d6815538394e49c70d2df8fd65ebddb05ffbe.tar.gz gdb-fd6d6815538394e49c70d2df8fd65ebddb05ffbe.tar.bz2 |
2009-11-13 Tristan Gingold <gingold@adacore.com>
* avr-tdep.c (avr_push_dummy_call): Fix endianness issue and avoid
overlap between returned structure and return address/parameters.
Diffstat (limited to 'gdb/avr-tdep.c')
-rw-r--r-- | gdb/avr-tdep.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index ba6e8cb..0c76cf4 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1252,10 +1252,14 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function, 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++) |