From 75af7f6801beb09d1c2726a1c80b92ef92ee2fce Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Tue, 10 Jul 2001 21:24:48 +0000 Subject: [PATCH] Clean up the D10V port so that GDB and the target program no longer disagree on how big pointers are. * findvar.c (value_from_register): Remove special case code for D10V. * printcmd.c (print_frame_args): Same. * valops.c (value_at, value_fetch_lazy): Same. * values.c (unpack_long): Same. * gdbarch.sh: Changes to effect the following: * gdbarch.h (GDB_TARGET_IS_D10V, D10V_MAKE_DADDR, gdbarch_d10v_make_daddr_ftype, gdbarch_d10v_make_daddr, set_gdbarch_d10v_make_daddr, D10V_MAKE_IADDR, gdbarch_d10v_make_iaddr_ftype, gdbarch_d10v_make_iaddr, set_gdbarch_d10v_make_iaddr, D10V_DADDR_P, gdbarch_d10v_daddr_p_ftype, gdbarch_d10v_daddr_p, set_gdbarch_d10v_daddr_p, D10V_IADDR_P, gdbarch_d10v_iaddr_p_ftype, gdbarch_d10v_iaddr_p, set_gdbarch_d10v_iaddr_p, D10V_CONVERT_DADDR_TO_RAW, gdbarch_d10v_convert_daddr_to_raw_ftype, gdbarch_d10v_convert_daddr_to_raw, set_gdbarch_d10v_convert_daddr_to_raw, D10V_CONVERT_IADDR_TO_RAW, gdbarch_d10v_convert_iaddr_to_raw_ftype, gdbarch_d10v_convert_iaddr_to_raw, set_gdbarch_d10v_convert_iaddr_to_raw): Delete declarations. * gdbarch.c: Delete the corresponding definitions. (struct gdbarch): Delete members d10v_make_daddr, d10v_make_iaddr, d10v_daddr_p, d10v_iaddr_p, d10v_convert_daddr_to_raw, and d10v_convert_iaddr_to_raw. (startup_gdbarch): Remove initializers for the above. (verify_gdbarch, gdbarch_dump): Don't verify or dump them any more. * d10v-tdep.c (d10v_register_virtual_type): Rather that claiming the stack pointer and PC are 32 bits long (which they aren't), say that the stack pointer is an int16_t, and the program counter is a function pointer. This allows the rest of GDB to make the appropriate conversions between the code pointer format and real addresses. (d10v_register_convertible, d10v_register_convert_to_virtual, d10v_register_convert_to_raw): Delete function; no registers are convertible now, so we use generic_register_convertible_not instead. (d10v_address_to_pointer, d10v_pointer_to_address): New gdbarch methods. (d10v_push_arguments, d10v_extract_return_value): Remove special cases for code and data pointers. (d10v_gdbarch_init): Set gdbarch_ptr_bit to 16, so that GDB and the target agree on how large pointers are. Say that addresses are 32 bits long. Register the address_to_pointer and pointer_to_address conversion functions. Since no registers are convertible now, register generic_register_convertible_not as the gdbarch_register_convertible method instead of d10v_register_convertible. Remove registrations for d10v_register_convert_to_virtual, d10v_register_convert_to_raw, gdbarch_d10v_make_daddr, gdbarch_d10v_make_iaddr, gdbarch_d10v_daddr_p, gdbarch_d10v_iaddr_p, gdbarch_d10v_convert_daddr_to_raw, and gdbarch_d10v_convert_iaddr_to_raw. --- gdb/ChangeLog | 56 +++++++++++++ gdb/d10v-tdep.c | 148 ++++++++++++----------------------- gdb/findvar.c | 23 ------ gdb/gdbarch.c | 204 ------------------------------------------------ gdb/gdbarch.h | 110 -------------------------- gdb/gdbarch.sh | 14 ---- gdb/printcmd.c | 3 - gdb/valops.c | 49 +----------- gdb/values.c | 3 - 9 files changed, 107 insertions(+), 503 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 13d66dae7b..4935a2cf64 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,61 @@ 2001-07-10 Jim Blandy + Clean up the D10V port so that GDB and the target program no + longer disagree on how big pointers are. + * findvar.c (value_from_register): Remove special case code for D10V. + * printcmd.c (print_frame_args): Same. + * valops.c (value_at, value_fetch_lazy): Same. + * values.c (unpack_long): Same. + * gdbarch.sh: Changes to effect the following: + * gdbarch.h (GDB_TARGET_IS_D10V, D10V_MAKE_DADDR, + gdbarch_d10v_make_daddr_ftype, gdbarch_d10v_make_daddr, + set_gdbarch_d10v_make_daddr, D10V_MAKE_IADDR, + gdbarch_d10v_make_iaddr_ftype, gdbarch_d10v_make_iaddr, + set_gdbarch_d10v_make_iaddr, D10V_DADDR_P, + gdbarch_d10v_daddr_p_ftype, gdbarch_d10v_daddr_p, + set_gdbarch_d10v_daddr_p, D10V_IADDR_P, + gdbarch_d10v_iaddr_p_ftype, gdbarch_d10v_iaddr_p, + set_gdbarch_d10v_iaddr_p, D10V_CONVERT_DADDR_TO_RAW, + gdbarch_d10v_convert_daddr_to_raw_ftype, + gdbarch_d10v_convert_daddr_to_raw, + set_gdbarch_d10v_convert_daddr_to_raw, D10V_CONVERT_IADDR_TO_RAW, + gdbarch_d10v_convert_iaddr_to_raw_ftype, + gdbarch_d10v_convert_iaddr_to_raw, + set_gdbarch_d10v_convert_iaddr_to_raw): Delete declarations. + * gdbarch.c: Delete the corresponding definitions. + (struct gdbarch): Delete members d10v_make_daddr, + d10v_make_iaddr, d10v_daddr_p, d10v_iaddr_p, + d10v_convert_daddr_to_raw, and d10v_convert_iaddr_to_raw. + (startup_gdbarch): Remove initializers for the above. + (verify_gdbarch, gdbarch_dump): Don't verify or dump them any + more. + * d10v-tdep.c (d10v_register_virtual_type): Rather that + claiming the stack pointer and PC are 32 bits long (which they + aren't), say that the stack pointer is an int16_t, and the + program counter is a function pointer. This allows the rest + of GDB to make the appropriate conversions between the code + pointer format and real addresses. + (d10v_register_convertible, d10v_register_convert_to_virtual, + d10v_register_convert_to_raw): Delete function; no registers + are convertible now, so we use + generic_register_convertible_not instead. + (d10v_address_to_pointer, d10v_pointer_to_address): New gdbarch + methods. + (d10v_push_arguments, d10v_extract_return_value): Remove special + cases for code and data pointers. + (d10v_gdbarch_init): Set gdbarch_ptr_bit to 16, so that GDB and + the target agree on how large pointers are. Say that addresses + are 32 bits long. Register the address_to_pointer and + pointer_to_address conversion functions. Since no registers are + convertible now, register generic_register_convertible_not as the + gdbarch_register_convertible method instead of + d10v_register_convertible. Remove registrations for + d10v_register_convert_to_virtual, + d10v_register_convert_to_raw, gdbarch_d10v_make_daddr, + gdbarch_d10v_make_iaddr, gdbarch_d10v_daddr_p, + gdbarch_d10v_iaddr_p, gdbarch_d10v_convert_daddr_to_raw, and + gdbarch_d10v_convert_iaddr_to_raw. + * printcmd.c (print_scalar_formatted): If we are printing an address, remember that TARGET_ADDR_BIT is not always equal to TARGET_PTR_BIT. diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 2a3c18b5c5..e2e66bf387 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -332,47 +332,15 @@ d10v_register_virtual_size (int reg_nr) static struct type * d10v_register_virtual_type (int reg_nr) { - if (reg_nr >= A0_REGNUM + if (reg_nr == PC_REGNUM) + return builtin_type_void_func_ptr; + else if (reg_nr >= A0_REGNUM && reg_nr < (A0_REGNUM + NR_A_REGS)) return builtin_type_int64; - else if (reg_nr == PC_REGNUM - || reg_nr == SP_REGNUM) - return builtin_type_int32; else return builtin_type_int16; } -/* convert $pc and $sp to/from virtual addresses */ -static int -d10v_register_convertible (int nr) -{ - return ((nr) == PC_REGNUM || (nr) == SP_REGNUM); -} - -static void -d10v_register_convert_to_virtual (int regnum, struct type *type, char *from, - char *to) -{ - ULONGEST x = extract_unsigned_integer (from, REGISTER_RAW_SIZE (regnum)); - if (regnum == PC_REGNUM) - x = (x << 2) | IMEM_START; - else - x |= DMEM_START; - store_unsigned_integer (to, TYPE_LENGTH (type), x); -} - -static void -d10v_register_convert_to_raw (struct type *type, int regnum, char *from, - char *to) -{ - ULONGEST x = extract_unsigned_integer (from, TYPE_LENGTH (type)); - x &= 0x3ffff; - if (regnum == PC_REGNUM) - x >>= 2; - store_unsigned_integer (to, 2, x); -} - - static CORE_ADDR d10v_make_daddr (CORE_ADDR x) { @@ -410,6 +378,48 @@ d10v_convert_daddr_to_raw (CORE_ADDR x) return ((x) & 0xffff); } +static void +d10v_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr) +{ + /* Is it a code address? */ + if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC + || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD) + { +#if 0 + if (! d10v_iaddr_p (addr)) + { + warning_begin (); + fprintf_unfiltered (gdb_stderr, "address `"); + print_address_numeric (addr, 1, gdb_stderr); + fprintf_unfiltered (gdb_stderr, "' is not a code address\n"); + } +#endif + + store_unsigned_integer (buf, TYPE_LENGTH (type), + d10v_convert_iaddr_to_raw (addr)); + } + else + { + /* Strip off any upper segment bits. */ + store_unsigned_integer (buf, TYPE_LENGTH (type), + d10v_convert_daddr_to_raw (addr)); + } +} + +static CORE_ADDR +d10v_pointer_to_address (struct type *type, void *buf) +{ + CORE_ADDR addr = extract_address (buf, TYPE_LENGTH (type)); + + /* Is it a code address? */ + if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC + || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD) + return d10v_make_iaddr (addr); + else + return d10v_make_daddr (addr); +} + + /* Store the address of the place in which to copy the structure the subroutine will return. This is called from call_function. @@ -1011,39 +1021,6 @@ d10v_push_arguments (int nargs, value_ptr *args, CORE_ADDR sp, char *contents = VALUE_CONTENTS (arg); int len = TYPE_LENGTH (type); /* printf ("push: type=%d len=%d\n", type->code, len); */ - if (TYPE_CODE (type) == TYPE_CODE_PTR) - { - /* pointers require special handling - first convert and - then store */ - long val = extract_signed_integer (contents, len); - len = 2; - if (TYPE_TARGET_TYPE (type) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)) - { - /* function pointer */ - val = d10v_convert_iaddr_to_raw (val); - } - else if (d10v_iaddr_p (val)) - { - /* also function pointer! */ - val = d10v_convert_daddr_to_raw (val); - } - else - { - /* data pointer */ - val &= 0xFFFF; - } - if (regnum <= ARGN_REGNUM) - write_register (regnum++, val & 0xffff); - else - { - char ptr[2]; - /* arg will go onto stack */ - store_address (ptr, 2, val & 0xffff); - si = push_stack_item (si, ptr, 2); - } - } - else { int aligned_regnum = (regnum + 1) & ~1; if (len <= 2 && regnum <= ARGN_REGNUM) @@ -1098,25 +1075,6 @@ d10v_extract_return_value (struct type *type, char regbuf[REGISTER_BYTES], { int len; /* printf("RET: TYPE=%d len=%d r%d=0x%x\n",type->code, TYPE_LENGTH (type), RET1_REGNUM - R0_REGNUM, (int) extract_unsigned_integer (regbuf + REGISTER_BYTE(RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM))); */ - if (TYPE_CODE (type) == TYPE_CODE_PTR - && TYPE_TARGET_TYPE (type) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)) - { - /* pointer to function */ - int num; - short snum; - snum = extract_address (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM)); - store_address (valbuf, 4, d10v_make_iaddr (snum)); - } - else if (TYPE_CODE (type) == TYPE_CODE_PTR) - { - /* pointer to data */ - int num; - short snum; - snum = extract_address (regbuf + REGISTER_BYTE (RET1_REGNUM), REGISTER_RAW_SIZE (RET1_REGNUM)); - store_address (valbuf, 4, d10v_make_daddr (snum)); - } - else { len = TYPE_LENGTH (type); if (len == 1) @@ -1516,7 +1474,10 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_max_register_virtual_size (gdbarch, 8); set_gdbarch_register_virtual_type (gdbarch, d10v_register_virtual_type); - set_gdbarch_ptr_bit (gdbarch, 4 * TARGET_CHAR_BIT); + set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT); + set_gdbarch_addr_bit (gdbarch, 32); + set_gdbarch_address_to_pointer (gdbarch, d10v_address_to_pointer); + set_gdbarch_pointer_to_address (gdbarch, d10v_pointer_to_address); set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT); set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); @@ -1558,22 +1519,11 @@ d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_get_saved_register (gdbarch, generic_get_saved_register); set_gdbarch_fix_call_dummy (gdbarch, generic_fix_call_dummy); - set_gdbarch_register_convertible (gdbarch, d10v_register_convertible); - set_gdbarch_register_convert_to_virtual (gdbarch, d10v_register_convert_to_virtual); - set_gdbarch_register_convert_to_raw (gdbarch, d10v_register_convert_to_raw); - set_gdbarch_extract_return_value (gdbarch, d10v_extract_return_value); set_gdbarch_push_arguments (gdbarch, d10v_push_arguments); set_gdbarch_push_dummy_frame (gdbarch, generic_push_dummy_frame); set_gdbarch_push_return_address (gdbarch, d10v_push_return_address); - set_gdbarch_d10v_make_daddr (gdbarch, d10v_make_daddr); - set_gdbarch_d10v_make_iaddr (gdbarch, d10v_make_iaddr); - set_gdbarch_d10v_daddr_p (gdbarch, d10v_daddr_p); - set_gdbarch_d10v_iaddr_p (gdbarch, d10v_iaddr_p); - set_gdbarch_d10v_convert_daddr_to_raw (gdbarch, d10v_convert_daddr_to_raw); - set_gdbarch_d10v_convert_iaddr_to_raw (gdbarch, d10v_convert_iaddr_to_raw); - set_gdbarch_store_struct_return (gdbarch, d10v_store_struct_return); set_gdbarch_store_return_value (gdbarch, d10v_store_return_value); set_gdbarch_extract_struct_value_address (gdbarch, d10v_extract_struct_value_address); diff --git a/gdb/findvar.c b/gdb/findvar.c index c5bf50755d..8faf2f18dd 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -729,11 +729,6 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) CHECK_TYPEDEF (type); len = TYPE_LENGTH (type); - /* Pointers on D10V are really only 16 bits, - but we lie to gdb elsewhere... */ - if (GDB_TARGET_IS_D10V && TYPE_CODE (type) == TYPE_CODE_PTR) - len = 2; - VALUE_REGNO (v) = regnum; num_storage_locs = (len > REGISTER_VIRTUAL_SIZE (regnum) ? @@ -933,24 +928,6 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) memcpy (VALUE_CONTENTS_RAW (v), raw_buffer + VALUE_OFFSET (v), len); } - if (GDB_TARGET_IS_D10V - && TYPE_CODE (type) == TYPE_CODE_PTR) - { - unsigned long num; - unsigned short snum; - - snum = (unsigned short) - extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2); - - if (TYPE_TARGET_TYPE (type) /* pointer to function */ - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)) - num = D10V_MAKE_IADDR (snum); - else /* pointer to data */ - num = D10V_MAKE_DADDR (snum); - - store_address (VALUE_CONTENTS_RAW (v), 4, num); - } - return v; } diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index bac36c2948..40da7a4d22 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -211,12 +211,6 @@ struct gdbarch gdbarch_push_dummy_frame_ftype *push_dummy_frame; gdbarch_push_return_address_ftype *push_return_address; gdbarch_pop_frame_ftype *pop_frame; - gdbarch_d10v_make_daddr_ftype *d10v_make_daddr; - gdbarch_d10v_make_iaddr_ftype *d10v_make_iaddr; - gdbarch_d10v_daddr_p_ftype *d10v_daddr_p; - gdbarch_d10v_iaddr_p_ftype *d10v_iaddr_p; - gdbarch_d10v_convert_daddr_to_raw_ftype *d10v_convert_daddr_to_raw; - gdbarch_d10v_convert_iaddr_to_raw_ftype *d10v_convert_iaddr_to_raw; gdbarch_store_struct_return_ftype *store_struct_return; gdbarch_store_return_value_ftype *store_return_value; gdbarch_extract_struct_value_address_ftype *extract_struct_value_address; @@ -386,12 +380,6 @@ struct gdbarch startup_gdbarch = 0, 0, 0, - 0, - 0, - 0, - 0, - 0, - 0, /* startup_gdbarch() */ }; @@ -695,12 +683,6 @@ verify_gdbarch (struct gdbarch *gdbarch) && (gdbarch->pop_frame == 0)) internal_error (__FILE__, __LINE__, "gdbarch: verify_gdbarch: pop_frame invalid"); - /* Skip verify of d10v_make_daddr, invalid_p == 0 */ - /* Skip verify of d10v_make_iaddr, invalid_p == 0 */ - /* Skip verify of d10v_daddr_p, invalid_p == 0 */ - /* Skip verify of d10v_iaddr_p, invalid_p == 0 */ - /* Skip verify of d10v_convert_daddr_to_raw, invalid_p == 0 */ - /* Skip verify of d10v_convert_iaddr_to_raw, invalid_p == 0 */ if ((GDB_MULTI_ARCH >= 2) && (gdbarch->store_struct_return == 0)) internal_error (__FILE__, __LINE__, @@ -1259,42 +1241,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "POP_FRAME(-)", XSTRING (POP_FRAME (-))); #endif -#ifdef D10V_MAKE_DADDR - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "D10V_MAKE_DADDR(x)", - XSTRING (D10V_MAKE_DADDR (x))); -#endif -#ifdef D10V_MAKE_IADDR - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "D10V_MAKE_IADDR(x)", - XSTRING (D10V_MAKE_IADDR (x))); -#endif -#ifdef D10V_DADDR_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "D10V_DADDR_P(x)", - XSTRING (D10V_DADDR_P (x))); -#endif -#ifdef D10V_IADDR_P - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "D10V_IADDR_P(x)", - XSTRING (D10V_IADDR_P (x))); -#endif -#ifdef D10V_CONVERT_DADDR_TO_RAW - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "D10V_CONVERT_DADDR_TO_RAW(x)", - XSTRING (D10V_CONVERT_DADDR_TO_RAW (x))); -#endif -#ifdef D10V_CONVERT_IADDR_TO_RAW - fprintf_unfiltered (file, - "gdbarch_dump: %s # %s\n", - "D10V_CONVERT_IADDR_TO_RAW(x)", - XSTRING (D10V_CONVERT_IADDR_TO_RAW (x))); -#endif #if defined (STORE_STRUCT_RETURN) && GDB_MULTI_ARCH /* Macro might contain `[{}]' when not multi-arch */ fprintf_unfiltered (file, @@ -1999,48 +1945,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) (long) current_gdbarch->pop_frame /*POP_FRAME ()*/); #endif -#ifdef D10V_MAKE_DADDR - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: D10V_MAKE_DADDR = 0x%08lx\n", - (long) current_gdbarch->d10v_make_daddr - /*D10V_MAKE_DADDR ()*/); -#endif -#ifdef D10V_MAKE_IADDR - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: D10V_MAKE_IADDR = 0x%08lx\n", - (long) current_gdbarch->d10v_make_iaddr - /*D10V_MAKE_IADDR ()*/); -#endif -#ifdef D10V_DADDR_P - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: D10V_DADDR_P = 0x%08lx\n", - (long) current_gdbarch->d10v_daddr_p - /*D10V_DADDR_P ()*/); -#endif -#ifdef D10V_IADDR_P - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: D10V_IADDR_P = 0x%08lx\n", - (long) current_gdbarch->d10v_iaddr_p - /*D10V_IADDR_P ()*/); -#endif -#ifdef D10V_CONVERT_DADDR_TO_RAW - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: D10V_CONVERT_DADDR_TO_RAW = 0x%08lx\n", - (long) current_gdbarch->d10v_convert_daddr_to_raw - /*D10V_CONVERT_DADDR_TO_RAW ()*/); -#endif -#ifdef D10V_CONVERT_IADDR_TO_RAW - if (GDB_MULTI_ARCH) - fprintf_unfiltered (file, - "gdbarch_dump: D10V_CONVERT_IADDR_TO_RAW = 0x%08lx\n", - (long) current_gdbarch->d10v_convert_iaddr_to_raw - /*D10V_CONVERT_IADDR_TO_RAW ()*/); -#endif #ifdef STORE_STRUCT_RETURN if (GDB_MULTI_ARCH) fprintf_unfiltered (file, @@ -3708,114 +3612,6 @@ set_gdbarch_pop_frame (struct gdbarch *gdbarch, gdbarch->pop_frame = pop_frame; } -CORE_ADDR -gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, CORE_ADDR x) -{ - if (gdbarch->d10v_make_daddr == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_d10v_make_daddr invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_make_daddr called\n"); - return gdbarch->d10v_make_daddr (x); -} - -void -set_gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, - gdbarch_d10v_make_daddr_ftype d10v_make_daddr) -{ - gdbarch->d10v_make_daddr = d10v_make_daddr; -} - -CORE_ADDR -gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, CORE_ADDR x) -{ - if (gdbarch->d10v_make_iaddr == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_d10v_make_iaddr invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_make_iaddr called\n"); - return gdbarch->d10v_make_iaddr (x); -} - -void -set_gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, - gdbarch_d10v_make_iaddr_ftype d10v_make_iaddr) -{ - gdbarch->d10v_make_iaddr = d10v_make_iaddr; -} - -int -gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, CORE_ADDR x) -{ - if (gdbarch->d10v_daddr_p == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_d10v_daddr_p invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_daddr_p called\n"); - return gdbarch->d10v_daddr_p (x); -} - -void -set_gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, - gdbarch_d10v_daddr_p_ftype d10v_daddr_p) -{ - gdbarch->d10v_daddr_p = d10v_daddr_p; -} - -int -gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, CORE_ADDR x) -{ - if (gdbarch->d10v_iaddr_p == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_d10v_iaddr_p invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_iaddr_p called\n"); - return gdbarch->d10v_iaddr_p (x); -} - -void -set_gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, - gdbarch_d10v_iaddr_p_ftype d10v_iaddr_p) -{ - gdbarch->d10v_iaddr_p = d10v_iaddr_p; -} - -CORE_ADDR -gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x) -{ - if (gdbarch->d10v_convert_daddr_to_raw == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_d10v_convert_daddr_to_raw invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_convert_daddr_to_raw called\n"); - return gdbarch->d10v_convert_daddr_to_raw (x); -} - -void -set_gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, - gdbarch_d10v_convert_daddr_to_raw_ftype d10v_convert_daddr_to_raw) -{ - gdbarch->d10v_convert_daddr_to_raw = d10v_convert_daddr_to_raw; -} - -CORE_ADDR -gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x) -{ - if (gdbarch->d10v_convert_iaddr_to_raw == 0) - internal_error (__FILE__, __LINE__, - "gdbarch: gdbarch_d10v_convert_iaddr_to_raw invalid"); - if (gdbarch_debug >= 2) - fprintf_unfiltered (gdb_stdlog, "gdbarch_d10v_convert_iaddr_to_raw called\n"); - return gdbarch->d10v_convert_iaddr_to_raw (x); -} - -void -set_gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, - gdbarch_d10v_convert_iaddr_to_raw_ftype d10v_convert_iaddr_to_raw) -{ - gdbarch->d10v_convert_iaddr_to_raw = d10v_convert_iaddr_to_raw; -} - void gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp) { diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 0ace44bf9c..287ec83e48 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1293,110 +1293,6 @@ extern void set_gdbarch_pop_frame (struct gdbarch *gdbarch, gdbarch_pop_frame_ft #endif #endif -/* I wish that these would just go away.... */ - -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (D10V_MAKE_DADDR) -#define D10V_MAKE_DADDR(x) (internal_error (__FILE__, __LINE__, "D10V_MAKE_DADDR"), 0) -#endif - -typedef CORE_ADDR (gdbarch_d10v_make_daddr_ftype) (CORE_ADDR x); -extern CORE_ADDR gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, CORE_ADDR x); -extern void set_gdbarch_d10v_make_daddr (struct gdbarch *gdbarch, gdbarch_d10v_make_daddr_ftype *d10v_make_daddr); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (D10V_MAKE_DADDR) -#error "Non multi-arch definition of D10V_MAKE_DADDR" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_MAKE_DADDR) -#define D10V_MAKE_DADDR(x) (gdbarch_d10v_make_daddr (current_gdbarch, x)) -#endif -#endif - -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (D10V_MAKE_IADDR) -#define D10V_MAKE_IADDR(x) (internal_error (__FILE__, __LINE__, "D10V_MAKE_IADDR"), 0) -#endif - -typedef CORE_ADDR (gdbarch_d10v_make_iaddr_ftype) (CORE_ADDR x); -extern CORE_ADDR gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, CORE_ADDR x); -extern void set_gdbarch_d10v_make_iaddr (struct gdbarch *gdbarch, gdbarch_d10v_make_iaddr_ftype *d10v_make_iaddr); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (D10V_MAKE_IADDR) -#error "Non multi-arch definition of D10V_MAKE_IADDR" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_MAKE_IADDR) -#define D10V_MAKE_IADDR(x) (gdbarch_d10v_make_iaddr (current_gdbarch, x)) -#endif -#endif - -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (D10V_DADDR_P) -#define D10V_DADDR_P(x) (internal_error (__FILE__, __LINE__, "D10V_DADDR_P"), 0) -#endif - -typedef int (gdbarch_d10v_daddr_p_ftype) (CORE_ADDR x); -extern int gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, CORE_ADDR x); -extern void set_gdbarch_d10v_daddr_p (struct gdbarch *gdbarch, gdbarch_d10v_daddr_p_ftype *d10v_daddr_p); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (D10V_DADDR_P) -#error "Non multi-arch definition of D10V_DADDR_P" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_DADDR_P) -#define D10V_DADDR_P(x) (gdbarch_d10v_daddr_p (current_gdbarch, x)) -#endif -#endif - -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (D10V_IADDR_P) -#define D10V_IADDR_P(x) (internal_error (__FILE__, __LINE__, "D10V_IADDR_P"), 0) -#endif - -typedef int (gdbarch_d10v_iaddr_p_ftype) (CORE_ADDR x); -extern int gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, CORE_ADDR x); -extern void set_gdbarch_d10v_iaddr_p (struct gdbarch *gdbarch, gdbarch_d10v_iaddr_p_ftype *d10v_iaddr_p); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (D10V_IADDR_P) -#error "Non multi-arch definition of D10V_IADDR_P" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_IADDR_P) -#define D10V_IADDR_P(x) (gdbarch_d10v_iaddr_p (current_gdbarch, x)) -#endif -#endif - -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (D10V_CONVERT_DADDR_TO_RAW) -#define D10V_CONVERT_DADDR_TO_RAW(x) (internal_error (__FILE__, __LINE__, "D10V_CONVERT_DADDR_TO_RAW"), 0) -#endif - -typedef CORE_ADDR (gdbarch_d10v_convert_daddr_to_raw_ftype) (CORE_ADDR x); -extern CORE_ADDR gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x); -extern void set_gdbarch_d10v_convert_daddr_to_raw (struct gdbarch *gdbarch, gdbarch_d10v_convert_daddr_to_raw_ftype *d10v_convert_daddr_to_raw); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (D10V_CONVERT_DADDR_TO_RAW) -#error "Non multi-arch definition of D10V_CONVERT_DADDR_TO_RAW" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_CONVERT_DADDR_TO_RAW) -#define D10V_CONVERT_DADDR_TO_RAW(x) (gdbarch_d10v_convert_daddr_to_raw (current_gdbarch, x)) -#endif -#endif - -/* Default (function) for non- multi-arch platforms. */ -#if (!GDB_MULTI_ARCH) && !defined (D10V_CONVERT_IADDR_TO_RAW) -#define D10V_CONVERT_IADDR_TO_RAW(x) (internal_error (__FILE__, __LINE__, "D10V_CONVERT_IADDR_TO_RAW"), 0) -#endif - -typedef CORE_ADDR (gdbarch_d10v_convert_iaddr_to_raw_ftype) (CORE_ADDR x); -extern CORE_ADDR gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, CORE_ADDR x); -extern void set_gdbarch_d10v_convert_iaddr_to_raw (struct gdbarch *gdbarch, gdbarch_d10v_convert_iaddr_to_raw_ftype *d10v_convert_iaddr_to_raw); -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (D10V_CONVERT_IADDR_TO_RAW) -#error "Non multi-arch definition of D10V_CONVERT_IADDR_TO_RAW" -#endif -#if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (D10V_CONVERT_IADDR_TO_RAW) -#define D10V_CONVERT_IADDR_TO_RAW(x) (gdbarch_d10v_convert_iaddr_to_raw (current_gdbarch, x)) -#endif -#endif - typedef void (gdbarch_store_struct_return_ftype) (CORE_ADDR addr, CORE_ADDR sp); extern void gdbarch_store_struct_return (struct gdbarch *gdbarch, CORE_ADDR addr, CORE_ADDR sp); extern void set_gdbarch_store_struct_return (struct gdbarch *gdbarch, gdbarch_store_struct_return_ftype *store_struct_return); @@ -2293,12 +2189,6 @@ extern disassemble_info tm_print_insn_info; -/* Explicit test for D10V architecture. - USE of these macro's is *STRONGLY* discouraged. */ - -#define GDB_TARGET_IS_D10V (TARGET_ARCHITECTURE->arch == bfd_arch_d10v) - - /* Set the dynamic target-system-dependent parameters (architecture, byte-order, ...) using information found in the BFD */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index fa206104da..964e16f25c 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -476,14 +476,6 @@ f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0 f:1:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0 f:2:POP_FRAME:void:pop_frame:void:-:::0 # -# I wish that these would just go away.... -f:2:D10V_MAKE_DADDR:CORE_ADDR:d10v_make_daddr:CORE_ADDR x:x:::0::0 -f:2:D10V_MAKE_IADDR:CORE_ADDR:d10v_make_iaddr:CORE_ADDR x:x:::0::0 -f:2:D10V_DADDR_P:int:d10v_daddr_p:CORE_ADDR x:x:::0::0 -f:2:D10V_IADDR_P:int:d10v_iaddr_p:CORE_ADDR x:x:::0::0 -f:2:D10V_CONVERT_DADDR_TO_RAW:CORE_ADDR:d10v_convert_daddr_to_raw:CORE_ADDR x:x:::0::0 -f:2:D10V_CONVERT_IADDR_TO_RAW:CORE_ADDR:d10v_convert_iaddr_to_raw:CORE_ADDR x:x:::0::0 -# f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0 f:2:STORE_RETURN_VALUE:void:store_return_value:struct type *type, char *valbuf:type, valbuf:::0 F:2:EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:extract_struct_value_address:char *regbuf:regbuf:::0 @@ -1073,12 +1065,6 @@ extern disassemble_info tm_print_insn_info; -/* Explicit test for D10V architecture. - USE of these macro's is *STRONGLY* discouraged. */ - -#define GDB_TARGET_IS_D10V (TARGET_ARCHITECTURE->arch == bfd_arch_d10v) - - /* Set the dynamic target-system-dependent parameters (architecture, byte-order, ...) using information found in the BFD */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 63b7464947..b0d8d72157 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1946,9 +1946,6 @@ print_frame_args (struct symbol *func, struct frame_info *fi, int num, if (val) { - if (GDB_TARGET_IS_D10V - && SYMBOL_CLASS (sym) == LOC_REGPARM && TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_PTR) - TYPE_LENGTH (VALUE_TYPE (val)) = 2; #ifdef UI_OUT val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, VALUE_ADDRESS (val), diff --git a/gdb/valops.c b/gdb/valops.c index dc987c4aba..e1a4bc53d0 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -474,30 +474,7 @@ value_at (struct type *type, CORE_ADDR addr, asection *sect) val = allocate_value (type); - if (GDB_TARGET_IS_D10V - && TYPE_CODE (type) == TYPE_CODE_PTR - && TYPE_TARGET_TYPE (type) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)) - { - /* pointer to function */ - unsigned long num; - unsigned short snum; - snum = read_memory_unsigned_integer (addr, 2); - num = D10V_MAKE_IADDR (snum); - store_address (VALUE_CONTENTS_RAW (val), 4, num); - } - else if (GDB_TARGET_IS_D10V - && TYPE_CODE (type) == TYPE_CODE_PTR) - { - /* pointer to data */ - unsigned long num; - unsigned short snum; - snum = read_memory_unsigned_integer (addr, 2); - num = D10V_MAKE_DADDR (snum); - store_address (VALUE_CONTENTS_RAW (val), 4, num); - } - else - read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), TYPE_LENGTH (type)); + read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), TYPE_LENGTH (type)); VALUE_LVAL (val) = lval_memory; VALUE_ADDRESS (val) = addr; @@ -545,29 +522,7 @@ value_fetch_lazy (register value_ptr val) int length = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (val)); struct type *type = VALUE_TYPE (val); - if (GDB_TARGET_IS_D10V - && TYPE_CODE (type) == TYPE_CODE_PTR - && TYPE_TARGET_TYPE (type) - && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)) - { - /* pointer to function */ - unsigned long num; - unsigned short snum; - snum = read_memory_unsigned_integer (addr, 2); - num = D10V_MAKE_IADDR (snum); - store_address (VALUE_CONTENTS_RAW (val), 4, num); - } - else if (GDB_TARGET_IS_D10V - && TYPE_CODE (type) == TYPE_CODE_PTR) - { - /* pointer to data */ - unsigned long num; - unsigned short snum; - snum = read_memory_unsigned_integer (addr, 2); - num = D10V_MAKE_DADDR (snum); - store_address (VALUE_CONTENTS_RAW (val), 4, num); - } - else if (length) + if (length) read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), length); VALUE_LAZY (val) = 0; diff --git a/gdb/values.c b/gdb/values.c index 0d18c31cf4..5f7468ce5c 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -650,9 +650,6 @@ unpack_long (struct type *type, char *valaddr) case TYPE_CODE_REF: /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure whether we want this to be true eventually. */ - if (GDB_TARGET_IS_D10V - && len == 2) - return D10V_MAKE_DADDR (extract_address (valaddr, len)); return extract_typed_address (valaddr, type); case TYPE_CODE_MEMBER: -- 2.34.1