diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-06-20 18:10:14 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-06-20 18:10:14 +0000 |
commit | 750eb019f10b80dfed775e0062e33326f5a79adb (patch) | |
tree | 428eaa7d99873e8068d8c213ad6cbcfd725b0642 /gdb/arch-utils.c | |
parent | b5622e8d3cc3ba6ed60cbfee39a9c094074e27a1 (diff) | |
download | gdb-750eb019f10b80dfed775e0062e33326f5a79adb.zip gdb-750eb019f10b80dfed775e0062e33326f5a79adb.tar.gz gdb-750eb019f10b80dfed775e0062e33326f5a79adb.tar.bz2 |
2004-06-20 Andrew Cagney <cagney@gnu.org>
* gdbarch.sh (RETURN_VALUE): Default to legacy_return_value.
* gdbarch.h, gdbarch.c: Re-generate.
* Makefile.in (arch-utils.o): Update dependencies.
* values.c (using_struct_return): Move code calling
USE_STRUCT_CONVENTION to legacy_return_value, simplify.
* stack.c (return_command): Move code calling STORE_RETURN_VALUE
to legacy_return_value, simplify.
* infcmd.c (print_return_value): Move code calling
DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS and EXTRACT_RETURN_VALUE
to legacy_return_value, simplify.
* infcall.c (call_function_by_hand): Move code calling
EXTRACT_RETURN_VALUE to legacy_return_value, simplify.
* arch-utils.c: Update copyright. Include "gdbcore.h".
(legacy_return_value): New function.
* arch-utils.h: Update copyright.
(legacy_return_value): Declare.
Diffstat (limited to 'gdb/arch-utils.c')
-rw-r--r-- | gdb/arch-utils.c | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 2ec0674..d7bbe6c 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -1,7 +1,7 @@ /* Dynamic architecture support for GDB, the GNU debugger. - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, - Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software + Foundation, Inc. This file is part of GDB. @@ -30,7 +30,7 @@ #include "regcache.h" #include "gdb_assert.h" #include "sim-regno.h" - +#include "gdbcore.h" #include "osabi.h" #include "version.h" @@ -60,13 +60,46 @@ legacy_store_return_value (struct type *type, struct regcache *regcache, DEPRECATED_STORE_RETURN_VALUE (type, b); } - int always_use_struct_convention (int gcc_p, struct type *value_type) { return 1; } +enum return_value_convention +legacy_return_value (struct gdbarch *gdbarch, struct type *valtype, + struct regcache *regcache, void *readbuf, + const void *writebuf) +{ + /* NOTE: cagney/2004-06-13: The gcc_p parameter to + USE_STRUCT_CONVENTION isn't used. */ + int struct_return = ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT + || TYPE_CODE (valtype) == TYPE_CODE_UNION + || TYPE_CODE (valtype) == TYPE_CODE_ARRAY) + && DEPRECATED_USE_STRUCT_CONVENTION (0, valtype)); + + if (writebuf != NULL) + { + gdb_assert (!struct_return); + /* NOTE: cagney/2004-06-13: See stack.c:return_command. Old + architectures don't expect STORE_RETURN_VALUE to handle small + structures. Should not be called with such types. */ + gdb_assert (TYPE_CODE (valtype) != TYPE_CODE_STRUCT + && TYPE_CODE (valtype) != TYPE_CODE_UNION); + STORE_RETURN_VALUE (valtype, regcache, writebuf); + } + + if (readbuf != NULL) + { + gdb_assert (!struct_return); + EXTRACT_RETURN_VALUE (valtype, regcache, readbuf); + } + + if (struct_return) + return RETURN_VALUE_STRUCT_CONVENTION; + else + return RETURN_VALUE_REGISTER_CONVENTION; +} int legacy_register_sim_regno (int regnum) |