diff options
Diffstat (limited to 'gdb/m68hc11-tdep.c')
-rw-r--r-- | gdb/m68hc11-tdep.c | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 80480a6611b..43fce357871 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -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) -{ - 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) +enum return_value_convention +m68hc11_return_value (struct gdbarch *gdbarch, struct type *valtype, + struct regcache *regcache, void *readbuf, + const void *writebuf) { - 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); |