From 4c6b5505c95f63853ce942030569d004e99dd8a2 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 31 May 2007 20:57:41 +0000 Subject: [PATCH] 2007-05-31 Markus Deuling * xtensa-tdep.c (XTENSA_IS_ENTRY, extract_call_winsize) (xtensa_register_write_masked, xtensa_register_read_masked) (xtensa_extract_return_value, xtensa_store_return_value (xtensa_push_dummy_call, xtensa_breakpoint_from_pc): Replace TARGET_BYTE_ORDER by gdbarch_byte_order. * sh-tdep.c (sh_breakpoint_from_pc, gdb_print_insn_sh) (sh_justify_value_in_reg, sh_next_flt_argreg, sh_push_dummy_call_fpu) (sh_extract_return_value_fpu, sh_store_return_value_fpu): Likewise. * sh64-tdep.c (sh64_breakpoint_from_pc, gdb_print_insn_sh64) (sh64_push_dummy_call, sh64_extract_return_value) (sh64_store_return_value, sh64_register_convert_to_virtual) (sh64_register_convert_to_raw, sh64_pseudo_register_read) (sh64_pseudo_register_write, sh64_do_fp_register) (sh64_frame_prev_register): Likewise. * score-tdep.c (score_print_insn, score_breakpoint_from_pc) (score_return_value, score_push_dummy_call, score_fetch_inst): Likewise. * rs6000-tdep.c (rs6000_breakpoint_from_pc, rs6000_push_dummy_call) (e500_move_ev_register,gdb_print_insn_powerpc): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * ppc-linux-nat.c (store_register): Likewise. * nto-tdep.c (nto_find_and_open_solib) (nto_init_solib_absolute_prefix): Likewise. * mips-tdep.c (mips_pseudo_register_read, mips_pseudo_register_write) (mips_convert_register_p, mips_eabi_push_dummy_call) (mips_n32n64_push_dummy_call, mips_n32n64_return_value) (mips_o32_push_dummy_call, mips_o32_return_value) (mips_o64_push_dummy_call, mips_o64_return_value, mips_o64_return_value) (mips_read_fp_register_single, mips_read_fp_register_double) (mips_print_register, print_gp_register_row, gdb_print_insn_mips) (mips_breakpoint_from_pc): Likewise. * mipsnbsd-tdep.c (mipsnbsd_sigtramp_offset): Likewise. * mips-linux-tdep.c (mips64_supply_fpregset, mips64_fill_fpregset) (mips_linux_o32_sigframe_init): Likewise. * m32r-tdep.c (m32r_memory_insert_breakpoint) (m32r_memory_remove_breakpoint, m32r_breakpoint_from_pc): Likewise. * libunwind-frame.c (libunwind_frame_cache, libunwind_frame_sniffer) (libunwind_sigtramp_frame_sniffer, libunwind_get_reg_special): Likewise. * iq2000-tdep.c (iq2000_breakpoint_from_pc): Likewise. * coffread.c (process_coff_symbol): Likewise. * arm-tdep.c (convert_from_extended, convert_to_extended) (gdb_print_insn_arm): Likewise. --- gdb/ChangeLog | 44 ++++++++++++++++++++++++ gdb/arm-tdep.c | 6 ++-- gdb/coffread.c | 2 +- gdb/iq2000-tdep.c | 3 +- gdb/libunwind-frame.c | 12 ++++--- gdb/m32r-tdep.c | 6 ++-- gdb/mips-linux-tdep.c | 10 +++--- gdb/mips-tdep.c | 80 ++++++++++++++++++++++++++----------------- gdb/mipsnbsd-tdep.c | 5 +-- gdb/nto-tdep.c | 6 ++-- gdb/ppc-linux-nat.c | 4 +-- gdb/remote-m32r-sdi.c | 16 ++++----- gdb/rs6000-tdep.c | 9 ++--- gdb/score-tdep.c | 15 ++++---- gdb/sh-tdep.c | 14 ++++---- gdb/sh64-tdep.c | 29 ++++++++-------- gdb/xtensa-tdep.c | 23 +++++++------ 17 files changed, 180 insertions(+), 104 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7b8f33b8c96..d09eb4d7f05 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,47 @@ +2007-05-31 Markus Deuling + + * xtensa-tdep.c (XTENSA_IS_ENTRY, extract_call_winsize) + (xtensa_register_write_masked, xtensa_register_read_masked) + (xtensa_extract_return_value, xtensa_store_return_value + (xtensa_push_dummy_call, xtensa_breakpoint_from_pc): Replace + TARGET_BYTE_ORDER by gdbarch_byte_order. + * sh-tdep.c (sh_breakpoint_from_pc, gdb_print_insn_sh) + (sh_justify_value_in_reg, sh_next_flt_argreg, sh_push_dummy_call_fpu) + (sh_extract_return_value_fpu, sh_store_return_value_fpu): Likewise. + * sh64-tdep.c (sh64_breakpoint_from_pc, gdb_print_insn_sh64) + (sh64_push_dummy_call, sh64_extract_return_value) + (sh64_store_return_value, sh64_register_convert_to_virtual) + (sh64_register_convert_to_raw, sh64_pseudo_register_read) + (sh64_pseudo_register_write, sh64_do_fp_register) + (sh64_frame_prev_register): Likewise. + * score-tdep.c (score_print_insn, score_breakpoint_from_pc) + (score_return_value, score_push_dummy_call, score_fetch_inst): Likewise. + * rs6000-tdep.c (rs6000_breakpoint_from_pc, rs6000_push_dummy_call) + (e500_move_ev_register,gdb_print_insn_powerpc): Likewise. + * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. + * ppc-linux-nat.c (store_register): Likewise. + * nto-tdep.c (nto_find_and_open_solib) + (nto_init_solib_absolute_prefix): Likewise. + * mips-tdep.c (mips_pseudo_register_read, mips_pseudo_register_write) + (mips_convert_register_p, mips_eabi_push_dummy_call) + (mips_n32n64_push_dummy_call, mips_n32n64_return_value) + (mips_o32_push_dummy_call, mips_o32_return_value) + (mips_o64_push_dummy_call, mips_o64_return_value, mips_o64_return_value) + (mips_read_fp_register_single, mips_read_fp_register_double) + (mips_print_register, print_gp_register_row, gdb_print_insn_mips) + (mips_breakpoint_from_pc): Likewise. + * mipsnbsd-tdep.c (mipsnbsd_sigtramp_offset): Likewise. + * mips-linux-tdep.c (mips64_supply_fpregset, mips64_fill_fpregset) + (mips_linux_o32_sigframe_init): Likewise. + * m32r-tdep.c (m32r_memory_insert_breakpoint) + (m32r_memory_remove_breakpoint, m32r_breakpoint_from_pc): Likewise. + * libunwind-frame.c (libunwind_frame_cache, libunwind_frame_sniffer) + (libunwind_sigtramp_frame_sniffer, libunwind_get_reg_special): Likewise. + * iq2000-tdep.c (iq2000_breakpoint_from_pc): Likewise. + * coffread.c (process_coff_symbol): Likewise. + * arm-tdep.c (convert_from_extended, convert_to_extended) + (gdb_print_insn_arm): Likewise. + 2007-05-31 Markus Deuling * gdbarch.sh (NUM_REGS): Replace by gdbarch_num_regs. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 38d50155b4b..571241857cb 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -1470,7 +1470,7 @@ convert_from_extended (const struct floatformat *fmt, const void *ptr, void *dbl) { DOUBLEST d; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) floatformat_to_doublest (&floatformat_arm_ext_big, ptr, &d); else floatformat_to_doublest (&floatformat_arm_ext_littlebyte_bigword, @@ -1483,7 +1483,7 @@ convert_to_extended (const struct floatformat *fmt, void *dbl, const void *ptr) { DOUBLEST d; floatformat_to_doublest (fmt, ptr, &d); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) floatformat_from_doublest (&floatformat_arm_ext_big, &d, dbl); else floatformat_from_doublest (&floatformat_arm_ext_littlebyte_bigword, @@ -1954,7 +1954,7 @@ gdb_print_insn_arm (bfd_vma memaddr, disassemble_info *info) else info->symbols = NULL; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) return print_insn_big_arm (memaddr, info); else return print_insn_little_arm (memaddr, info); diff --git a/gdb/coffread.c b/gdb/coffread.c index d01bbc6ee72..62c221e105c 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1559,7 +1559,7 @@ process_coff_symbol (struct coff_symbol *cs, SYMBOL_CLASS (sym) = LOC_ARG; add_symbol_to_list (sym, &local_symbols); #if !defined (BELIEVE_PCC_PROMOTION) - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { /* If PCC says a parameter is a short or a char, aligned on an int boundary, realign it to the diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c index dd3ff80e2d6..cc184856c2a 100644 --- a/gdb/iq2000-tdep.c +++ b/gdb/iq2000-tdep.c @@ -501,7 +501,8 @@ iq2000_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) (long) *pcptr); *lenptr = 4; - return (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) ? big_breakpoint + return (gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG) ? big_breakpoint : little_breakpoint; } diff --git a/gdb/libunwind-frame.c b/gdb/libunwind-frame.c index 0b928535fcc..f6f62b0f4b4 100644 --- a/gdb/libunwind-frame.c +++ b/gdb/libunwind-frame.c @@ -163,7 +163,8 @@ libunwind_frame_cache (struct frame_info *next_frame, void **this_cache) descr = libunwind_descr (get_frame_arch (next_frame)); acc = descr->accessors; as = unw_create_addr_space_p (acc, - TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? __BIG_ENDIAN : __LITTLE_ENDIAN); @@ -215,7 +216,8 @@ libunwind_frame_sniffer (struct frame_info *next_frame) descr = libunwind_descr (get_frame_arch (next_frame)); acc = descr->accessors; as = unw_create_addr_space_p (acc, - TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? __BIG_ENDIAN : __LITTLE_ENDIAN); @@ -372,7 +374,8 @@ libunwind_sigtramp_frame_sniffer (struct frame_info *next_frame) descr = libunwind_descr (get_frame_arch (next_frame)); acc = descr->accessors; as = unw_create_addr_space_p (acc, - TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? __BIG_ENDIAN : __LITTLE_ENDIAN); @@ -412,7 +415,8 @@ libunwind_get_reg_special (struct gdbarch *gdbarch, struct regcache *regcache, descr = libunwind_descr (gdbarch); acc = descr->special_accessors; as = unw_create_addr_space_p (acc, - TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? __BIG_ENDIAN : __LITTLE_ENDIAN); diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index 3766c140739..755f7075b10 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -97,7 +97,7 @@ m32r_memory_insert_breakpoint (struct bp_target_info *bp_tgt) bp_tgt->placed_size = bp_tgt->shadow_len = 4; /* Determine appropriate breakpoint contents and size for this address. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if ((addr & 3) == 0) { @@ -151,7 +151,7 @@ m32r_memory_remove_breakpoint (struct bp_target_info *bp_tgt) buf[3] = contents_cache[3]; /* Remove parallel bit. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if ((buf[0] & 0x80) == 0 && (buf[2] & 0x80) != 0) buf[2] &= 0x7f; @@ -175,7 +175,7 @@ m32r_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) gdb_byte *bp; /* Determine appropriate breakpoint. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if ((*pcptr & 3) == 0) { diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 670d224b8da..1c612464b82 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -387,7 +387,8 @@ mips64_supply_fpregset (struct regcache *regcache, for (regi = 0; regi < 32; regi++) { const gdb_byte *reg_ptr = (const gdb_byte *)(*fpregsetp + (regi & ~1)); - if ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) != (regi & 1)) + if ((gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG) != (regi & 1)) reg_ptr += 4; regcache_raw_supply (regcache, FP0_REGNUM + regi, reg_ptr); } @@ -425,7 +426,8 @@ mips64_fill_fpregset (const struct regcache *regcache, int regi = regno - FP0_REGNUM; to = (gdb_byte *) (*fpregsetp + (regi & ~1)); - if ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) != (regi & 1)) + if ((gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG) != (regi & 1)) to += 4; regcache_raw_collect (regcache, regno, to); } @@ -825,7 +827,7 @@ mips_linux_o32_sigframe_init (const struct tramp_frame *self, per-frame basis, but right now we don't; the kernel saves eight bytes but we only want four. Use regs_base to access any 64-bit fields. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) regs_base = sigcontext_base + 4; else regs_base = sigcontext_base; @@ -852,7 +854,7 @@ mips_linux_o32_sigframe_init (const struct tramp_frame *self, layout, since we can't tell, and it's much more common. Which bits are the "high" bits depends on endianness. */ for (ireg = 0; ireg < 32; ireg++) - if ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) != (ireg & 1)) + if ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) != (ireg & 1)) trad_frame_set_reg_addr (this_cache, ireg + regs->fp0 + gdbarch_num_regs (current_gdbarch), diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 974e42a4b0b..a0907707272 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -573,7 +573,7 @@ mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, register_size (gdbarch, cookednum)) { if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p - || TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + || gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) regcache_raw_read_part (regcache, rawnum, 0, 4, buf); else regcache_raw_read_part (regcache, rawnum, 4, 4, buf); @@ -596,7 +596,7 @@ mips_pseudo_register_write (struct gdbarch *gdbarch, register_size (gdbarch, cookednum)) { if (gdbarch_tdep (gdbarch)->mips64_transfers_32bit_regs_p - || TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + || gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) regcache_raw_write_part (regcache, rawnum, 0, 4, buf); else regcache_raw_write_part (regcache, rawnum, 4, 4, buf); @@ -641,7 +641,7 @@ set_mips64_transfers_32bit_regs (char *args, int from_tty, static int mips_convert_register_p (int regnum, struct type *type) { - return (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + return (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG && register_size (current_gdbarch, regnum) == 4 && (regnum % gdbarch_num_regs (current_gdbarch)) >= mips_regnum (current_gdbarch)->fp0 @@ -2512,7 +2512,8 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, making the ABI determination. */ if (len == 8 && mips_abi (gdbarch) == MIPS_ABI_EABI32) { - int low_offset = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? 4 : 0; + int low_offset = gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? 4 : 0; unsigned long regval; /* Write the low word of the double to the even register(s). */ @@ -2576,7 +2577,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int longword_offset = 0; CORE_ADDR addr; stack_used_p = 1; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if (regsize == 8 && (typecode == TYPE_CODE_INT @@ -2797,7 +2798,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int longword_offset = 0; CORE_ADDR addr; stack_used_p = 1; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if ((typecode == TYPE_CODE_INT || typecode == TYPE_CODE_PTR @@ -2850,7 +2851,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, It does not seem to be necessary to do the same for integral types. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG && partial_len < MIPS64_REGSIZE && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) @@ -2911,11 +2912,13 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + mips_regnum (current_gdbarch)->fp0, - 8, TARGET_BYTE_ORDER, readbuf, writebuf, 0); + 8, gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, 0); mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + mips_regnum (current_gdbarch)->fp0 + 2, - 8, TARGET_BYTE_ORDER, readbuf ? readbuf + 8 : readbuf, + 8, gdbarch_byte_order (current_gdbarch), + readbuf ? readbuf + 8 : readbuf, writebuf ? writebuf + 8 : writebuf, 0); return RETURN_VALUE_REGISTER_CONVENTION; } @@ -2930,7 +2933,8 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, gdbarch_num_regs (current_gdbarch) + mips_regnum (current_gdbarch)->fp0, TYPE_LENGTH (type), - TARGET_BYTE_ORDER, readbuf, writebuf, 0); + gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, 0); return RETURN_VALUE_REGISTER_CONVENTION; } else if (TYPE_CODE (type) == TYPE_CODE_STRUCT @@ -2962,7 +2966,8 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + regnum, TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)), - TARGET_BYTE_ORDER, readbuf, writebuf, offset); + gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, offset); } return RETURN_VALUE_REGISTER_CONVENTION; } @@ -3008,7 +3013,8 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, offset, xfer, regnum); mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + regnum, xfer, - TARGET_BYTE_ORDER, readbuf, writebuf, offset); + gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, offset); } return RETURN_VALUE_REGISTER_CONVENTION; } @@ -3125,7 +3131,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, { if (register_size (gdbarch, float_argreg) < 8 && len == 8) { - int low_offset = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? 4 : 0; + int low_offset = gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? 4 : 0; unsigned long regval; /* Write the low word of the double to the even register(s). */ @@ -3276,7 +3283,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, identified as such and GDB gets tweaked accordingly. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG && partial_len < MIPS32_REGSIZE && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) @@ -3341,7 +3348,8 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct type *type, gdbarch_num_regs (current_gdbarch) + mips_regnum (current_gdbarch)->fp0, TYPE_LENGTH (type), - TARGET_BYTE_ORDER, readbuf, writebuf, 0); + gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, 0); return RETURN_VALUE_REGISTER_CONVENTION; } else if (TYPE_CODE (type) == TYPE_CODE_FLT @@ -3352,27 +3360,31 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct type *type, FP0. */ if (mips_debug) fprintf_unfiltered (gdb_stderr, "Return float in $fp1/$fp0\n"); - switch (TARGET_BYTE_ORDER) + switch (gdbarch_byte_order (current_gdbarch)) { case BFD_ENDIAN_LITTLE: mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + mips_regnum (current_gdbarch)->fp0 + - 0, 4, TARGET_BYTE_ORDER, readbuf, writebuf, 0); + 0, 4, gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, 0); mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + mips_regnum (current_gdbarch)->fp0 + 1, - 4, TARGET_BYTE_ORDER, readbuf, writebuf, 4); + 4, gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, 4); break; case BFD_ENDIAN_BIG: mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + mips_regnum (current_gdbarch)->fp0 + 1, - 4, TARGET_BYTE_ORDER, readbuf, writebuf, 0); + 4, gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, 0); mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + mips_regnum (current_gdbarch)->fp0 + 0, - 4, TARGET_BYTE_ORDER, readbuf, writebuf, 4); + 4, gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, 4); break; default: internal_error (__FILE__, __LINE__, _("bad switch")); @@ -3410,7 +3422,8 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct type *type, mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + regnum, TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)), - TARGET_BYTE_ORDER, readbuf, writebuf, offset); + gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, offset); } return RETURN_VALUE_REGISTER_CONVENTION; } @@ -3460,7 +3473,8 @@ mips_o32_return_value (struct gdbarch *gdbarch, struct type *type, offset, xfer, regnum); mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + regnum, xfer, - TARGET_BYTE_ORDER, readbuf, writebuf, offset); + gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, offset); } return RETURN_VALUE_REGISTER_CONVENTION; } @@ -3606,7 +3620,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int longword_offset = 0; CORE_ADDR addr; stack_used_p = 1; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if ((typecode == TYPE_CODE_INT || typecode == TYPE_CODE_PTR @@ -3658,7 +3672,7 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, It does not seem to be necessary to do the same for integral types. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG && partial_len < MIPS64_REGSIZE && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) @@ -3722,7 +3736,8 @@ mips_o64_return_value (struct gdbarch *gdbarch, gdbarch_num_regs (current_gdbarch) + mips_regnum (current_gdbarch)->fp0, TYPE_LENGTH (type), - TARGET_BYTE_ORDER, readbuf, writebuf, 0); + gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, 0); return RETURN_VALUE_REGISTER_CONVENTION; } else @@ -3743,7 +3758,8 @@ mips_o64_return_value (struct gdbarch *gdbarch, offset, xfer, regnum); mips_xfer_register (regcache, gdbarch_num_regs (current_gdbarch) + regnum, xfer, - TARGET_BYTE_ORDER, readbuf, writebuf, offset); + gdbarch_byte_order (current_gdbarch), + readbuf, writebuf, offset); } return RETURN_VALUE_REGISTER_CONVENTION; } @@ -3809,7 +3825,7 @@ mips_read_fp_register_single (struct frame_info *frame, int regno, 32 bits. */ int offset; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) offset = 4; else offset = 0; @@ -3848,7 +3864,7 @@ mips_read_fp_register_double (struct frame_info *frame, int regno, /* mips_read_fp_register_single will find the correct 32 bits from each register. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { mips_read_fp_register_single (frame, regno, rare_buffer + 4); mips_read_fp_register_single (frame, regno + 1, rare_buffer); @@ -3964,7 +3980,7 @@ mips_print_register (struct ui_file *file, struct frame_info *frame, else fprintf_filtered (file, ": "); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) offset = register_size (current_gdbarch, regnum) - register_size (current_gdbarch, regnum); @@ -4052,7 +4068,7 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame, - register_size (current_gdbarch, regnum)); byte++) printf_filtered (" "); /* Now print the register value in hex, endian order. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) for (byte = register_size (current_gdbarch, regnum) - register_size (current_gdbarch, regnum); @@ -4351,7 +4367,7 @@ gdb_print_insn_mips (bfd_vma memaddr, struct disassemble_info *info) info->disassembler_options = "gpr-names=32"; /* Call the appropriate disassembler based on the target endian-ness. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) return print_insn_big_mips (memaddr, info); else return print_insn_little_mips (memaddr, info); @@ -4367,7 +4383,7 @@ gdb_print_insn_mips (bfd_vma memaddr, struct disassemble_info *info) static const gdb_byte * mips_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if (mips_pc_is_mips16 (*pcptr)) { diff --git a/gdb/mipsnbsd-tdep.c b/gdb/mipsnbsd-tdep.c index bd82af1a046..5ec52fa75ce 100644 --- a/gdb/mipsnbsd-tdep.c +++ b/gdb/mipsnbsd-tdep.c @@ -241,8 +241,9 @@ static LONGEST mipsnbsd_sigtramp_offset (struct frame_info *next_frame) { CORE_ADDR pc = frame_pc_unwind (next_frame); - const char *retcode = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG - ? sigtramp_retcode_mipseb : sigtramp_retcode_mipsel; + const char *retcode = gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? sigtramp_retcode_mipseb : + sigtramp_retcode_mipsel; unsigned char ret[RETCODE_SIZE], w[4]; LONGEST off; int i; diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c index b0cc87c0f85..428dd8b112f 100644 --- a/gdb/nto-tdep.c +++ b/gdb/nto-tdep.c @@ -122,7 +122,8 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname) else { arch = TARGET_ARCHITECTURE->arch_name; - endian = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "be" : "le"; + endian = gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? "be" : "le"; } /* In case nto_root is short, add strlen(solib) @@ -181,7 +182,8 @@ nto_init_solib_absolute_prefix (void) else { arch = TARGET_ARCHITECTURE->arch_name; - endian = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? "be" : "le"; + endian = gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? "be" : "le"; } sprintf (arch_path, "%s/%s%s", nto_root, arch, endian); diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index b5c5afb393a..5f306134163 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -654,12 +654,12 @@ store_register (const struct regcache *regcache, int tid, int regno) memset (buf, 0, sizeof buf); bytes_to_transfer = align_up (register_size (current_gdbarch, regno), sizeof (long)); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) { /* Little-endian values always sit at the left end of the buffer. */ regcache_raw_collect (regcache, regno, buf); } - else if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { /* Big-endian values sit at the right end of the buffer. */ size_t padding = (bytes_to_transfer diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 1392e0b75c2..d0b13f50670 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -475,7 +475,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) else { buf[0] = SDI_WRITE_MEMORY; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) store_long_parameter (buf + 1, pc_addr); else store_long_parameter (buf + 1, pc_addr - 1); @@ -515,7 +515,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) continue; /* Set PBP. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8000 + 4 * i, 4, 0x00000006); else @@ -542,7 +542,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) store_long_parameter (buf + 5, 4); if ((bp_addr & 2) == 0 && bp_addr != (pc_addr & 0xfffffffc)) { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { buf[9] = dbt_bp_entry[0]; buf[10] = dbt_bp_entry[1]; @@ -559,7 +559,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) } else { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if ((bp_addr & 2) == 0) { @@ -606,7 +606,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) continue; /* DBC register */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { switch (ab_type[i]) { @@ -747,7 +747,7 @@ m32r_wait (ptid_t ptid, struct target_waitstatus *status) if (last_pc_addr != 0xffffffff) { buf[0] = SDI_WRITE_MEMORY; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) store_long_parameter (buf + 1, last_pc_addr); else store_long_parameter (buf + 1, last_pc_addr - 1); @@ -776,7 +776,7 @@ m32r_wait (ptid_t ptid, struct target_waitstatus *status) address, we have to take care of it later. */ if ((pc_addr & 0x2) != 0) { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if ((bp_data[i][2] & 0x80) != 0) { @@ -838,7 +838,7 @@ m32r_wait (ptid_t ptid, struct target_waitstatus *status) c = serial_readchar (sdi_desc, SDI_TIMEOUT); if (c != '-' && recv_data (buf, 4) != -1) { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if ((buf[3] & 0x1) == 0x1) hit_watchpoint_addr = ab_address[i]; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 5c23bf27886..89f9276830a 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -702,7 +702,7 @@ rs6000_breakpoint_from_pc (CORE_ADDR *bp_addr, int *bp_size) static unsigned char big_breakpoint[] = { 0x7d, 0x82, 0x10, 0x08 }; static unsigned char little_breakpoint[] = { 0x08, 0x10, 0x82, 0x7d }; *bp_size = 4; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) return big_breakpoint; else return little_breakpoint; @@ -1683,7 +1683,8 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, else { /* Argument can fit in one register. No problem. */ - int adj = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? reg_size - len : 0; + int adj = gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? reg_size - len : 0; gdb_byte word[MAX_REGISTER_SIZE]; memset (word, 0, reg_size); @@ -2220,7 +2221,7 @@ e500_move_ev_register (void (*move) (struct regcache *regcache, reg_index = ev_reg - tdep->ppc_ev0_regnum; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { move (regcache, tdep->ppc_ev0_upper_regnum + reg_index, byte_buffer); move (regcache, tdep->ppc_gp0_regnum + reg_index, byte_buffer + 4); @@ -3026,7 +3027,7 @@ gdb_print_insn_powerpc (bfd_vma memaddr, disassemble_info *info) if (!info->disassembler_options) info->disassembler_options = "any"; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) return print_insn_big_powerpc (memaddr, info); else return print_insn_little_powerpc (memaddr, info); diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c index 1fdcd9dd4a1..c677113c787 100644 --- a/gdb/score-tdep.c +++ b/gdb/score-tdep.c @@ -316,7 +316,7 @@ score_register_sim_regno (int regnum) static int score_print_insn (bfd_vma memaddr, struct disassemble_info *info) { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) return print_insn_big_score (memaddr, info); else return print_insn_little_score (memaddr, info); @@ -336,7 +336,7 @@ score_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) } raw = extract_unsigned_integer (buf, SCORE_INSTLEN); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if (!(raw & 0x80008000)) { @@ -434,7 +434,8 @@ score_return_value (struct gdbarch *gdbarch, struct type *type, int xfer = SCORE_REGSIZE; if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; - score_xfer_register (regcache, regnum, xfer, TARGET_BYTE_ORDER, + score_xfer_register (regcache, regnum, xfer, + gdbarch_byte_order (current_gdbarch), readbuf, writebuf, offset); } return RETURN_VALUE_REGISTER_CONVENTION; @@ -544,7 +545,7 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function, Where X is a hole. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION) && argreg > SCORE_LAST_ARG_REGNUM @@ -557,8 +558,8 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function, ULONGEST regval = extract_unsigned_integer (val, partial_len); /* The last part of a arg should shift left when - TARGET_BYTE_ORDER is BFD_ENDIAN_BIG. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG + gdbarch_byte_order is BFD_ENDIAN_BIG. */ + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG && arg_last_part_p == 1 && (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)) @@ -668,7 +669,7 @@ score_fetch_inst (CORE_ADDR addr, char *memblock) inst.raw = extract_unsigned_integer (buf, SCORE_INSTLEN); inst.is15 = !(inst.raw & 0x80008000); inst.v = RM_PBITS (inst.raw); - big = (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG); + big = (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG); if (inst.is15) { if (big ^ ((addr & 0x2) == 2)) diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 204a29653bc..2fd316558b8 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -395,7 +395,7 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) static unsigned char big_remote_breakpoint[] = { 0xc3, 0x20 }; static unsigned char little_remote_breakpoint[] = { 0x20, 0xc3 }; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { *lenptr = sizeof (big_remote_breakpoint); return big_remote_breakpoint; @@ -502,7 +502,7 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) static int gdb_print_insn_sh (bfd_vma memaddr, disassemble_info * info) { - info->endian = TARGET_BYTE_ORDER; + info->endian = gdbarch_byte_order (current_gdbarch); return print_insn_sh (memaddr, info); } @@ -895,7 +895,7 @@ sh_justify_value_in_reg (struct value *val, int len) if (len < 4) { /* value gets right-justified in the register or stack word */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) memcpy (valbuf + (4 - len), (char *) value_contents (val), len); else memcpy (valbuf, (char *) value_contents (val), len); @@ -968,7 +968,7 @@ sh_next_flt_argreg (int len) /* Also mark the next register as used. */ flt_argreg_array[argreg + 1] = 1; } - else if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) { /* In little endian, gcc passes floats like this: f5, f4, f7, f6, ... */ if (!flt_argreg_array[argreg + 1]) @@ -1106,7 +1106,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch, register, increments the val and len values accordingly and then proceeds as normal by writing the second 32 bits into the next register. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE && TYPE_LENGTH (type) == 2 * reg_size) { regcache_cooked_write_unsigned (regcache, flt_argreg + 1, @@ -1247,7 +1247,7 @@ sh_extract_return_value_fpu (struct type *type, struct regcache *regcache, int len = TYPE_LENGTH (type); int i, regnum = FP0_REGNUM; for (i = 0; i < len; i += 4) - if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) regcache_raw_read (regcache, regnum++, (char *) valbuf + len - 4 - i); else regcache_raw_read (regcache, regnum++, (char *) valbuf + i); @@ -1291,7 +1291,7 @@ sh_store_return_value_fpu (struct type *type, struct regcache *regcache, int len = TYPE_LENGTH (type); int i, regnum = FP0_REGNUM; for (i = 0; i < len; i += 4) - if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) regcache_raw_write (regcache, regnum++, (char *) valbuf + len - 4 - i); else diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 32de32c355e..da0416e2470 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -267,7 +267,7 @@ sh64_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) which translates in big endian mode to 0x0, 0x3b and in little endian mode to 0x3b, 0x0*/ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { if (pc_is_isa32 (*pcptr)) { @@ -682,7 +682,7 @@ sh64_use_struct_convention (struct type *type) static int gdb_print_insn_sh64 (bfd_vma memaddr, disassemble_info *info) { - info->endian = TARGET_BYTE_ORDER; + info->endian = gdbarch_byte_order (current_gdbarch); return print_insn_sh (memaddr, info); } @@ -1104,7 +1104,7 @@ sh64_push_dummy_call (struct gdbarch *gdbarch, if (len < argreg_size) { /* value gets right-justified in the register or stack word */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) memcpy (valbuf + argreg_size - len, (char *) value_contents (args[argnum]), len); else @@ -1232,7 +1232,7 @@ sh64_extract_return_value (struct type *type, struct regcache *regcache, regcache_cooked_read (regcache, DR0_REGNUM, buf); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword, buf, &val); else @@ -1251,7 +1251,7 @@ sh64_extract_return_value (struct type *type, struct regcache *regcache, at the most significant end. */ regcache_raw_read (regcache, DEFAULT_RETURN_REGNUM, buf); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) offset = register_size (current_gdbarch, DEFAULT_RETURN_REGNUM) - len; else @@ -1281,7 +1281,7 @@ sh64_store_return_value (struct type *type, struct regcache *regcache, { int i, regnum = FP0_REGNUM; for (i = 0; i < len; i += 4) - if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) regcache_raw_write (regcache, regnum++, (char *) valbuf + len - 4 - i); else @@ -1296,7 +1296,7 @@ sh64_store_return_value (struct type *type, struct regcache *regcache, { /* Pad with zeros. */ memset (buf, 0, register_size (current_gdbarch, return_register)); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) offset = 0; /*register_size (current_gdbarch, return_register) - len;*/ else @@ -1527,7 +1527,7 @@ static void sh64_register_convert_to_virtual (int regnum, struct type *type, char *from, char *to) { - if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) != BFD_ENDIAN_LITTLE) { /* It is a no-op. */ memcpy (to, from, register_size (current_gdbarch, regnum)); @@ -1552,7 +1552,7 @@ static void sh64_register_convert_to_raw (struct type *type, int regnum, const void *from, void *to) { - if (TARGET_BYTE_ORDER != BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) != BFD_ENDIAN_LITTLE) { /* It is a no-op. */ memcpy (to, from, register_size (current_gdbarch, regnum)); @@ -1637,7 +1637,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, /* Build the value in the provided buffer. */ regcache_raw_read (regcache, base_regnum, temp_buffer); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) offset = 4; memcpy (buffer, temp_buffer + offset, 4); /* get LOWER 32 bits only????*/ } @@ -1797,7 +1797,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache, { base_regnum = sh64_compact_reg_base_num (reg_nr); /* reg_nr is 32 bit here, and base_regnum is 64 bits. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) offset = 4; else offset = 0; @@ -1988,8 +1988,9 @@ sh64_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file, fprintf_filtered (file, "\t(raw 0x"); for (j = 0; j < register_size (gdbarch, regnum); j++) { - int idx = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? j - : register_size (gdbarch, regnum) - 1 - j; + int idx = gdbarch_byte_order (current_gdbarch) + == BFD_ENDIAN_BIG ? j : register_size + (gdbarch, regnum) - 1 - j; fprintf_filtered (file, "%02x", raw_buffer[idx]); } fprintf_filtered (file, ")"); @@ -2336,7 +2337,7 @@ sh64_frame_prev_register (struct frame_info *next_frame, void **this_cache, if (valuep) { memset (valuep, 0, reg_size); - if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) read_memory (*addrp, valuep, size); else read_memory (*addrp, (char *) valuep + reg_size - size, size); diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c index ef9fa244a3f..77de43a339d 100644 --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c @@ -109,7 +109,8 @@ extern int xtensa_config_byte_order (struct gdbarch_info *); indicates that the instruction is an ENTRY instruction. */ #define XTENSA_IS_ENTRY(op1) \ - ((TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) ? ((op1) == 0x6c) : ((op1) == 0x36)) + ((gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) \ + ? ((op1) == 0x6c) : ((op1) == 0x36)) #define XTENSA_ENTRY_LENGTH 3 @@ -159,7 +160,7 @@ extract_call_winsize (CORE_ADDR pc) /* Lookup call insn. (Return the default value (4) if we can't find a valid call insn. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) { if (((insn & 0xf) == 0x5) || ((insn & 0xcf) == 0xc0)) winsize = (insn & 0x30) >> 2; /* 0, 4, 8, 12 */ @@ -332,7 +333,7 @@ xtensa_register_write_masked (xtensa_register_t *reg, unsigned char *buffer) DEBUGTRACE ("xtensa_register_write_masked ()\n"); /* Copy the masked register to host byte-order. */ - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) for (i = 0; i < bytesize; i++) { mem >>= 8; @@ -452,7 +453,7 @@ xtensa_register_read_masked (xtensa_register_t *reg, unsigned char *buffer) ptr = value; mem = *ptr; - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) for (i = 0; i < bytesize; i++) { if ((i & 3) == 0) @@ -1172,7 +1173,7 @@ xtensa_extract_return_value (struct type *type, DEBUGINFO ("[xtensa_extract_return_value] areg %d len %d\n", areg, len); - if (len < 4 && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (len < 4 && gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) offset = 4 - len; for (; len > 0; len -= 4, areg++, valbuf += 4) @@ -1211,7 +1212,7 @@ xtensa_store_return_value (struct type *type, DEBUGTRACE ("[xtensa_store_return_value] callsize %d wb %d\n", callsize, (int) wb); - if (len < 4 && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (len < 4 && gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) offset = 4 - len; areg = AREG_NUMBER (A2_REGNUM + callsize, wb); @@ -1428,7 +1429,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, word in big-endian mode and require a shift. This only applies for structures smaller than one word. */ - if (n < REGISTER_SIZE && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (n < REGISTER_SIZE + && gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) offset += (REGISTER_SIZE - n); write_memory (offset, info->contents, info->length); @@ -1446,7 +1448,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, than REGISTER_SIZE; for larger odd-sized structures the excess will be left-aligned in the register on both endiannesses. */ - if (n < REGISTER_SIZE && TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (n < REGISTER_SIZE + && gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { ULONGEST v = extract_unsigned_integer (cp, REGISTER_SIZE); v = v >> ((REGISTER_SIZE - n) * TARGET_CHAR_BIT); @@ -1511,7 +1514,7 @@ xtensa_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) if (ISA_USE_DENSITY_INSTRUCTIONS) { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { *lenptr = sizeof (density_big_breakpoint); return density_big_breakpoint; @@ -1524,7 +1527,7 @@ xtensa_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr) } else { - if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) { *lenptr = sizeof (big_breakpoint); return big_breakpoint; -- 2.30.2