summaryrefslogtreecommitdiff
path: root/gdb/avr-tdep.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-10-13 00:05:07 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2007-10-13 00:05:07 +0000
commit21acbb9a4bbb9ef5a42d71f4e736b0589d1755f5 (patch)
tree240f5a6f8283ab342cf24c75c8347784efe8601b /gdb/avr-tdep.c
parent152236d6364b64f7e6da56381f7c97e023b426f5 (diff)
downloadgdb-21acbb9a4bbb9ef5a42d71f4e736b0589d1755f5.tar.gz
* avr-tdep.c (avr_return_value): New function.
(avr_gdbarch_init): Call set_gdbarch_return_value instead of set_gdbarch_extract_return_value. * fvr-tdep.c (frv_return_value): New function. (frv_gdbarch_init): Call set_gdbarch_return_value instead of set_gdbarch_extract_return_value, set_gdbarch_store_return_value, and set_gdbarch_deprecated_use_struct_convention. * ia64-tdep.c (ia64_use_struct_convention): Make static. Add check for structure, union, or array types. (ia64_extract_return_value): Make static. (ia64_store_return_value): Make static. Support multi-word values. (ia64_return_value): New function. (ia64_gdbarch_init): Call set_gdbarch_return_value instead of set_gdbarch_extract_return_value, set_gdbarch_store_return_value, and set_gdbarch_deprecated_use_struct_convention.
Diffstat (limited to 'gdb/avr-tdep.c')
-rw-r--r--gdb/avr-tdep.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 3db8530c14d..d3ecf2b5d64 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -827,6 +827,44 @@ avr_extract_return_value (struct type *type, struct regcache *regcache,
}
}
+/* Determine, for architecture GDBARCH, how a return value of TYPE
+ should be returned. If it is supposed to be returned in registers,
+ and READBUF is non-zero, read the appropriate value from REGCACHE,
+ and copy it into READBUF. If WRITEBUF is non-zero, write the value
+ from WRITEBUF into REGCACHE. */
+
+enum return_value_convention
+avr_return_value (struct gdbarch *gdbarch, struct type *valtype,
+ struct regcache *regcache, gdb_byte *readbuf,
+ const gdb_byte *writebuf)
+{
+ int struct_return = ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
+ || TYPE_CODE (valtype) == TYPE_CODE_UNION
+ || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+ && !(TYPE_LENGTH (valtype) == 1
+ || TYPE_LENGTH (valtype) == 2
+ || TYPE_LENGTH (valtype) == 4
+ || TYPE_LENGTH (valtype) == 8));
+
+ if (writebuf != NULL)
+ {
+ gdb_assert (!struct_return);
+ error (_("Cannot store return value."));
+ }
+
+ if (readbuf != NULL)
+ {
+ gdb_assert (!struct_return);
+ avr_extract_return_value (valtype, regcache, readbuf);
+ }
+
+ if (struct_return)
+ return RETURN_VALUE_STRUCT_CONVENTION;
+ else
+ return RETURN_VALUE_REGISTER_CONVENTION;
+}
+
+
/* Put here the code to store, into fi->saved_regs, the addresses of
the saved registers of frame described by FRAME_INFO. This
includes special registers such as pc and fp saved in special ways
@@ -1271,7 +1309,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_register_name (gdbarch, avr_register_name);
set_gdbarch_register_type (gdbarch, avr_register_type);
- set_gdbarch_extract_return_value (gdbarch, avr_extract_return_value);
+ set_gdbarch_return_value (gdbarch, avr_return_value);
set_gdbarch_print_insn (gdbarch, print_insn_avr);
set_gdbarch_push_dummy_call (gdbarch, avr_push_dummy_call);