X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fremote-mips.c;h=244df5aedf99d96093f3654c304ff5ef6e3bc877;hb=9b254dd1ce46c19dde1dde5b8d1e22e862dfacce;hp=5c2954db2470471e80cc8b9b084231f35d7b9879;hpb=316f20603ac3da3e7037cd20fd9580d6d77d71c5;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 5c2954db24..244df5aedf 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -1,7 +1,7 @@ /* Remote debugging interface for MIPS remote debugging protocol. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Ian Lance Taylor . @@ -10,7 +10,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -19,9 +19,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ #include "defs.h" #include "inferior.h" @@ -1594,10 +1592,10 @@ static void mips_open (char *name, int from_tty) { const char *monitor_prompt = NULL; - if (TARGET_ARCHITECTURE != NULL - && TARGET_ARCHITECTURE->arch == bfd_arch_mips) + if (gdbarch_bfd_arch_info (current_gdbarch) != NULL + && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_mips) { - switch (TARGET_ARCHITECTURE->mach) + switch (gdbarch_bfd_arch_info (current_gdbarch)->mach) { case bfd_mach_mips4100: case bfd_mach_mips4300: @@ -1755,19 +1753,30 @@ mips_wait (ptid_t ptid, struct target_waitstatus *status) &rpc, &rfp, &rsp, flags); if (nfields >= 3) { + struct regcache *regcache = get_current_regcache (); + struct gdbarch *gdbarch = get_regcache_arch (regcache); char buf[MAX_REGISTER_SIZE]; - store_unsigned_integer (buf, register_size (current_gdbarch, PC_REGNUM), rpc); - regcache_raw_supply (current_regcache, PC_REGNUM, buf); + store_unsigned_integer (buf, + register_size + (gdbarch, gdbarch_pc_regnum (gdbarch)), rpc); + regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), buf); - store_unsigned_integer (buf, register_size (current_gdbarch, PC_REGNUM), rfp); - regcache_raw_supply (current_regcache, 30, buf); /* This register they are avoiding and so it is unnamed */ + store_unsigned_integer + (buf, register_size (gdbarch, gdbarch_pc_regnum (gdbarch)), rfp); + regcache_raw_supply (regcache, 30, buf); /* This register they are avoiding and so it is unnamed */ - store_unsigned_integer (buf, register_size (current_gdbarch, SP_REGNUM), rsp); - regcache_raw_supply (current_regcache, SP_REGNUM, buf); + store_unsigned_integer (buf, register_size (gdbarch, + gdbarch_sp_regnum (gdbarch)), rsp); + regcache_raw_supply (regcache, gdbarch_sp_regnum (gdbarch), buf); - store_unsigned_integer (buf, register_size (current_gdbarch, DEPRECATED_FP_REGNUM), 0); - regcache_raw_supply (current_regcache, DEPRECATED_FP_REGNUM, buf); + store_unsigned_integer (buf, + register_size (gdbarch, + gdbarch_deprecated_fp_regnum + (gdbarch)), + 0); + regcache_raw_supply (regcache, + gdbarch_deprecated_fp_regnum (gdbarch), buf); if (nfields == 9) { @@ -1894,18 +1903,20 @@ mips_map_regno (int regno) static void mips_fetch_registers (struct regcache *regcache, int regno) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); unsigned LONGEST val; int err; if (regno == -1) { - for (regno = 0; regno < NUM_REGS; regno++) + for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++) mips_fetch_registers (regcache, regno); return; } - if (regno == DEPRECATED_FP_REGNUM || regno == MIPS_ZERO_REGNUM) - /* DEPRECATED_FP_REGNUM on the mips is a hack which is just + if (regno == gdbarch_deprecated_fp_regnum (gdbarch) + || regno == MIPS_ZERO_REGNUM) + /* gdbarch_deprecated_fp_regnum on the mips is a hack which is just supposed to read zero (see also mips-nat.c). */ val = 0; else @@ -1937,7 +1948,7 @@ mips_fetch_registers (struct regcache *regcache, int regno) /* We got the number the register holds, but gdb expects to see a value in the target byte ordering. */ - store_unsigned_integer (buf, register_size (current_gdbarch, regno), val); + store_unsigned_integer (buf, register_size (gdbarch, regno), val); regcache_raw_supply (regcache, regno, buf); } } @@ -1955,12 +1966,13 @@ mips_prepare_to_store (struct regcache *regcache) static void mips_store_registers (struct regcache *regcache, int regno) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); ULONGEST val; int err; if (regno == -1) { - for (regno = 0; regno < NUM_REGS; regno++) + for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++) mips_store_registers (regcache, regno); return; } @@ -2404,7 +2416,7 @@ common_breakpoint (int set, CORE_ADDR addr, int len, enum break_type type) int rpid, rerrflg, rresponse, rlen; int nfields; - addr = ADDR_BITS_REMOVE (addr); + addr = gdbarch_addr_bits_remove (current_gdbarch, addr); if (mips_monitor == MON_LSI) { @@ -3262,7 +3274,8 @@ mips_load (char *file, int from_tty) /* Work around problem where PMON monitor updates the PC after a load to a different value than GDB thinks it has. The following ensures that the write_pc() WILL update the PC value: */ - deprecated_register_valid[PC_REGNUM] = 0; + regcache_set_valid_p (get_current_regcache (), + gdbarch_pc_regnum (current_gdbarch), 0); } if (exec_bfd) write_pc (bfd_get_start_address (exec_bfd)); @@ -3321,6 +3334,7 @@ _initialize_remote_mips (void) mips_ops.to_load = mips_load; mips_ops.to_create_inferior = mips_create_inferior; mips_ops.to_mourn_inferior = mips_mourn_inferior; + mips_ops.to_log_command = serial_log_command; mips_ops.to_stratum = process_stratum; mips_ops.to_has_all_memory = 1; mips_ops.to_has_memory = 1;