Index: ChangeLog

2004-06-13  Andrew Cagney  <cagney@gnu.org>

	* gdbarch.sh (RETURN_VALUE_ON_STACK): Delete method.
	* gdbarch.h, gdbarch.c: Re-generate.
	* m68hc11-tdep.c (m68hc11_return_value_on_stack): Delete function.
	(m68hc11_use_struct_convention): Delete function.
	(m68hc11_extract_struct_value_address): Delete function.
	(m68hc11_return_value): New function.
	(m68hc11_gdbarch_init): Instead of store_return_value,
	extract_return_value, return_value_on_stack,
	deprecated_extract_struct_value_address and use_struct_convention,
	set return_value.
	* values.c (using_struct_return): Do not call
	RETURN_VALUE_ON_STACK.
	* arch-utils.h (generic_return_value_on_stack_not): Delete
	declaration.
	* arch-utils.c (generic_return_value_on_stack_not): Delete
	function.

Index: doc/ChangeLog
2004-06-13  Andrew Cagney  <cagney@gnu.org>

	* gdbint.texinfo (Target Architecture Definition): Delete
	description of RETURN_VALUE_ON_STACK.
This commit is contained in:
Andrew Cagney 2004-06-13 13:42:33 +00:00
parent 789cdc3a47
commit 9709241559
10 changed files with 47 additions and 128 deletions

View File

@ -1,3 +1,22 @@
2004-06-13 Andrew Cagney <cagney@gnu.org>
* gdbarch.sh (RETURN_VALUE_ON_STACK): Delete method.
* gdbarch.h, gdbarch.c: Re-generate.
* m68hc11-tdep.c (m68hc11_return_value_on_stack): Delete function.
(m68hc11_use_struct_convention): Delete function.
(m68hc11_extract_struct_value_address): Delete function.
(m68hc11_return_value): New function.
(m68hc11_gdbarch_init): Instead of store_return_value,
extract_return_value, return_value_on_stack,
deprecated_extract_struct_value_address and use_struct_convention,
set return_value.
* values.c (using_struct_return): Do not call
RETURN_VALUE_ON_STACK.
* arch-utils.h (generic_return_value_on_stack_not): Delete
declaration.
* arch-utils.c (generic_return_value_on_stack_not): Delete
function.
2004-06-12 Andrew Cagney <cagney@gnu.org>
* values.c (register_value_being_returned): Delete function.

View File

