diff options
author | David S. Miller <davem@redhat.com> | 2013-02-06 19:40:04 +0000 |
---|---|---|
committer | David S. Miller <davem@redhat.com> | 2013-02-06 19:40:04 +0000 |
commit | bbfdfe1c572ca7710cf08607db4935e8c8db174c (patch) | |
tree | 9b17fe788ec840a339b176b8fd82ebe353cef5fe /gdb/sparc-tdep.c | |
parent | bc9abe4a9122ac5984bb05ecd895ddeec6c8a67c (diff) | |
download | gdb-bbfdfe1c572ca7710cf08607db4935e8c8db174c.zip gdb-bbfdfe1c572ca7710cf08607db4935e8c8db174c.tar.gz gdb-bbfdfe1c572ca7710cf08607db4935e8c8db174c.tar.bz2 |
Allow struct 'return' on 32-bit sparc.
gdb/
* sparc-tdep.c (sparc32_return_value): Handle writing return value when
using RETURN_VALUE_ABI_PRESERVES_ADDRESS.
* value.c (struct_return_convention): New function.
(using_struct_return): Implement in terms of struct_return_convention.
* value.h (struct_return_convention): Declare.
* stack.c (return_command): Allow successful overriding of the return
value when RETURN_VALUE_ABI_PRESERVES_ADDRESS.
Diffstat (limited to 'gdb/sparc-tdep.c')
-rw-r--r-- | gdb/sparc-tdep.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 3ae7395..2b38521 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -1370,15 +1370,21 @@ sparc32_return_value (struct gdbarch *gdbarch, struct value *function, if (sparc_structure_or_union_p (type) || (sparc_floating_p (type) && TYPE_LENGTH (type) == 16)) { + ULONGEST sp; + CORE_ADDR addr; + if (readbuf) { - ULONGEST sp; - CORE_ADDR addr; - regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp); addr = read_memory_unsigned_integer (sp + 64, 4, byte_order); read_memory (addr, readbuf, TYPE_LENGTH (type)); } + if (writebuf) + { + regcache_cooked_read_unsigned (regcache, SPARC_SP_REGNUM, &sp); + addr = read_memory_unsigned_integer (sp + 64, 4, byte_order); + write_memory (addr, writebuf, TYPE_LENGTH (type)); + } return RETURN_VALUE_ABI_PRESERVES_ADDRESS; } |