From: Corinna Vinschen Date: Sat, 28 Sep 2002 16:11:29 +0000 (+0000) Subject: * sh-tdep.c (sh_use_struct_convention): Use definition according to ABI. X-Git-Tag: drow-cplus-branchpoint~102 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7079c36ccc7d18d5958f2ec2b73f9589cefa19ef;p=platform%2Fupstream%2Fbinutils.git * sh-tdep.c (sh_use_struct_convention): Use definition according to ABI. (sh_push_arguments): Store in register with correct endianess. (sh_default_store_return_value): Ditto. (sh_gdbarch_init): Set sizeof long double to 8. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 25e0981..383ad64 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2002-09-28 Corinna Vinschen + + * sh-tdep.c (sh_use_struct_convention): Use definition according to ABI. + (sh_push_arguments): Store in register with correct endianess. + (sh_default_store_return_value): Ditto. + (sh_gdbarch_init): Set sizeof long double to 8. + 2002-09-27 Mark Kettenis * defs.h: Move inclusion of "ansidecl.h" before "gdb_locale.h". diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 7ac5b9e..c5e5bf4 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -884,7 +884,14 @@ sh_saved_pc_after_call (struct frame_info *frame) static int sh_use_struct_convention (int gcc_p, struct type *type) { +#if 0 return (TYPE_LENGTH (type) > 1); +#else + int len = TYPE_LENGTH (type); + int nelem = TYPE_NFIELDS (type); + return ((len != 1 && len != 2 && len != 4 && len != 8) || nelem != 1) && + (len != 8 || TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) != 4); +#endif } static int @@ -2045,8 +2052,11 @@ sh_push_arguments (int nargs, struct value **args, CORE_ADDR sp, if (len < 4) { /* value gets right-justified in the register or stack word */ - memcpy (valbuf + (4 - len), - (char *) VALUE_CONTENTS (args[argnum]), len); + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + memcpy (valbuf + (4 - len), + (char *) VALUE_CONTENTS (args[argnum]), len); + else + memcpy (valbuf, (char *) VALUE_CONTENTS (args[argnum]), len); val = valbuf; } else @@ -2457,8 +2467,11 @@ sh_default_store_return_value (struct type *type, char *valbuf) { /* Add leading zeros to the value. */ memset (buf, 0, REGISTER_RAW_SIZE (R0_REGNUM)); - memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type), - valbuf, TYPE_LENGTH (type)); + if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + memcpy (buf + REGISTER_RAW_SIZE (R0_REGNUM) - TYPE_LENGTH (type), + valbuf, TYPE_LENGTH (type)); + else + memcpy (buf, valbuf, TYPE_LENGTH (type)); write_register_bytes (REGISTER_BYTE (R0_REGNUM), buf, REGISTER_RAW_SIZE (R0_REGNUM)); } @@ -4544,7 +4557,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT); set_gdbarch_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); - set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);/*??should be 8?*/ + set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT); set_gdbarch_use_generic_dummy_frames (gdbarch, 1); set_gdbarch_call_dummy_length (gdbarch, 0);