@ -84,12 +84,6 @@ legacy_register_sim_regno (int regnum)
return LEGACY_SIM_REGNO_IGNORE;
}
int
generic_return_value_on_stack_not (struct type *type)
{
return 0;
}
CORE_ADDR
generic_skip_trampoline_code (CORE_ADDR pc)
{

View File

@ -43,11 +43,6 @@ extern gdbarch_store_return_value_ftype legacy_store_return_value;
address passed as an invisible first argument to the function. */
extern gdbarch_use_struct_convention_ftype always_use_struct_convention;
/* Only structures, unions, and arrays are returned using the struct
convention. Note that arrays are never passed by value in the C
language family, so that case is irrelevant for C. */
extern gdbarch_return_value_on_stack_ftype generic_return_value_on_stack_not;
/* Typical remote_translate_xfer_address */
extern gdbarch_remote_translate_xfer_address_ftype generic_remote_translate_xfer_address;

View File

@ -1,3 +1,8 @@
2004-06-13 Andrew Cagney <cagney@gnu.org>
* gdbint.texinfo (Target Architecture Definition): Delete
description of RETURN_VALUE_ON_STACK.
2004-06-09 Andrew Cagney <cagney@gnu.org>
* gdbint.texinfo (Native Debugging): Restore "@table @code"

View File

@ -3503,43 +3503,6 @@ form.
Return the appropriate register set for a core file section with name
@var{sect_name} and size @var{sect_size}.
@item RETURN_VALUE_ON_STACK(@var{type})
@findex RETURN_VALUE_ON_STACK
@cindex returning structures by value
@cindex structures, returning by value
Return non-zero if values of type TYPE are returned on the stack, using
the ``struct convention'' (i.e., the caller provides a pointer to a
buffer in which the callee should store the return value). This
controls how the @samp{finish} command finds a function's return value,
and whether an inferior function call reserves space on the stack for
the return value.
The full logic @value{GDBN} uses here is kind of odd.
@itemize @bullet
@item
If the type being returned by value is not a structure, union, or array,
and @code{RETURN_VALUE_ON_STACK} returns zero, then @value{GDBN}
concludes the value is not returned using the struct convention.
@item
Otherwise, @value{GDBN} calls @code{USE_STRUCT_CONVENTION} (see below).
If that returns non-zero, @value{GDBN} assumes the struct convention is
in use.
@end itemize
In other words, to indicate that a given type is returned by value using
the struct convention, that type must be either a struct, union, array,
or something @code{RETURN_VALUE_ON_STACK} likes, @emph{and} something
that @code{USE_STRUCT_CONVENTION} likes.
Note that, in C and C@t{++}, arrays are never returned by value. In those
languages, these predicates will always see a pointer type, never an
array type. All the references above to arrays being returned by value
apply only to other languages.
@item SOFTWARE_SINGLE_STEP_P()
@findex SOFTWARE_SINGLE_STEP_P
Define this as 1 if the target does not have a hardware single-step

View File

@ -184,7 +184,6 @@ struct gdbarch
gdbarch_deprecated_pop_frame_ftype *deprecated_pop_frame;
gdbarch_deprecated_store_struct_return_ftype *deprecated_store_struct_return;
gdbarch_return_value_ftype *return_value;
gdbarch_return_value_on_stack_ftype *return_value_on_stack;
gdbarch_extract_return_value_ftype *extract_return_value;
gdbarch_store_return_value_ftype *store_return_value;
gdbarch_deprecated_extract_return_value_ftype *deprecated_extract_return_value;
@ -333,7 +332,6 @@ struct gdbarch startup_gdbarch =
0, /* deprecated_pop_frame */
0, /* deprecated_store_struct_return */
0, /* return_value */
0, /* return_value_on_stack */
0, /* extract_return_value */
0, /* store_return_value */
0, /* deprecated_extract_return_value */
@ -463,7 +461,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
current_gdbarch->convert_register_p = generic_convert_register_p;
current_gdbarch->pointer_to_address = unsigned_pointer_to_address;
current_gdbarch->address_to_pointer = unsigned_address_to_pointer;
current_gdbarch->return_value_on_stack = generic_return_value_on_stack_not;
current_gdbarch->extract_return_value = legacy_extract_return_value;
current_gdbarch->store_return_value = legacy_store_return_value;
current_gdbarch->use_struct_convention = generic_use_struct_convention;
@ -611,7 +608,6 @@ verify_gdbarch (struct gdbarch *current_gdbarch)
/* Skip verify of deprecated_pop_frame, has predicate */
/* Skip verify of deprecated_store_struct_return, has predicate */
/* Skip verify of return_value, has predicate */
/* Skip verify of return_value_on_stack, invalid_p == 0 */
/* Skip verify of extract_return_value, invalid_p == 0 */
/* Skip verify of store_return_value, invalid_p == 0 */
/* Skip verify of use_struct_convention, invalid_p == 0 */
@ -1809,16 +1805,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file,
"gdbarch_dump: remote_translate_xfer_address = 0x%08lx\n",
(long) current_gdbarch->remote_translate_xfer_address);
#ifdef RETURN_VALUE_ON_STACK
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
"RETURN_VALUE_ON_STACK(type)",
XSTRING (RETURN_VALUE_ON_STACK (type)));
fprintf_unfiltered (file,
"gdbarch_dump: RETURN_VALUE_ON_STACK = <0x%08lx>\n",
(long) current_gdbarch->return_value_on_stack
/*RETURN_VALUE_ON_STACK ()*/);
#endif
#ifdef SDB_REG_TO_REGNUM
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
@ -3576,23 +3562,6 @@ set_gdbarch_return_value (struct gdbarch *gdbarch,
gdbarch->return_value = return_value;
}
int
gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->return_value_on_stack != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_return_value_on_stack called\n");
return gdbarch->return_value_on_stack (type);
}
void
set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch,
gdbarch_return_value_on_stack_ftype return_value_on_stack)
{
gdbarch->return_value_on_stack = return_value_on_stack;
}
void
gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf)
{

View File

@ -1155,19 +1155,8 @@ typedef enum return_value_convention (gdbarch_return_value_ftype) (struct gdbarc
extern enum return_value_convention gdbarch_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf);
extern void set_gdbarch_return_value (struct gdbarch *gdbarch, gdbarch_return_value_ftype *return_value);
/* The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE,
STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded
into RETURN_VALUE. */
typedef int (gdbarch_return_value_on_stack_ftype) (struct type *type);
extern int gdbarch_return_value_on_stack (struct gdbarch *gdbarch, struct type *type);
extern void set_gdbarch_return_value_on_stack (struct gdbarch *gdbarch, gdbarch_return_value_on_stack_ftype *return_value_on_stack);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (RETURN_VALUE_ON_STACK)
#error "Non multi-arch definition of RETURN_VALUE_ON_STACK"
#endif
#if !defined (RETURN_VALUE_ON_STACK)
#define RETURN_VALUE_ON_STACK(type) (gdbarch_return_value_on_stack (current_gdbarch, type))
#endif
/* The deprecated methods EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE and
USE_STRUCT_CONVENTION have all been folded into RETURN_VALUE. */
typedef void (gdbarch_extract_return_value_ftype) (struct type *type, struct regcache *regcache, void *valbuf);
extern void gdbarch_extract_return_value (struct gdbarch *gdbarch, struct type *type, struct regcache *regcache, void *valbuf);

View File

@ -562,11 +562,9 @@ F:2:DEPRECATED_STORE_STRUCT_RETURN:void:deprecated_store_struct_return:CORE_ADDR
M:::enum return_value_convention:return_value:struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf:valtype, regcache, readbuf, writebuf
# The deprecated methods RETURN_VALUE_ON_STACK, EXTRACT_RETURN_VALUE,
# STORE_RETURN_VALUE and USE_STRUCT_CONVENTION have all been folded
# into RETURN_VALUE.
# The deprecated methods EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE and
# USE_STRUCT_CONVENTION have all been folded into RETURN_VALUE.
f:2:RETURN_VALUE_ON_STACK:int:return_value_on_stack:struct type *type:type:::generic_return_value_on_stack_not::0
f:2:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, void *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0
f:2:STORE_RETURN_VALUE:void:store_return_value:struct type *type, struct regcache *regcache, const void *valbuf:type, regcache, valbuf:::legacy_store_return_value::0
f:2:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf

View File

@ -1332,31 +1332,24 @@ m68hc11_extract_return_value (struct type *type, struct regcache *regcache,
}
}
/* Should call_function allocate stack space for a struct return? */
static int
m68hc11_use_struct_convention (int gcc_p, struct type *type)
enum return_value_convention
m68hc11_return_value (struct gdbarch *gdbarch, struct type *valtype,
struct regcache *regcache, void *readbuf,
const void *writebuf)
{
return (TYPE_CODE (type) == TYPE_CODE_STRUCT
|| TYPE_CODE (type) == TYPE_CODE_UNION
|| TYPE_LENGTH (type) > 4);
}
static int
m68hc11_return_value_on_stack (struct type *type)
{
return TYPE_LENGTH (type) > 4;
}
/* Extract from an array REGBUF containing the (raw) register state
the address in which a function should return its structure value,
as a CORE_ADDR (or an expression that can be used as one). */
static CORE_ADDR
m68hc11_extract_struct_value_address (struct regcache *regcache)
{
char buf[M68HC11_REG_SIZE];
regcache_cooked_read (regcache, HARD_D_REGNUM, buf);
return extract_unsigned_integer (buf, M68HC11_REG_SIZE);
if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
|| TYPE_CODE (valtype) == TYPE_CODE_UNION
|| TYPE_CODE (valtype) == TYPE_CODE_ARRAY
|| TYPE_LENGTH (valtype) > 4)
return RETURN_VALUE_STRUCT_CONVENTION;
else
{
if (readbuf != NULL)
m68hc11_extract_return_value (valtype, regcache, readbuf);
if (writebuf != NULL)
m68hc11_store_return_value (valtype, regcache, writebuf);
return RETURN_VALUE_REGISTER_CONVENTION;
}
}
/* Test whether the ELF symbol corresponds to a function using rtc or
@ -1539,12 +1532,7 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
set_gdbarch_push_dummy_call (gdbarch, m68hc11_push_dummy_call);
set_gdbarch_extract_return_value (gdbarch, m68hc11_extract_return_value);
set_gdbarch_return_value_on_stack (gdbarch, m68hc11_return_value_on_stack);
set_gdbarch_store_return_value (gdbarch, m68hc11_store_return_value);
set_gdbarch_deprecated_extract_struct_value_address (gdbarch, m68hc11_extract_struct_value_address);
set_gdbarch_use_struct_convention (gdbarch, m68hc11_use_struct_convention);
set_gdbarch_return_value (gdbarch, m68hc11_return_value);
set_gdbarch_skip_prologue (gdbarch, m68hc11_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
set_gdbarch_breakpoint_from_pc (gdbarch, m68hc11_breakpoint_from_pc);

View File

@ -1254,8 +1254,7 @@ using_struct_return (struct type *value_type, int gcc_p)
"struct return" vs "register return" conventions. */
if (code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION
|| code == TYPE_CODE_ARRAY
|| RETURN_VALUE_ON_STACK (value_type))
|| code == TYPE_CODE_ARRAY)
return USE_STRUCT_CONVENTION (gcc_p, value_type);
else
return 0;