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/value.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/value.c')
-rw-r--r-- | gdb/value.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/gdb/value.c b/gdb/value.c index dbf1c37..4b70ece 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3323,6 +3323,23 @@ coerce_array (struct value *arg) } +/* Return the return value convention that will be used for the + specified type. */ + +enum return_value_convention +struct_return_convention (struct gdbarch *gdbarch, + struct value *function, struct type *value_type) +{ + enum type_code code = TYPE_CODE (value_type); + + if (code == TYPE_CODE_ERROR) + error (_("Function return type unknown.")); + + /* Probe the architecture for the return-value convention. */ + return gdbarch_return_value (gdbarch, function, value_type, + NULL, NULL, NULL); +} + /* Return true if the function returning the specified type is using the convention of returning structures in memory (passing in the address as a hidden first parameter). */ @@ -3331,19 +3348,12 @@ int using_struct_return (struct gdbarch *gdbarch, struct value *function, struct type *value_type) { - enum type_code code = TYPE_CODE (value_type); - - if (code == TYPE_CODE_ERROR) - error (_("Function return type unknown.")); - - if (code == TYPE_CODE_VOID) + if (TYPE_CODE (value_type) == TYPE_CODE_VOID) /* A void return value is never in memory. See also corresponding code in "print_return_value". */ return 0; - /* Probe the architecture for the return-value convention. */ - return (gdbarch_return_value (gdbarch, function, value_type, - NULL, NULL, NULL) + return (struct_return_convention (gdbarch, function, value_type) != RETURN_VALUE_REGISTER_CONVENTION); } |