aboutsummaryrefslogtreecommitdiff
path: root/gdb/stack.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2009-03-15 09:19:40 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2009-03-15 09:19:40 +0000
commit61ff14c69a7cb2870f9dd2792690a1fbc8967f29 (patch)
tree0aa0c4e0aa58d9bcc89c2497e4d22c9197dc6eba /gdb/stack.c
parent30c665df3f6fb41cc4f9f342d03f4ec4d97a7a24 (diff)
downloadgdb-61ff14c69a7cb2870f9dd2792690a1fbc8967f29.zip
gdb-61ff14c69a7cb2870f9dd2792690a1fbc8967f29.tar.gz
gdb-61ff14c69a7cb2870f9dd2792690a1fbc8967f29.tar.bz2
gdb/
* stack.c (return_command <retval_exp>): New variables retval_expr and old_chain. Inline parse_and_eval to initialize retval_expr. Check RETVAL_EXPR for UNOP_CAST and set RETURN_TYPE to the RETURN_VALUE type if RETURN_TYPE is NULL. gdb/doc/ * gdb.texinfo (Returning): New description for missing debug info. gdb/testsuite/ * gdb.base/return-nodebug.exp, gdb.base/return-nodebug.c: New.
Diffstat (limited to 'gdb/stack.c')
-rw-r--r--gdb/stack.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/stack.c b/gdb/stack.c
index d0c872e..d0ea3bf 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1796,18 +1796,27 @@ return_command (char *retval_exp, int from_tty)
message. */
if (retval_exp)
{
+ struct expression *retval_expr = parse_expression (retval_exp);
+ struct cleanup *old_chain = make_cleanup (xfree, retval_expr);
struct type *return_type = NULL;
/* Compute the return value. Should the computation fail, this
call throws an error. */
- return_value = parse_and_eval (retval_exp);
+ return_value = evaluate_expression (retval_expr);
/* Cast return value to the return type of the function. Should
the cast fail, this call throws an error. */
if (thisfun != NULL)
return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun));
if (return_type == NULL)
- return_type = builtin_type (get_frame_arch (thisframe))->builtin_int;
+ {
+ if (retval_expr->elts[0].opcode != UNOP_CAST)
+ error (_("Return value type not available for selected "
+ "stack frame.\n"
+ "Please use an explicit cast of the value to return."));
+ return_type = value_type (return_value);
+ }
+ do_cleanups (old_chain);
CHECK_TYPEDEF (return_type);
return_value = value_cast (return_type, return_value);