gdb: add a symbol* argument to get_return_value

Add an argument to the get_return_value function to indicate the symbol
of the function the debuggee is returning from.  This will be used by
the following patch.

Since the function return type can be deduced from the symbol remove the
value_type argument which becomes redundant.

No user visible change after this patch.

Tested on x86_64-linux.

Change-Id: Idf1279f1f7199f5022738a6679e0fa63fbd22edc
Co-authored-by: Simon Marchi <simon.marchi@polymtl.ca>
This commit is contained in:
Lancelot SIX
2022-02-02 06:34:12 -05:00
parent 3c4c0a18c8
commit e6b3636709
3 changed files with 44 additions and 34 deletions

View File

@@ -1444,18 +1444,17 @@ advance_command (const char *arg, int from_tty)
until_break_command (arg, from_tty, 1);
}
/* Return the value of the result of a function at the end of a 'finish'
command/BP. DTOR_DATA (if not NULL) can represent inferior registers
right after an inferior call has finished. */
/* See inferior.h. */
struct value *
get_return_value (struct value *function, struct type *value_type)
get_return_value (struct symbol *func_symbol, struct value *function)
{
regcache *stop_regs = get_current_regcache ();
struct gdbarch *gdbarch = stop_regs->arch ();
struct value *value;
value_type = check_typedef (value_type);
struct type *value_type
= check_typedef (TYPE_TARGET_TYPE (func_symbol->type ()));
gdb_assert (value_type->code () != TYPE_CODE_VOID);
/* FIXME: 2003-09-27: When returning from a nested inferior function
@@ -1616,7 +1615,7 @@ finish_command_fsm::should_stop (struct thread_info *tp)
struct value *func;
func = read_var_value (function, NULL, get_current_frame ());
rv->value = get_return_value (func, rv->type);
rv->value = get_return_value (function, func);
if (rv->value != NULL)
rv->value_history_index = record_latest_value (rv->value);
}