summaryrefslogtreecommitdiff
path: root/gdb/stack.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2013-02-06 19:39:59 +0000
committerDavid S. Miller <davem@redhat.com>2013-02-06 19:39:59 +0000
commit60c59b87b263dd7886d7d93db983c88b7a14666f (patch)
treef6220d8d4ead9342154f9d8231c7fb7490d331b2 /gdb/stack.c
parentff5886c0480b1220132345e99aed7b222b46e80e (diff)
downloadgdb-60c59b87b263dd7886d7d93db983c88b7a14666f.tar.gz
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/stack.c')
-rw-r--r--gdb/stack.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/gdb/stack.c b/gdb/stack.c
index bfec1b853b3..9f4aafc812d 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -2278,6 +2278,7 @@ down_command (char *count_exp, int from_tty)
void
return_command (char *retval_exp, int from_tty)
{
+ enum return_value_convention rv_conv;
struct frame_info *thisframe;
struct gdbarch *gdbarch;
struct symbol *thisfun;
@@ -2331,6 +2332,7 @@ return_command (char *retval_exp, int from_tty)
if (thisfun != NULL)
function = read_var_value (thisfun, thisframe);
+ rv_conv = RETURN_VALUE_REGISTER_CONVENTION;
if (TYPE_CODE (return_type) == TYPE_CODE_VOID)
/* If the return-type is "void", don't try to find the
return-value's location. However, do still evaluate the
@@ -2338,14 +2340,18 @@ return_command (char *retval_exp, int from_tty)
is discarded, side effects such as "return i++" still
occur. */
return_value = NULL;
- else if (thisfun != NULL
- && using_struct_return (gdbarch, function, return_type))
+ else if (thisfun != NULL)
{
- query_prefix = "The location at which to store the "
- "function's return value is unknown.\n"
- "If you continue, the return value "
- "that you specified will be ignored.\n";
- return_value = NULL;
+ rv_conv = struct_return_convention (gdbarch, function, return_type);
+ if (rv_conv == RETURN_VALUE_STRUCT_CONVENTION
+ || rv_conv == RETURN_VALUE_ABI_RETURNS_ADDRESS)
+ {
+ query_prefix = "The location at which to store the "
+ "function's return value is unknown.\n"
+ "If you continue, the return value "
+ "that you specified will be ignored.\n";
+ return_value = NULL;
+ }
}
}
@@ -2375,9 +2381,8 @@ return_command (char *retval_exp, int from_tty)
struct type *return_type = value_type (return_value);
struct gdbarch *gdbarch = get_regcache_arch (get_current_regcache ());
- gdb_assert (gdbarch_return_value (gdbarch, function, return_type, NULL,
- NULL, NULL)
- == RETURN_VALUE_REGISTER_CONVENTION);
+ gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION
+ && rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS);
gdbarch_return_value (gdbarch, function, return_type,
get_current_regcache (), NULL /*read*/,
value_contents (return_value) /*write*/);